/[secure-testing]/bin/checklist
ViewVC logotype

Contents of /bin/checklist

Parent Directory Parent Directory | Revision Log Revision Log


Revision 646 - (hide annotations) (download)
Fri Mar 25 02:54:22 2005 UTC (8 years, 1 month ago) by joeyh
Original Path: sarge-checks/checklist
File size: 4778 byte(s)
'fix whitespace stripping again..
1 joeyh 2 #!/usr/bin/perl
2     # Must run on a machine with madison.
3 joeyh 644 #
4     # To check for un-updated binary kernel packages, also needs grep-dctrl
5     # and a Sources file for the distribution. Set the location of the Sources
6     # file in SOURCES_FILE in the environment.
7     #
8 joeyh 256 use URI::Escape;
9 joeyh 2
10 joeyh 230 my $html=0;
11     if ($ARGV[0] eq 'html') {
12     shift;
13     $html=1;
14     }
15    
16 joeyh 31 if (! @ARGV) {
17 joeyh 230 die "usage: $0 [html] list\n";
18 joeyh 2 }
19    
20 joeyh 230
21 joeyh 307 my %data;
22 joeyh 644 my %needkernel=qw/2.4.27 0 2.6.8 0/;
23     my $list_unknown=0; #set to 1 to display kernel images with unknown source version
24     my $sources=$ENV{SOURCES_FILE};
25     my $need_rebuild=0;
26    
27 joeyh 309 my $unprop = my $unfixed = my $todos = 0;
28 joeyh 307
29     sub record {
30     my ($package, $condition, $item)=@_;
31    
32 joeyh 231 if ($html) {
33 joeyh 307 $condition=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;
34 joeyh 311 $condition=~s{unfixed}{<b>unfixed</b>}g;
35 joeyh 307 $item=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;
36 joeyh 231 }
37 joeyh 307
38     push @{$data{$package}{$condition}}, $item;
39 joeyh 230 }
40    
41 joeyh 31 foreach my $list (@ARGV) {
42     if (-d $list) {
43     $list="$list/list";
44 joeyh 2 }
45 joeyh 31
46     open (IN, $list) || die "open $list: $!";
47     while (<IN>) {
48     chomp;
49     if (/^\[/) {
50 joeyh 242 ($id)=m/((?:DSA|CAN|CVE)-[^\s]+) /;
51 joeyh 2 }
52 joeyh 242 elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) {
53     $id=$1;
54 joeyh 31 }
55 joeyh 643 elsif (/^\s+[!-]\s+(\S+)\s+(.*?)\s*$/) {
56 joeyh 31 my $package=$1;
57     my $version=$2;
58 joeyh 241
59 joeyh 644 if ($package=~/kernel-source-([0-9.]+)/) {
60     my $kernversion=$1;
61     if (exists $needkernel{$kernversion} &&
62     $version!~/\(/ ) {
63     $needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version");
64     }
65     }
66    
67 joeyh 241 my $maddy=`madison -s testing '$package'`;
68 joeyh 564 if ($? & 128) {
69     # good old newraff..
70 joeyh 644 record($package, "madison segfaulted", $id);
71 joeyh 564 }
72     elsif ($? >> 8 != 0 && $? >> 8 != 1) {
73 joeyh 627 record($package, "<em>madison exited with ".($? >> 8)."</em>", $id);
74 joeyh 564 }
75 joeyh 307 if (! length $maddy) {
76     next;
77     }
78 joeyh 241
79 joeyh 586 if ($version=~/unfixed/ || $version=~/pending/) {
80 joeyh 307 record($package, $version, $id);
81 joeyh 257 $unfixed++;
82 joeyh 2 }
83 joeyh 241 else {
84 joeyh 31 my @fields = split(/\s*\|\s*/, $maddy);
85 joeyh 230 my $havver=$fields[1];
86 joeyh 646 $version=~s/ *$//; # strip tailing whitespace
87 joeyh 230 my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'");
88 joeyh 31 if ($cmp != 0) {
89 joeyh 230 if ($html) {
90 joeyh 256 $havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
91 joeyh 230 }
92 joeyh 307 record($package, "$version needed, have $havver", $id);
93 joeyh 257 $unprop++;
94 joeyh 31 }
95     }
96 joeyh 2 }
97 joeyh 309 elsif (/\s+TODO/) {
98     $todos++;
99     }
100 joeyh 2 }
101     }
102 joeyh 230
103 joeyh 307
104 joeyh 230 if ($html) {
105 joeyh 307 print "<html><title>testing security issues</title>\n";
106     print "<ul>\n";
107     }
108    
109     foreach my $package (sort keys %data) {
110     foreach my $condition (sort keys %{$data{$package}}) {
111     print "<li>" if $html;
112     print "$package $condition for ";
113     my $items=0;
114     foreach my $item (sort @{$data{$package}{$condition}}) {
115     print ", " if $items > 0;
116     print $item;
117     $items++;
118     }
119     print "\n";
120     }
121     }
122    
123 joeyh 644 foreach my $version (sort keys %needkernel) {
124     my %images;
125    
126     if ($needkern{$version} eq "0") {
127     next;
128     }
129    
130     my @dctrl;
131     if (defined $sources && length $sources) {
132 joeyh 645 my $cat=($sources=~/\.gz/) ? "zcat" : "cat";
133     @dctrl=`$cat $sources | grep-dctrl -F Binary kernel-image-$version -s Package,Build-Depends -`;
134 joeyh 644 }
135    
136     my $package="";
137     my $haveversion;
138    
139     foreach my $line (@dctrl) {
140     chomp;
141     if ($line=~/Package:\s*(\S+)/) {
142     $package=$1;
143     $haveversion="0";
144     } elsif ($line=~/Build-Depends/) {
145     if ($line=~/kernel-tree-$version-([^,\s]+)/) {
146     $haveversion="$version-$1";
147     } elsif ($line=~/kernel-source-$version\s+\(>=\s*([^\s\)])\)/) {
148     $haveversion="$1";
149     }
150     } else {
151     if ($package=~/linux-kernel-di/ || $package eq "") {
152     next;
153     }
154     $images{$package}=$haveversion;
155     $package="";
156     }
157     }
158    
159     foreach $package (sort keys %images) {
160     if ($images{$package} eq "0") {
161     print "<li>" if ($html && $list_unknown);
162     print "$package built from kernel-source-$version $needkernel{$version} needed, current version unknown\n" if $list_unknown;
163     } elsif (!system("dpkg --compare-versions $needkernel{$version} gt $images{$package}")) {
164     print "<li>" if $html;
165     print "$package built from kernel-source-$version $needkernel{$version} needed, have $images{$package}\n";
166     $need_rebuild++;
167     }
168     }
169    
170    
171     }
172    
173    
174 joeyh 307 if ($html) {
175 joeyh 230 print "</ul>\n";
176 joeyh 233 print "<hr>\n";
177 joeyh 307 print "Total holes unfixed: $unfixed<br>\n";
178     print "Total holes fixed in unstable but not testing: $unprop<br>\n";
179 joeyh 644 print "Total number of kernel image source packages not up to date: $need_rebuild<br>\n";
180 joeyh 309 print "Number of TODO lines in <a href=\"http://svn.debian.org/wsvn/secure-testing/sarge-checks/?rev=0&sc=0\">records</a>: $todos<br>\n";
181 joeyh 382 print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n";
182 joeyh 244 print "Last update: ".`date`."<br>\n";
183     print "</html>\n";
184 joeyh 230 }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5