212
212
if ($ARGV[0] =~ /\.deb$/) { $type = 'deb'; }
213
elsif ($ARGV[0] =~ /\.udeb$/) { $type = 'deb'; }
213
214
elsif ($ARGV[0] =~ /\.changes$/) { $type = 'changes'; }
214
215
elsif ($ARGV[0] =~ /\.dsc$/) { $type = 'dsc'; }
215
216
elsif (`file $ARGV[0]` =~ /Debian/) { $type = 'deb'; }
217
fatal "Could not recognise files; the names should end .deb, .changes or .dsc";
218
fatal "Could not recognise files; the names should end .deb, .udeb, .changes or .dsc";
219
220
if ($ARGV[1] !~ /\.$type$/) {
220
221
unless ($type eq 'deb' and `file $ARGV[0]` =~ /Debian/) {
221
fatal "The two filenames must have the same suffix, either .deb, .changes or .dsc";
222
fatal "The two filenames must have the same suffix, either .deb, .udeb, .changes or .dsc";
271
272
last if $infiles and /^[^ ]/;
272
273
/^Files:/ and $infiles=1, next;
273
274
next unless $infiles;
274
/ (\S*.deb)$/ and push @debs, $1;
275
/ (\S*.u?deb)$/ and push @debs, $1;
277
278
or fatal "Problem reading $changes: $!";
358
359
system("(interdiff --version) >/dev/null 2>&1");
359
360
my $use_interdiff = ($?==0) ? 1 : 0;
361
if ($origs[1] eq $origs[2] and $use_interdiff) {
362
if ($origs[1] eq $origs[2] and defined $diffs[1] and defined $diffs[2]
363
and $use_interdiff) {
362
364
# same orig tar ball and interdiff exists
363
if (defined $diffs[1] and defined $diffs[2]) {
364
my $rv = system('interdiff', '-z', $diffs[1], $diffs[2]);
366
fatal "interdiff -z $diffs[1] $diffs[2] failed!";
370
warn "Warning: no diffs and same tarball ($origs[1]),\nnot attempting to diff\n";
365
my $rv = system('interdiff', '-z', $diffs[1], $diffs[2]);
367
fatal "interdiff -z $diffs[1] $diffs[2] failed!";
373
if ($origs[1] eq $origs[2]) {
370
# Any other situation
371
if ($origs[1] eq $origs[2] and
372
defined $diffs[1] and defined $diffs[2]) {
374
373
warn "Warning: You do not seem to have interdiff (in the patchutils package)\ninstalled; this program would use it if it were available.\n";
376
# different orig tarball
375
# possibly different orig tarballs, or no interdiff installed
377
376
our ($sdir1, $sdir2);
379
378
for my $i (1,2) {
380
379
no strict 'refs';
381
my $cmd = qq(cd ${"dir$i"} && dpkg-source -x $dscs[$i]);
382
${"sdir$i"} = `$cmd`;
383
fatal qq(cd ${"dir$i"} && dpkg-source -x $dscs[$i] failed)
385
${"sdir$i"} =~ /([^\s]*)$/;
380
my $cmd = qq(cd ${"dir$i"} && dpkg-source -x $dscs[$i] >/dev/null);
382
fatal "$cmd failed" if $? != 0;
383
opendir DIR,${"dir$i"};
384
while ($_ = readdir(DIR)) {
385
next if $_ eq '.' || $_ eq '..' || ! -d ${"dir$i"}."/$_";
388
391
system ("diff", "-Nru", "$dir1/$sdir1", "$dir2/$sdir2");
532
535
exit 0 unless defined $singledeb[1] and defined $singledeb[2]
533
536
and $compare_control;
535
if (! -x "/usr/bin/wdiff") {
538
unless (system ("command -v wdiff >/dev/null 2>&1") == 0) {
536
539
warn "Can't compare control files; wdiff package not installed\n";