[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#507849: lintian.d.o: group packages by source version



On Sun, Dec 14, 2008 at 05:29:24PM +0000, Adam D. Barratt wrote:
> You'll need to bump the package list versions ($*LIST_FORMAT at the top
> of Read_pkglists.pm) as otherwise using an existing laboratory produced
> by an earlier version of lintian will fail when splitting the fields.

Thanks for reminding me about it. Btw, how about $LAB_FORMAT in
frontend/lintian? It probably needs to be updated too.
 
> Adding equivalent modifications for udeb packages would be good, now
> that we're no longer hiding the fact that the tags belong to those
> packages (see 18eab956f696a6bb4600765ff29f4443c6b79891).

OK, I updated list-udebpkg, see attached patch. I'll commit it tomorrow
if there is nothing wrong with it.
diff --git a/debian/changelog b/debian/changelog
index 67b5314..bfcbb9a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,13 @@
 lintian (2.1.3) UNRELEASED; urgency=low
 
+  * lib/Read_pkglists.pm:
+    + [JP] Add a new "source version" field to binary and udeb info files.
+      Bump binary and udeb format version to 3 and 2 respectively.
+
+  * reporting/html_reports:
+    + [JP] Group packages by source version instead of binary version.
+      (Closes: #507849)
+
   * reporting/templates/maintainer.tmpl:
     + [ADB] Print tags affecting udeb packages under a heading for that
       package, rather than merging them in to whichever binary package
@@ -8,6 +16,11 @@ lintian (2.1.3) UNRELEASED; urgency=low
     + [ADB] Separate tags affecting a binary package from those of a source
       package with the same name when the binary is the first package produced
       from the source for which there are issues.
+    + [JP] Include binary package version in subtitles when it isn't the same
+      as the source version.
+
+  * unpack/list-{bin,udeb}pkg:
+    + [JP] Extract source package version from source field.
 
  -- Adam D. Barratt <adam@adam-barratt.org.uk>  Sun, 14 Dec 2008 17:20:38 +0000
 
diff --git a/lib/Read_pkglists.pm b/lib/Read_pkglists.pm
index f0f982f..81c3589 100644
--- a/lib/Read_pkglists.pm
+++ b/lib/Read_pkglists.pm
@@ -28,9 +28,9 @@ use vars qw($BINLIST_FORMAT $SRCLIST_FORMAT $UDEBLIST_FORMAT %source_info %binar
 
 # these banner lines have to be changed with every incompatible change of the
 # binary and source list file formats
-$BINLIST_FORMAT = "Lintian's list of binary packages in the archive--V2";
+$BINLIST_FORMAT = "Lintian's list of binary packages in the archive--V3";
 $SRCLIST_FORMAT = "Lintian's list of source packages in the archive--V3";
-$UDEBLIST_FORMAT = "Lintian's list of udeb packages in the archive--V1";
+$UDEBLIST_FORMAT = "Lintian's list of udeb packages in the archive--V2";
 
 %source_info = ();
 %binary_info = ();
@@ -115,7 +115,7 @@ sub read_bin_list {
     chop;
 
     next if /^\s*$/o;
-    my ($bin,$ver,$source,$file,$timestamp) = split(/\;/o,$_);
+    my ($bin,$ver,$source,$source_ver,$file,$timestamp) = split(/\;/o,$_);
 
     my $bin_struct;
     %$bin_struct =
@@ -123,6 +123,7 @@ sub read_bin_list {
        'package' => $bin,
        'version' => $ver,
        'source' => $source,
+       'source-version' => $source_ver,
        'file' => $file,
        'timestamp' => $timestamp,
        );
@@ -161,7 +162,7 @@ sub read_udeb_list {
     chop;
 
     next if /^\s*$/o;
-    my ($udeb,$ver,$source,$file,$timestamp) = split(/\;/o,$_);
+    my ($udeb,$ver,$source,$source_ver,$file,$timestamp) = split(/\;/o,$_);
 
     my $udeb_struct;
     %$udeb_struct =
@@ -169,6 +170,7 @@ sub read_udeb_list {
        'package' => $udeb,
        'version' => $ver,
        'source' => $source,
+       'source-version' => $source_ver,
        'file' => $file,
        'timestamp' => $timestamp,
        );
diff --git a/reporting/html_reports b/reporting/html_reports
index f3f3f0e..743261c 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -219,7 +219,7 @@ while (<>) {
     # to be no source package in the archive.  Determine the maintainer and
     # version.  Work around a missing source package by pulling information
     # from a binary package or udeb of the same name if there is any.
-    my ($source, $version, $maintainer, $uploaders);
+    my ($source, $version, $source_version, $maintainer, $uploaders);
     if ($type eq 'source') {
         $source = $package;
         if (exists $source_info{$source}) {
@@ -245,12 +245,15 @@ while (<>) {
         }
         if ($type eq 'binary') {
             $version = $binary_info{$package}->{version};
+            $source_version = $binary_info{$package}->{'source-version'};
         } elsif ($type eq 'udeb') {
             $version = $udeb_info{$package}->{version};
+            $source_version = $udeb_info{$package}->{'source-version'};
         }
     }
     $maintainer ||= '(unknown)';
     $version ||= 'unknown';
+    $source_version ||= $version;
 
     # Check if we've seen the URL for this maintainer before and, if so, map
     # them to the same person as the previous one.
@@ -270,6 +273,7 @@ while (<>) {
     my $info = {
         code      => html_quote ($code),
         package   => html_quote ($package),
+        version   => html_quote ($version),
         type      => html_quote ($type),
         tag       => html_quote ($tag),
         severity  => html_quote ($tag_extra{$tag}{severity}),
@@ -277,8 +281,8 @@ while (<>) {
         extra     => html_quote ($extra),
         xref      => maintainer_url ($maintainer) . "#$source"
     };
-    $by_maint{$maintainer}{$source}{$version} ||= [];
-    push(@{ $by_maint{$maintainer}{$source}{$version} }, $info);
+    $by_maint{$maintainer}{$source}{$source_version} ||= [];
+    push(@{ $by_maint{$maintainer}{$source}{$source_version} }, $info);
     $by_tag{$tag} ||= [];
     push(@{ $by_tag{$tag} }, $info);
 
@@ -290,8 +294,8 @@ while (<>) {
             my $uploader = map_maintainer ($_);
             next if $uploader eq $maintainer;
             $saw_maintainer{$uploader} = 1;
-            $by_uploader{$uploader}{$source}{$version} ||= [];
-            push(@{ $by_uploader{$uploader}{$source}{$version} }, $info);
+            $by_uploader{$uploader}{$source}{$source_version} ||= [];
+            push(@{ $by_uploader{$uploader}{$source}{$source_version} }, $info);
         }
     }
 }
diff --git a/reporting/templates/maintainer.tmpl b/reporting/templates/maintainer.tmpl
index f7f0353..c0c218f 100644
--- a/reporting/templates/maintainer.tmpl
+++ b/reporting/templates/maintainer.tmpl
@@ -94,9 +94,12 @@
                     $OUT .= qq(  <ul class="report">\n) unless $is_binary;
                 }
 
+                my $bin_version = "";
+                $bin_version = " ($info->{version})" if $info->{version} ne $version;
+
                 if ($new_binary) {
                     $OUT .= "</ul>\n    </li>\n  </ul>\n" unless $first;
-                    $OUT .= qq(  <h3>$info->{package}</h3>\n);
+                    $OUT .= qq(  <h3>$info->{package}$bin_version</h3>\n);
                     $OUT .= qq(  <ul class="report">\n);
                 }
 
diff --git a/unpack/list-binpkg b/unpack/list-binpkg
index 37e6447..0efd1c8 100755
--- a/unpack/list-binpkg
+++ b/unpack/list-binpkg
@@ -155,11 +155,18 @@ while (!eof(IN)) {
 	next;
     }
 
+    my $source_version = $data->{'version'};
+    if ($data->{'source'} =~ /^([-+\.\w]+)\s+\((.*)\)$/) {
+	$data->{'source'} = $1;
+	$source_version = $2;
+    }
+
     # write entry to output file
     print OUT join(';',
 		   $pkg,
 		   $data->{'version'},
 		   $data->{'source'},
+		   $source_version,
 		   $deb_file,
 		   $timestamp,
 		   ),"\n";
diff --git a/unpack/list-udebpkg b/unpack/list-udebpkg
index c8c8659..6bd0b63 100755
--- a/unpack/list-udebpkg
+++ b/unpack/list-udebpkg
@@ -156,11 +156,18 @@ while (!eof(IN)) {
 	next;
     }
 
+    my $source_version = $data->{'version'};
+    if ($data->{'source'} =~ /^([-+\.\w]+)\s+\((.*)\)$/) {
+	$data->{'source'} = $1;
+	$source_version = $2;
+    }
+
     # write entry to output file
     print OUT join(';',
 		   $pkg,
 		   $data->{'version'},
 		   $data->{'source'},
+		   $source_version,
 		   $deb_file,
 		   $timestamp,
 		   ),"\n";

Reply to: