[Secure-testing-commits] r1242 - data

Joey Hess joeyh@costa.debian.org
Mon, 20 Jun 2005 03:46:47 +0000


Author: joeyh
Date: 2005-06-20 03:46:47 +0000 (Mon, 20 Jun 2005)
New Revision: 1242

Modified:
   data/README
   data/checklist
Log:
add support for including urgencies in notes, and support for including
notes for already fixed packages

needs someone to add in html to colorise the can numbers according to their
urgency


Modified: data/README
===================================================================
--- data/README	2005-06-20 03:12:50 UTC (rev 1241)
+++ data/README	2005-06-20 03:46:47 UTC (rev 1242)
@@ -8,8 +8,8 @@
 
 [date] id description
 	{id id id}
-	UPCASE: test
-	- package version
+	UPCASE: text
+	- package [version] (note; note; note)
 
 end claimed by foo
 
@@ -32,10 +32,15 @@
 UPCASE
 	Any word in upper case, typically NOTE, HELP, TODO.
 	May be repeated for each entry.
-- package version
+- package [version] (note; notes; note)
 	Indicates that the problem is fixed in the given version of the
-	package. May repeat for other packages.
+	package. May repeat for other packages. If the problem is unfixed,
+	omit the version.
 
+	The notes can be freeform, but some are understood by the tools,
+	including "unfixed", "bug #nnnnn", and "high", "medium", or "low"
+	urgencies.
+
 begin claimed by foo
 end claimed by foo
 	Marks a set of items that are being checked by someone.

Modified: data/checklist
===================================================================
--- data/checklist	2005-06-20 03:12:50 UTC (rev 1241)
+++ data/checklist	2005-06-20 03:46:47 UTC (rev 1242)
@@ -19,6 +19,7 @@
 
 
 my %data;
+my @urgencies=("high", "medium", "low", "unknown");
 my %needkernel=qw/2.4.27 0 2.6.11 0/;
 my $list_unknown=1; #set to 1 to display kernel images with unknown source version
 my $sources=$ENV{SOURCES_FILE};
@@ -27,7 +28,7 @@
 my $unprop = my $unprop_all = my $unfixed = my $todos = 0;
 
 sub record {
-	my ($package, $condition, $item)=@_;
+	my ($package, $condition, $item, $urgency)=@_;
 		
 	if ($html) {
 		$condition=~s{bug #(\d+)}{<a href="http://bugs.debian.org/$1">bug #$1</a>}g;
@@ -35,7 +36,7 @@
 		$item=~s#((?:CAN|CVE)-\d+-\d+)#<a href="http://www.cve.mitre.org/cgi-bin/cvename.cgi?name=$1">$1</a>#g;
 	}
 
-	push @{$data{$package}{$condition}}, $item;
+	push @{$data{$package}{$condition}}, {item => $item, urgency => $urgency};
 }
 
 foreach my $list (@ARGV) {
@@ -54,12 +55,35 @@
 		}
 		elsif (/^\s+[!-]\s+(\S+)\s+(.*?)\s*$/) {
 			my $package=$1;
-			my $version=$2;
+			my $rest=$2;
+			my $version;
+			my $notes;
+			if ($rest=~/([^\(\s]+)\s+\((.*)\)/) {
+				$version=$1;
+				$notes=$2;
+			}
+			elsif ($rest=~/\((.*)\)/) {
+				$version="";
+				$notes=$1;
+			}
+			else {
+				$version=$rest;
+				$notes="";
+			}
+			my @notes=split(/\s*;\s+/, $notes);
+
+			my $urgency="unknown";
+			foreach my $u (@urgencies) {
+				if (grep { $_ eq $u } @notes) {
+					$urgency=$u;
+					@notes = grep { $_ ne $u } @notes;
+					last;
+				}
+			}
 			
 			if ($package=~/kernel-source-([0-9.]+)/) {
 			 	my $kernversion=$1;
-				if (exists $needkernel{$kernversion} &&
-						$version!~/\(/ ) {
+				if (exists $needkernel{$kernversion}) {
 					$needkernel{$kernversion}=$version if !system("dpkg --compare-versions $needkernel{$kernversion} lt $version");
 				}
 			}
@@ -84,8 +108,8 @@
 				next;
 			}
 			
-			if ($version=~/unfixed/ || $version=~/pending/) {
-				record($package, $version, $id);
+			if (grep { $_ eq 'unfixed' || $_ eq 'pending' } @notes) {
+				record($package, join("; ", @notes), $id, $urgency);
 				$unfixed++;
 			}
 			else {
@@ -100,7 +124,7 @@
 						if ($html) {
 							$havver='<a href="http://bjorn.haxx.se/debian/testing.pl?package='.uri_escape($package).'">'.$havver.'</a>';
 						}
-						record($package, "$version needed, have $havver".(@maddy > 1 ? " [$arches]" : ""), $id);
+						record($package, "$version needed, have $havver".(@maddy > 1 ? " [$arches]" : ""), $id, $urgency);
 						$unprop++;
 						$unprop_all++ unless @maddy > 1;
 					}
@@ -124,9 +148,20 @@
 		print "<li>" if $html;
 		print "$package $condition for ";
 		my $items=0;
-		foreach my $item (sort @{$data{$package}{$condition}}) {
+		foreach my $i (sort @{$data{$package}{$condition}}) {
 			print ", " if $items > 0;
-			print $item;
+			
+			if ($html) {
+				# TODO: replace with html for shades of red.
+				if ($i->{urgency} eq 'high') {
+					print "!!!";
+				}
+				elsif ($i->{urgency} eq 'medium') {
+					print "!";
+				}
+			}
+			print $i->{item};
+			
 			$items++;
 		}
 		print "\n";