diff options
author | mat <mat@FreeBSD.org> | 2004-05-04 15:33:14 +0000 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2004-05-04 15:33:14 +0000 |
commit | 169f59a2d531202d44f63879418719c9963344ed (patch) | |
tree | 2172e4f7b962acfa8970197796495469a4a0c874 /sysutils/pkg_cutleaves | |
parent | 2b0aa3c02f73da16ab177dcac3fa8dc5eac03a3e (diff) | |
download | FreeBSD-ports-169f59a2d531202d44f63879418719c9963344ed.zip FreeBSD-ports-169f59a2d531202d44f63879418719c9963344ed.tar.gz |
Update to 20040414,
- Add the ability to handle portnames with + sign
PR: 65329
Submitted by: maintainer
Diffstat (limited to 'sysutils/pkg_cutleaves')
-rw-r--r-- | sysutils/pkg_cutleaves/Makefile | 2 | ||||
-rw-r--r-- | sysutils/pkg_cutleaves/src/pkg_cutleaves | 50 |
2 files changed, 34 insertions, 18 deletions
diff --git a/sysutils/pkg_cutleaves/Makefile b/sysutils/pkg_cutleaves/Makefile index 2dd7c0e..efef10c 100644 --- a/sysutils/pkg_cutleaves/Makefile +++ b/sysutils/pkg_cutleaves/Makefile @@ -8,7 +8,7 @@ # PORTNAME= pkg_cutleaves -PORTVERSION= 20040207 +PORTVERSION= 20040414 CATEGORIES= sysutils MASTER_SITES= # none DISTFILES= # none diff --git a/sysutils/pkg_cutleaves/src/pkg_cutleaves b/sysutils/pkg_cutleaves/src/pkg_cutleaves index 8c3507a..d27b811 100644 --- a/sysutils/pkg_cutleaves/src/pkg_cutleaves +++ b/sysutils/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)/); |