tags 160478 patch
thanks
Hi,
I've adapted Simon's patch to current version and made some cleanup/bugfix.
Please, could you consider appliing?
(note: I'm not sure if this fixes the other bugs that were merged with this
one, perhaps we should unmerge)
--
Robert Millan
diff -ur vrms-1.12.old/vrms vrms-1.12/vrms
--- vrms-1.12.old/vrms 2006-11-03 19:15:06.000000000 +0100
+++ vrms-1.12/vrms 2007-07-31 12:22:33.000000000 +0200
@@ -22,6 +22,7 @@
my $sparse = 0;
my $help = 0;
my $explain = 1;
+my $contrib = 0;
my $debug = 0;
my $reasondir = '/usr/share/vrms/reasons/';
my %reason = ();
@@ -42,6 +43,7 @@
if available.
--sparse, -s Just list non-free packages, nothing else.
--reason-dir=DIR Use DIR as the reason directory.
+--contrib, -c List packages in contrib instead of non-free.
--help, -h Display this help.
--debug, -d Generate debugging information.
@@ -83,6 +85,7 @@
's|sparse' => \$sparse,
'e|explain!' => \$explain,
'reason-dir=s' => \$reasondir,
+ 'c|contrib' => \$contrib,
'd|debug+' => \$debug,
'h|help' => \$help);
@@ -164,7 +167,7 @@
($label, $section) = split(/:\s+/,$_,2);
print "\tsection=[$section]\n" if $debug >= 1;
$has_section = 1; ### we have necessary section
- if ($section =~ /non-free|restricted|multiverse/) {
+ if(($contrib && $section =~ /contrib/) || $section =~ /non-free|restricted|multiverse/) {
### read thru rest of array to find descr instead of waiting for it
my $found_descr =0;
while (! $found_descr) {
@@ -264,25 +267,25 @@
}
if (!$quiet and $nfcnt == 0 and $pnfcnt == 0) {
- print "No non-free packages installed on $sysname! rms would be proud.\n";
+ print "No non-free" . ($contrib ? "/contrib" : "") . " packages installed on $sysname! rms would be proud.\n"
} elsif (!$quiet and !$sparse) {
my $total_nonfree = $nonfreecnt + $other_nonfreecnt;
my $total_installed = $pkgcnt;
my $percentage = $total_nonfree * 100 / $total_installed;
- printf "\n %d non-free packages, %2.1f%% of %d installed packages.\n",
+ printf "\n %d non-free" . ($contrib ? "/contrib" : "") . " packages, %2.1f%% of %d installed packages.\n",
$total_nonfree, $percentage, $total_installed;
}
format head =
@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-"Non-free packages installed on $sysname"
+"Non-free" . ($contrib ? "/Contrib" : "") . " packages installed on $sysname"
.
format partialhead =
@||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-"Non-free packages with status other than installed on $sysname"
+"Non-free" . ($contrib ? "/Contrib" : "") . " packages with status other than installed on $sysname"
.