Hi,
I second Collin's proposal to run wdiff when debdiff-ing *.changes
containing multi-binary packages.
I have no idea why somebody made such decision to treat multi-binary
changes files different than single-binary ones, but I think it's
rather silly behaviour and could be misleading for users. For example
me, before discovering this inconsistency a few weeks ago, used to
think that no wdiff output meant that the control fields had not
changed.
I prepared a simple patch for this issue. It would be great if you
could apply it in the next debdiff version. Otherwise please add at
least some warning saying that on multi-binary changes file the control
fields are not compared.
Best Regards,
robert
--- /usr/bin/debdiff 2005-01-13 12:02:05.000000000 +0100
+++ debdiff 2005-03-16 20:14:38.000000000 +0100
@@ -227,8 +227,9 @@
# %deb1 and %deb2, each key of which is a .deb name and each value is
# a list ref. Note we need to use our, not my, as we will be symbolically
# referencing these variables
+my @CommonDebs = ();
my @singledeb;
-our (%debs1, %debs2, %files1, %files2, @D1, @D2, $dir1, $dir2);
+our (%debs1, %debs2, %files1, %files2, @D1, @D2, $dir1, $dir2, %DebPaths1,
%DebPaths2);
if ($type eq 'deb') {
no strict 'refs';
@@ -271,7 +272,7 @@
last if $infiles and /^[^ ]/;
/^Files:/ and $infiles=1, next;
next unless $infiles;
- / (\S*.deb)$/ and push @debs, $1;
+ / (\S*.deb)$/ and push @debs, dirname($changes) . '/' . $1;
}
close CHANGES
or fatal "Problem reading $changes: $!";
@@ -281,8 +282,8 @@
# Is there only one .deb listed?
if (@debs == 1) {
- $singledeb[$i] = dirname($changes) . '/' . $debs[0];
- }
+ $singledeb[$i] = $debs[0];
+ }
}
my %D = ();
@@ -291,6 +292,7 @@
fatal "Can't read file: $deb" unless -r $deb;
my $debc = `env LC_ALL=C dpkg-deb -c $deb`;
$? == 0 or fatal "dpkg-deb -c $deb failed!";
+ my $debpath = $deb;
# get package name itself
$deb =~ s,.*/,,; $deb =~ s/_.*//;
$deb = $renamed{$deb} if $i == 1 and exists $renamed{$deb};
@@ -299,6 +301,7 @@
} else {
${"debs$i"}{$deb} = 1;
}
+ ${"DebPaths$i"}{$deb} = $debpath;
foreach my $file (@{process_debc($debc,$i)}) {
${"files$i"}{$file} .= "$deb:";
${"D$i"}{$file} = 1;
@@ -406,6 +409,7 @@
my @losses = sort grep $debs{$_} < 0, keys %debs;
my @gains = sort grep $debs{$_} > 0, keys %debs;
+ @CommonDebs= sort grep $debs{$_} == 0, keys %debs;
if (@gains) {
my $msg = "Warning: these package names were in the second list but not
in the first:";
@@ -528,9 +532,14 @@
}
# We compare the control files (at least the dependency fields)
-# if we are examining precisely two .debs.
-exit 0 unless defined $singledeb[1] and defined $singledeb[2]
- and $compare_control;
+my $dummyname = "---DUMMY---";
+if (defined $singledeb[1] and defined $singledeb[2]) {
+ @CommonDebs = ( $dummyname );
+ $DebPaths1{$dummyname} = $singledeb[1];
+ $DebPaths2{$dummyname} = $singledeb[2];
+}
+
+exit 0 unless ($#CommonDebs > -1) and $compare_control;
if (! -x "/usr/bin/wdiff") {
warn "Can't compare control files; wdiff package not installed\n";
@@ -539,42 +548,47 @@
mktmpdirs();
-no strict 'refs';
-
-for my $i (1,2) {
- if (system('dpkg-deb', '-e', "$singledeb[$i]", ${"dir$i"})) {
- my $msg = "dpkg-deb -e $singledeb[$i] failed!";
- system ("rm", "-rf", $dir1, $dir2);
- fatal $msg;
- }
-}
+
+for my $debname (@CommonDebs) {
-use strict 'refs';
+ no strict 'refs';
-print "\n";
-my $wdiff = `wdiff -n $wdiff_opt $dir1/control $dir2/control`;
-if ($? >> 8 == 0) {
- print "No differences were encountered in the control files\n";
-} elsif ($? >> 8 == 1) {
- if ($wdiff_opt) {
- # Don't try messing with control codes
- my $msg = "The following is the wdiff output between the control
files:";
- print $msg, "\n", '-' x length $msg, "\n";
- print $wdiff;
- } else {
- my @output;
- @output = split /\n/, $wdiff;
- @output = grep /(\[-|\{\+)/, @output;
- my $msg = "The following lines in the control files differ (wdiff
output format):";
- print $msg, "\n", '-' x length $msg, "\n";
- print join("\n",@output), "\n";
- }
-} else {
- warn "wdiff failed (exit status " . ($? >> 8) .
- (($? & 0x7f) ? " with signal " . ($? & 0x7f) : "") . ")\n";
-}
-# Clean up
-system ("rm", "-rf", $dir1, $dir2);
+ for my $i (1,2) {
+ if (system('dpkg-deb', '-e', "${\"DebPaths$i\"}{$debname}",
${"dir$i"})) {
+ my $msg = "dpkg-deb -e ${\"DebPaths$i\"}{$debname} failed!";
+ system ("rm", "-rf", $dir1, $dir2);
+ fatal $msg;
+ }
+ }
+
+ use strict 'refs';
+
+ print "\n";
+ print "Comparing control fields of package $debname:\n" unless
$debname eq $dummyname;
+ my $wdiff = `wdiff -n $wdiff_opt $dir1/control $dir2/control`;
+ if ($? >> 8 == 0) {
+ print "No differences were encountered in the control files\n";
+ } elsif ($? >> 8 == 1) {
+ if ($wdiff_opt) {
+ # Don't try messing with control codes
+ my $msg = "The following is the wdiff output between the
control files:";
+ print $msg, "\n", '-' x length $msg, "\n";
+ print $wdiff;
+ } else {
+ my @output;
+ @output = split /\n/, $wdiff;
+ @output = grep /(\[-|\{\+)/, @output;
+ my $msg = "The following lines in the control files differ
(wdiff output format):";
+ print $msg, "\n", '-' x length $msg, "\n";
+ print join("\n",@output), "\n";
+ }
+ } else {
+ warn "wdiff failed (exit status " . ($? >> 8) .
+ (($? & 0x7f) ? " with signal " . ($? & 0x7f) : "") . ")\n";
+ }
+ # Clean up
+ system ("rm", "-rf", $dir1, $dir2);
+}
###### Subroutines