| 1 |
#!/usr/bin/perl |
#!/usr/bin/perl |
| 2 |
# Must run on a machine with madison. |
# Must run on a machine with madison. |
| 3 |
|
# |
| 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 |
use URI::Escape; |
use URI::Escape; |
| 9 |
|
|
| 10 |
my $html=0; |
my $html=0; |
| 19 |
|
|
| 20 |
|
|
| 21 |
my %data; |
my %data; |
| 22 |
my $unprop = my $unfixed = my $todos = 0; |
my %needkernel=qw/2.4.27 0 2.6.8 0/; |
| 23 |
|
my $list_unknown=1; #set to 1 to display kernel images with unknown source version |
| 24 |
|
my $sources=$ENV{SOURCES_FILE}; |
| 25 |
|
my $need_rebuild=0; |
| 26 |
|
|
| 27 |
|
my $unprop = my $unprop_all = my $unfixed = my $todos = 0; |
| 28 |
|
|
| 29 |
sub record { |
sub record { |
| 30 |
my ($package, $condition, $item)=@_; |
my ($package, $condition, $item)=@_; |
| 52 |
elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) { |
elsif (/^((?:DSA|CAN|CVE)-[^\s]+)/) { |
| 53 |
$id=$1; |
$id=$1; |
| 54 |
} |
} |
| 55 |
elsif (/^\s+[!-]\s+(.*?)\s+(.*)$/) { |
elsif (/^\s+[!-]\s+(\S+)\s+(.*?)\s*$/) { |
| 56 |
my $package=$1; |
my $package=$1; |
| 57 |
my $version=$2; |
my $version=$2; |
| 58 |
|
|
| 59 |
my $maddy=`madison -s testing '$package'`; |
if ($package=~/kernel-source-([0-9.]+)/) { |
| 60 |
if ($? & 128) { |
my $kernversion=$1; |
| 61 |
# good old newraff.. |
if (exists $needkernel{$kernversion} && |
| 62 |
record($package, "<em>madison segfaulted</em>", $id); |
$version!~/\(/ ) { |
| 63 |
|
$needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version"); |
| 64 |
|
} |
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
my @maddy; |
| 68 |
|
for (1..5) { |
| 69 |
|
@maddy=`madison -s testing '$package'`; |
| 70 |
|
if ($? & 127 || ($? >> 8 != 0 && $? >> 8 != 1)) { |
| 71 |
|
# good old unrelaible newraff, |
| 72 |
|
# home of our archive.. |
| 73 |
|
next; |
| 74 |
|
} |
| 75 |
|
last; |
| 76 |
|
} |
| 77 |
|
if ($? & 127) { |
| 78 |
|
record($package, "<em>[madison segfaulted 5 times in a row.. Medic!]</em>", $id); |
| 79 |
} |
} |
| 80 |
elsif ($? >> 8 != 0 && $? >> 8 != 1) { |
elsif ($? >> 8 != 0 && $? >> 8 != 1) { |
| 81 |
record($package, "<em>madison exited with ".($? >> 8)."</em>", $id); |
record($package, "<em>[madison exited with ".($? >> 8)."]</em>", $id); |
| 82 |
} |
} |
| 83 |
if (! length $maddy) { |
if (! @maddy) { |
| 84 |
next; |
next; |
| 85 |
} |
} |
| 86 |
|
|
| 89 |
$unfixed++; |
$unfixed++; |
| 90 |
} |
} |
| 91 |
else { |
else { |
| 92 |
my @fields = split(/\s*\|\s*/, $maddy); |
foreach my $maddy (@maddy) { |
| 93 |
my $havver=$fields[1]; |
my @fields = split(/\s*\|\s*/, $maddy); |
| 94 |
my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'"); |
my $havver=$fields[1]; |
| 95 |
if ($cmp != 0) { |
my $arches=$fields[3]; |
| 96 |
if ($html) { |
$version=~s/\s+//; # strip whitespace |
| 97 |
$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>'; |
$arches=~s/\s+$//; |
| 98 |
|
my $cmp=system("dpkg --compare-versions '$havver' '>=' '$version'"); |
| 99 |
|
if ($cmp != 0) { |
| 100 |
|
if ($html) { |
| 101 |
|
$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>'; |
| 102 |
|
} |
| 103 |
|
record($package, "$version needed, have $havver".(@maddy > 1 ? " [$arches]" : ""), $id); |
| 104 |
|
$unprop++; |
| 105 |
|
$unprop_all++ unless @maddy > 1; |
| 106 |
} |
} |
|
record($package, "$version needed, have $havver", $id); |
|
|
$unprop++; |
|
| 107 |
} |
} |
| 108 |
} |
} |
| 109 |
} |
} |
| 133 |
} |
} |
| 134 |
} |
} |
| 135 |
|
|
| 136 |
|
foreach my $version (sort keys %needkernel) { |
| 137 |
|
my %images; |
| 138 |
|
|
| 139 |
|
if ($needkern{$version} eq "0") { |
| 140 |
|
next; |
| 141 |
|
} |
| 142 |
|
|
| 143 |
|
my @dctrl; |
| 144 |
|
if (defined $sources && length $sources) { |
| 145 |
|
my $cat=($sources=~/\.gz/) ? "zcat" : "cat"; |
| 146 |
|
@dctrl=`$cat $sources | grep-dctrl -F Binary kernel-image-$version -s Package,Build-Depends -`; |
| 147 |
|
} |
| 148 |
|
|
| 149 |
|
my $package=""; |
| 150 |
|
my $haveversion; |
| 151 |
|
|
| 152 |
|
foreach my $line (@dctrl) { |
| 153 |
|
chomp; |
| 154 |
|
if ($line=~/Package:\s*(\S+)/) { |
| 155 |
|
$package=$1; |
| 156 |
|
$haveversion="0"; |
| 157 |
|
} elsif ($line=~/Build-Depends/) { |
| 158 |
|
if ($line=~/kernel-tree-$version-([^,\s]+)/) { |
| 159 |
|
$haveversion="$version-$1"; |
| 160 |
|
} elsif ($line=~/kernel-source-$version\s+\(>?=\s*([^\s\)]+)\)/) { |
| 161 |
|
$haveversion="$1"; |
| 162 |
|
} |
| 163 |
|
} else { |
| 164 |
|
if ($package=~/linux-kernel-di/ || $package eq "") { |
| 165 |
|
next; |
| 166 |
|
} |
| 167 |
|
$images{$package}=$haveversion; |
| 168 |
|
$package=""; |
| 169 |
|
} |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
foreach $package (sort keys %images) { |
| 173 |
|
if ($images{$package} eq "0") { |
| 174 |
|
print "<li>" if ($html && $list_unknown); |
| 175 |
|
print "$package built from kernel-source-$version $needkernel{$version} needed, current version unknown\n" if $list_unknown; |
| 176 |
|
} elsif (!system("dpkg --compare-versions $needkernel{$version} gt $images{$package}")) { |
| 177 |
|
print "<li>" if $html; |
| 178 |
|
print "$package built from kernel-source-$version $needkernel{$version} needed, have $images{$package}\n"; |
| 179 |
|
$need_rebuild++; |
| 180 |
|
} |
| 181 |
|
} |
| 182 |
|
|
| 183 |
|
|
| 184 |
|
} |
| 185 |
|
|
| 186 |
|
|
| 187 |
if ($html) { |
if ($html) { |
| 188 |
print "</ul>\n"; |
print "</ul>\n"; |
| 189 |
print "<hr>\n"; |
print "<hr>\n"; |
| 190 |
print "Total holes unfixed: $unfixed<br>\n"; |
print "Total holes unfixed: $unfixed<br>\n"; |
| 191 |
print "Total holes fixed in unstable but not testing: $unprop<br>\n"; |
print "Total holes fixed in unstable but not testing: $unprop_all"; |
| 192 |
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"; |
if ($unprop_all != $unprop) { |
| 193 |
|
print " (+".($unprop - $unprop_all)." on some arches)"; |
| 194 |
|
} |
| 195 |
|
print "<br>\n"; |
| 196 |
|
print "Total number of kernel image packages not up to date: $need_rebuild<br>\n"; |
| 197 |
|
print "Number of TODO lines in <a href=\"http://svn.debian.org/wsvn/secure-testing/data/?rev=0&sc=0\">records</a>: $todos<br>\n"; |
| 198 |
print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n"; |
print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n"; |
| 199 |
print "Last update: ".`date`."<br>\n"; |
print "Last update: ".`date`."<br>\n"; |
| 200 |
print "</html>\n"; |
print "</html>\n"; |