#!/usr/pkg/bin/perl # Check the duplication on gnuradio-*/PLIST (except gnuradio-default) # Check if whole meta-pkgs/gnuradio PLIST convers the one of gnuradio-default (use -m) # use -h for usage. use strict; use Getopt::Std; # option related our(%opts); our(@ARGV); my ($verbose) = 0; my ($PKGSRC) ='/usr/pkgsrc'; my ($CATEGORY) ='ham'; my ($DEFAULT) = 'gnuradio-default'; my (@LIST); # list of gnuradio-*/PLIST files my (%WORDS); # list of files in the PLIST (other than -default) my (%count); # number of appearance of files in the PLIST (other than -default) my (%CHECKED); # list of files found (in the -default) in the PLIST my (%FULL); # full list from gnuradio-default sub usage() { print <) { chomp(); if (/\@comment/) { next;} if (/\@pkgdir/) { next;} my ($word) = $_; my ($module) = $file; $file =~ s/gnuradio-//; $file =~ s,/PLIST,,; $WORDS{$word} .= ' '.$file; $count{$word}++; } close(FILE); } sub show_missing() { my ($file) = $DEFAULT.'/PLIST'; print " (-m) Reading $file \n" if $verbose; open (FILE, $file) || print "problem opening $file: $!\n"; while () { chomp(); if (/\@comment/) { next;} if (/\@pkgdir/) { next;} my ($word) = $_; my ($module) = $file; $file =~ s/gnuradio-//; $file =~ s,/PLIST,,; $FULL{$word}++; } close(FILE); foreach my $key (sort keys %FULL){ if ($WORDS{$key} ) { $CHECKED{$key}++; next;} else { printf ("missing: %30s\t\n", $key); } } foreach my $file (keys %WORDS) { if ( $CHECKED{$file} ) { next;} else { printf ("extra: %30s\n", $file); } } } sub show_dupe() { foreach my $key (sort keys %WORDS){ if ($count{$key} > 1 ) { printf ("%30s\t->%s\n", $key, $WORDS{$key}); } } } if ($opts{'m'}) { show_missing();} else { show_dupe();} exit;