[Secure-testing-commits] r644 - sarge-checks

Joey Hess joeyh@costa.debian.org
Fri, 25 Mar 2005 02:44:19 +0000


Author: joeyh
Date: 2005-03-25 02:44:18 +0000 (Fri, 25 Mar 2005)
New Revision: 644

Modified:
   sarge-checks/checklist
Log:
merge in kernel binary build checking support (with some mods)


Modified: sarge-checks/checklist
===================================================================
--- sarge-checks/checklist	2005-03-25 02:29:35 UTC (rev 643)
+++ sarge-checks/checklist	2005-03-25 02:44:18 UTC (rev 644)
@@ -1,5 +1,10 @@
 #!/usr/bin/perl
 # Must run on a machine with madison.
+# 
+# To check for un-updated binary kernel packages, also needs grep-dctrl 
+# and a Sources file for the distribution. Set the location of the Sources
+# file in SOURCES_FILE in the environment.
+# 
 use URI::Escape;
 
 my $html=0;
@@ -14,6 +19,11 @@
 
 
 my %data;
+my %needkernel=qw/2.4.27 0 2.6.8 0/;
+my $list_unknown=0; #set to 1 to display kernel images with unknown source version
+my $sources=$ENV{SOURCES_FILE};
+my $need_rebuild=0;
+
 my $unprop = my $unfixed = my $todos = 0;
 
 sub record {
@@ -46,10 +56,18 @@
 			my $package=$1;
 			my $version=$2;
 			
+			if ($package=~/kernel-source-([0-9.]+)/) {
+			 	my $kernversion=$1;
+				if (exists $needkernel{$kernversion} &&
+						$version!~/\(/ ) {
+					$needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version");
+				}
+			}
+
 			my $maddy=`madison -s testing '$package'`;
 			if ($? & 128) {
 				# good old newraff..
-				record($package, "<em>madison segfaulted</em>", $id);
+				record($package, "madison segfaulted", $id);
 			}
 			elsif ($? >> 8 != 0 && $? >> 8 != 1) {
 				record($package, "<em>madison exited with ".($? >> 8)."</em>", $id);
@@ -101,11 +119,62 @@
 	}
 }
 
+foreach my $version (sort keys %needkernel) {
+	my %images;
+	
+	if ($needkern{$version} eq "0") {
+		next;
+	}
+
+	my @dctrl;
+	if (defined $sources && length $sources) {
+		@dctrl=`grep-dctrl -F Binary kernel-image-$version -s Package,Build-Depends $sources`;
+	}
+
+	my $package="";
+	my $haveversion;
+	
+	foreach my $line (@dctrl) {
+		chomp;
+		if ($line=~/Package:\s*(\S+)/) {
+			$package=$1;
+			$haveversion="0";
+		} elsif ($line=~/Build-Depends/) {
+			if ($line=~/kernel-tree-$version-([^,\s]+)/) {
+				$haveversion="$version-$1";
+			} elsif ($line=~/kernel-source-$version\s+\(>=\s*([^\s\)])\)/) {
+				$haveversion="$1";
+			}
+		} else {
+			if ($package=~/linux-kernel-di/ || $package eq "") {
+				next;
+			}
+			$images{$package}=$haveversion;
+			$package="";
+		}
+	}
+
+	foreach $package (sort keys %images) {
+		if ($images{$package} eq "0") {
+			print "<li>" if ($html && $list_unknown);
+			print "$package built from kernel-source-$version $needkernel{$version} needed, current version unknown\n" if $list_unknown;
+		} elsif (!system("dpkg --compare-versions $needkernel{$version} gt $images{$package}")) {
+		print "<li>" if $html;
+			print "$package built from kernel-source-$version $needkernel{$version} needed, have $images{$package}\n";
+			$need_rebuild++;
+		}
+	}
+
+
+}
+
+
 if ($html) {
 	print "</ul>\n";
 	print "<hr>\n";
 	print "Total holes unfixed: $unfixed<br>\n";
 	print "Total holes fixed in unstable but not testing: $unprop<br>\n";
+	print "Total number of kernel image source packages not up to date: $need_rebuild<br>\n";
 	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";
 	print "Maintained by the <a href=\"http://secure-testing.alioth.debian.org/\">testing security team</a><br>\n";
 	print "Last update: ".`date`."<br>\n";