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

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



On Thu, Dec 04, 2008 at 05:27:16PM -0800, Russ Allbery wrote:
> Currently, lintian.d.o groups packages by source package name and binary
> package version, which is not correct for packages where the binary package
> version may be unrelated to the source package version.
> linux-modules-extra-2.6 has this problem.  The packages should instead
> be grouped by source package and version.
> 
> To do this, we'll need to change the format of the binary package list
> to add an additional field, source package version.  In unpack/list-binpkg,
> we'll need to parse the Source field out of the Packages file.  If it's
> not present, we can assume it matches the binary package, including in
> version.  If it doesn't contain a version, we can assume the version
> matches.  Otherwise, we'll need to parse it for the version of the source
> package.
> 
> Then, the reporting harness will need to be updated to use the new source
> version field for package display.

I'm working on a patch to fix this issue. See the attached file, which
basically implements the changes Russ described.

The binary info file generated by list-binpkg includes a new "source
version" field[1], which is then used by html_reports to group packages
correctly. The generated HTML output also includes the version of binary
packages if it isn't the same as its source version[2].

Just wanted to make sure it is OK before polishing and committing (e.g.
udeb packages probably need something similar) and confirm no one else
is working on it.

 1. http://ettin.org/tmp/ldo-mockup/source-version/binary-packages
 2. http://ettin.org/tmp/ldo-mockup/source-version/full/random.html
diff --git a/lib/Read_pkglists.pm b/lib/Read_pkglists.pm
index f0f982f..ba944de 100644
--- a/lib/Read_pkglists.pm
+++ b/lib/Read_pkglists.pm
@@ -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,
        );
diff --git a/reporting/html_reports b/reporting/html_reports
index f3f3f0e..1a5b775 100755
--- a/reporting/html_reports
+++ b/reporting/html_reports
@@ -244,7 +244,7 @@ while (<>) {
             }
         }
         if ($type eq 'binary') {
-            $version = $binary_info{$package}->{version};
+            $version = $binary_info{$package}->{'source-version'};
         } elsif ($type eq 'udeb') {
             $version = $udeb_info{$package}->{version};
         }
@@ -270,6 +270,7 @@ while (<>) {
     my $info = {
         code      => html_quote ($code),
         package   => html_quote ($package),
+        version   => html_quote ($binary_info{$package}->{version}),
         type      => html_quote ($type),
         tag       => html_quote ($tag),
         severity  => html_quote ($tag_extra{$tag}{severity}),
diff --git a/reporting/templates/maintainer.tmpl b/reporting/templates/maintainer.tmpl
index f4cb013..5d78809 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..099320e 100755
--- a/unpack/list-binpkg
+++ b/unpack/list-binpkg
@@ -155,11 +160,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: