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

Bug#507849: lintian.d.o run finished, source/binary mismatch not quite fixed



Jordà Polo <jorda@ettin.org> writes:

> The only problem is that the structure of those files isn't exactly the
> same.  E.g. the first time list-binpkg is run, the "source" field
> contains both, source package name and source version, but in subsequent
> runs it only has the source package name (and a new "source-version"
> field is used to keep the source version).
>
> I want to make sure everything else is OK before committing, but see the
> following patch for an idea of how to fix this issue.
>
> --- a/unpack/list-binpkg
> +++ b/unpack/list-binpkg
> @@ -161,6 +161,9 @@ while (!eof(IN)) {
>         $source_version = $2;
>      }
>  
> +    $source_version = $data->{'source-version'}
> +       if (exists $data->{'source-version'});
> +
>      # write entry to output file
>      print OUT join(';',
>                    $pkg,

Ah!  Yes.  That's exactly it.  Here's I think a more thorough fix that
makes things a bit more obvious and also removes some dead code.  I'll go
ahead and commit this.  Thank you so much for tracking this down!

diff --git a/unpack/list-binpkg b/unpack/list-binpkg
index 7f519b6..0152a00 100755
--- a/unpack/list-binpkg
+++ b/unpack/list-binpkg
@@ -34,7 +34,6 @@ if ($#ARGV == -1) {
 
 my $verbose = 0;
 my $output_file = undef;
-my $pkgdata = undef; # WTF?
 
 while (my $arg = shift) {
     if ($arg =~ s,^-,,o) {
@@ -139,12 +138,7 @@ while (!eof(IN)) {
     }
 
     if (($status eq 'new') or ($status eq 'changed')) {
-	if (defined $pkgdata) {
-	    # avoid collecting the info twice
-	    $data = $pkgdata;
-	} else {
-	    $data = &safe_get_deb_info($deb_file);
-	}
+	$data = &safe_get_deb_info($deb_file);
 	next if not defined $data;
 	$pkg = $data->{'package'};
     }
@@ -155,10 +149,13 @@ while (!eof(IN)) {
 	next;
     }
 
-    my $source_version = $data->{'version'};
-    if ($data->{'source'} =~ /^([-+\.\w]+)\s+\((.+)\)$/) {
-	$data->{'source'} = $1;
-	$source_version = $2;
+    unless (exists $data->{'source-version'}) {
+	if ($data->{'source'} =~ /^([-+\.\w]+)\s+\((.+)\)$/) {
+	    $data->{'source'} = $1;
+	    $data->{'source_version'} = $2;
+	} else {
+	    $data->{'source_version'} = $data->{'version'};
+	}
     }
 
     # write entry to output file
@@ -166,7 +163,7 @@ while (!eof(IN)) {
 		   $pkg,
 		   $data->{'version'},
 		   $data->{'source'},
-		   $source_version,
+		   $data->{'source_version'},
 		   $deb_file,
 		   $timestamp,
 		   ),"\n";


-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: