Author: joeyh Date: 2004-10-28 15:39:00 -0600 (Thu, 28 Oct 2004) New Revision: 31 Modified: sarge-checks/checklist.pl Log: support CVEs, multiple lists, and being passed directories Modified: sarge-checks/checklist.pl ==================================================================--- sarge-checks/checklist.pl 2004-10-28 21:37:32 UTC (rev 30) +++ sarge-checks/checklist.pl 2004-10-28 21:39:00 UTC (rev 31) @@ -1,37 +1,42 @@ #!/usr/bin/perl # Must run on a machine with madison. -my $list=shift; -if (! $list) { +if (! @ARGV) { die "usage: $0 list\n"; } -open (IN, $list) || die "open $list: $!"; -while (<IN>) { - chomp; - if (/^\[/) { - ($id)=m/(DSA-.*?) /; +foreach my $list (@ARGV) { + if (-d $list) { + $list="$list/list"; } - elsif (/^CAN-/) { - $id=$_; - } - elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) { - my $package=$1; - my $version=$2; - if ($version=~/unfixed/) { - print "$package $version for $id\n"; - next; + + open (IN, $list) || die "open $list: $!"; + while (<IN>) { + chomp; + if (/^\[/) { + ($id)=m/(DSA-.*?) /; } - my $maddy=`madison -s testing ''$package''`; - if (length $maddy) { - my @fields = split(/\s*\|\s*/, $maddy); - my $cmp=system("dpkg --compare-versions ''$fields[1]'' ''>='' ''$version''"); - if ($cmp != 0) { - print "$package $version needed, have $fields[1] for $id\n"; + elsif (/^(CAN|CVE)-/) { + $id=$_; + } + elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) { + my $package=$1; + my $version=$2; + if ($version=~/unfixed/) { + print "$package $version for $id\n"; + next; } + my $maddy=`madison -s testing ''$package''`; + if (length $maddy) { + my @fields = split(/\s*\|\s*/, $maddy); + my $cmp=system("dpkg --compare-versions ''$fields[1]'' ''>='' ''$version''"); + if ($cmp != 0) { + print "$package $version needed, have $fields[1] for $id\n"; + } + } } + elsif (/HELP/) { + print $_." ($id)\n"; + } } - elsif (/HELP/) { - print $_." ($id)\n"; - } }