diff options
author | Mathieu Arnold <mat@FreeBSD.org> | 2004-05-04 15:33:14 +0000 |
---|---|---|
committer | Mathieu Arnold <mat@FreeBSD.org> | 2004-05-04 15:33:14 +0000 |
commit | 3dc797a22f41bd1c3d2175606801f5e0f73ca928 (patch) | |
tree | 316fdbcbf679919831838fab2c481db38755e624 /ports-mgmt/pkg_cutleaves | |
parent | - Update to version 2.1.4 (diff) |
Update to 20040414,
- Add the ability to handle portnames with + sign
PR: 65329
Submitted by: maintainer
Notes
Notes:
svn path=/head/; revision=108380
Diffstat (limited to 'ports-mgmt/pkg_cutleaves')
-rw-r--r-- | ports-mgmt/pkg_cutleaves/Makefile | 2 | ||||
-rw-r--r-- | ports-mgmt/pkg_cutleaves/src/pkg_cutleaves | 50 |
2 files changed, 34 insertions, 18 deletions
diff --git a/ports-mgmt/pkg_cutleaves/Makefile b/ports-mgmt/pkg_cutleaves/Makefile index 2dd7c0e51378..efef10c6f367 100644 --- a/ports-mgmt/pkg_cutleaves/Makefile +++ b/ports-mgmt/pkg_cutleaves/Makefile @@ -8,7 +8,7 @@ # PORTNAME= pkg_cutleaves -PORTVERSION= 20040207 +PORTVERSION= 20040414 CATEGORIES= sysutils MASTER_SITES= # none DISTFILES= # none diff --git a/ports-mgmt/pkg_cutleaves/src/pkg_cutleaves b/ports-mgmt/pkg_cutleaves/src/pkg_cutleaves index 8c3507a06eee..d27b8116489f 100644 --- a/ports-mgmt/pkg_cutleaves/src/pkg_cutleaves +++ b/ports-mgmt/pkg_cutleaves/src/pkg_cutleaves @@ -64,6 +64,8 @@ sub get_excl_pattern { chomp($exclude); # Ignore comments and empty lines, add others as regular expressions unless (($exclude =~ m/(^ *#)|(^ *$)/)) { + # Escape any '+' that isn't already escaped + $exclude =~ s/(?<!\\)(\+|\.)/\\$1/g; $exclude = "^" . $exclude . ".*"; push @excludes, $exclude; } @@ -156,28 +158,26 @@ if ($opt_listonly) { } } } else { + my %leaves; my %leavestokeep; my %leavestocut; my @cutleaves; - my ($nleaves, $i); + my ($nleaves, $i, $again); + + # Get list of leaf packages and put them into a hash + %leaves = get_leaves($dbdir, $exclpattern); + # Any leaves to work with? + $nleaves = keys %leaves; + if ($nleaves > 0) { + $again = "y"; + } else { + # If not, don't go on, there's nothing to do. + print "** Didn't find any leaves to work with, exiting.\n"; + print "** If this is unexpected, check your exclude file, please.\n"; + $again = "n"; + } # Loop while the user wants to - my $again = "y"; ROUND: while($again eq "y") { - # Get list of leaf packages and put them into a hash - my %leaves = get_leaves($dbdir, $exclpattern); - # Ignore all leaves the user already told us to keep - foreach my $leaf (keys %leavestokeep) { - if ($leaves{$leaf}) { - delete $leaves{$leaf}; - } - } - # Any leaves left? - $nleaves = keys %leaves; - if ($nleaves == 0) { - # If not, don't go on, there's nothing left to do. - print "Didn't find any new leaves, exiting.\n"; - last ROUND; - } # Always start with an empty list of leaves to cut %leavestocut = (); # Initialize counter for progress status @@ -237,6 +237,22 @@ if ($opt_listonly) { } } + # Get new list of leaf packages and put them into a hash + %leaves = get_leaves($dbdir, $exclpattern); + # Ignore all leaves the user already told us to keep + foreach my $leaf (keys %leavestokeep) { + if ($leaves{$leaf}) { + delete $leaves{$leaf}; + } + } + # Any leaves left? + $nleaves = keys %leaves; + if ($nleaves == 0) { + # If not, don't go on, there's nothing left to do. + print "** Didn't find any new leaves to work with, exiting.\n"; + last ROUND; + } + print "Go on with new leaf packages ((y)es/[no])? "; # Get first character of input, without leading whitespace ($again) = (lc(<STDIN>) =~ m/(\S)/); |