View | Details | Raw Unified | Return to bug 65329
Collapse All | Expand All

(-)pkg_cutleaves/Makefile (-1 / +1 lines)
Lines 8-14 Link Here
8
#
8
#
9
9
10
PORTNAME=	pkg_cutleaves
10
PORTNAME=	pkg_cutleaves
11
PORTVERSION=	20040207
11
PORTVERSION=	20040414
12
CATEGORIES=	sysutils
12
CATEGORIES=	sysutils
13
MASTER_SITES=	# none
13
MASTER_SITES=	# none
14
DISTFILES=	# none
14
DISTFILES=	# none
(-)pkg_cutleaves/src/pkg_cutleaves (-18 / +34 lines)
Lines 25-31 Link Here
25
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
# SUCH DAMAGE.
26
# SUCH DAMAGE.
27
#
27
#
28
# $FreeBSD: ports/sysutils/pkg_cutleaves/src/pkg_cutleaves,v 1.5 2004/02/08 22:25:19 pav Exp $
28
# $FreeBSD$
29
29
30
# Interactive script for deinstalling "leaf" packages;
30
# Interactive script for deinstalling "leaf" packages;
31
# requires the portupgrade tools
31
# requires the portupgrade tools
Lines 64-69 Link Here
64
			chomp($exclude);
64
			chomp($exclude);
65
			# Ignore comments and empty lines, add others as regular expressions
65
			# Ignore comments and empty lines, add others as regular expressions
66
			unless (($exclude =~ m/(^ *#)|(^ *$)/)) {
66
			unless (($exclude =~ m/(^ *#)|(^ *$)/)) {
67
				# Escape any '+' that isn't already escaped
68
				$exclude =~ s/(?<!\\)(\+|\.)/\\$1/g;
67
				$exclude = "^" . $exclude . ".*";
69
				$exclude = "^" . $exclude . ".*";
68
				push @excludes, $exclude;
70
				push @excludes, $exclude;
69
			}
71
			}
Lines 156-183 Link Here
156
		}
158
		}
157
	}
159
	}
158
} else {
160
} else {
161
	my %leaves;
159
	my %leavestokeep;
162
	my %leavestokeep;
160
	my %leavestocut;
163
	my %leavestocut;
161
	my @cutleaves;
164
	my @cutleaves;
162
	my ($nleaves, $i);
165
	my ($nleaves, $i, $again);
166
167
	# Get list of leaf packages and put them into a hash
168
	%leaves = get_leaves($dbdir, $exclpattern);
169
	# Any leaves to work with?
170
	$nleaves = keys %leaves;
171
	if ($nleaves > 0) {
172
		$again = "y";
173
	} else {
174
		# If not, don't go on, there's nothing to do.
175
		print "** Didn't find any leaves to work with, exiting.\n";
176
		print "** If this is unexpected, check your exclude file, please.\n";
177
		$again = "n";
178
	}
163
	# Loop while the user wants to
179
	# Loop while the user wants to
164
	my $again = "y";
165
	ROUND: while($again eq "y") {
180
	ROUND: while($again eq "y") {
166
		# Get list of leaf packages and put them into a hash
167
		my %leaves = get_leaves($dbdir, $exclpattern);
168
		# Ignore all leaves the user already told us to keep
169
		foreach my $leaf (keys %leavestokeep) {
170
			if ($leaves{$leaf}) {
171
				delete $leaves{$leaf};
172
			}
173
		}
174
		# Any leaves left?
175
		$nleaves = keys %leaves;
176
		if ($nleaves == 0) {
177
			# If not, don't go on, there's nothing left to do.
178
			print "Didn't find any new leaves, exiting.\n";
179
			last ROUND;
180
		}
181
		# Always start with an empty list of leaves to cut
181
		# Always start with an empty list of leaves to cut
182
		%leavestocut = ();
182
		%leavestocut = ();
183
		# Initialize counter for progress status
183
		# Initialize counter for progress status
Lines 235-240 Link Here
235
				print STDERR "\n\n$0: pkgdb returned $status - exiting, fix this first.\n\n";
235
				print STDERR "\n\n$0: pkgdb returned $status - exiting, fix this first.\n\n";
236
				last ROUND;
236
				last ROUND;
237
			}
237
			}
238
		}
239
240
		# Get new list of leaf packages and put them into a hash
241
		%leaves = get_leaves($dbdir, $exclpattern);
242
		# Ignore all leaves the user already told us to keep
243
		foreach my $leaf (keys %leavestokeep) {
244
			if ($leaves{$leaf}) {
245
				delete $leaves{$leaf};
246
			}
247
		}
248
		# Any leaves left?
249
		$nleaves = keys %leaves;
250
		if ($nleaves == 0) {
251
			# If not, don't go on, there's nothing left to do.
252
			print "** Didn't find any new leaves to work with, exiting.\n";
253
			last ROUND;
238
		}
254
		}
239
255
240
		print "Go on with new leaf packages ((y)es/[no])? ";
256
		print "Go on with new leaf packages ((y)es/[no])? ";

Return to bug 65329