~ubuntu-branches/ubuntu/quantal/devscripts/quantal

« back to all changes in this revision

Viewing changes to debdiff.pl

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess, Julian Gilbey, Joey Hess
  • Date: 2005-08-03 22:13:47 UTC
  • mfrom: (1.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050803221347-upghxiq0q15hnlrh
Tags: 2.9.4
[ Julian Gilbey ]
* bts: fix forwarded command (Closes: #320703)
* debchange: un-html-ise bug titles when using --closes

[ Joey Hess ]
* bts: Support new block and unblock commands.

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
    }
211
211
 
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'; }
216
217
    else {
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";
218
219
    }
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";
222
223
        }
223
224
    }
224
225
}
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
 
            }
 
275
                / (\S*.u?deb)$/ and push @debs, $1;
 
276
        }
276
277
            close CHANGES
277
278
                or fatal "Problem reading $changes: $!";
278
279
 
358
359
    system("(interdiff --version) >/dev/null 2>&1");
359
360
    my $use_interdiff = ($?==0) ? 1 : 0;
360
361
 
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]);
365
 
            if ($rv) {
366
 
                fatal "interdiff -z $diffs[1] $diffs[2] failed!";
367
 
            }
368
 
        }
369
 
        else {
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]);
 
366
        if ($rv) {
 
367
            fatal "interdiff -z $diffs[1] $diffs[2] failed!";
371
368
        }
372
369
    } else {
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";
375
374
        }
376
 
        # different orig tarball
 
375
        # possibly different orig tarballs, or no interdiff installed
377
376
        our ($sdir1, $sdir2);
378
377
        mktmpdirs();
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)
384
 
                if $? != 0;
385
 
            ${"sdir$i"} =~ /([^\s]*)$/;
386
 
            ${"sdir$i"} = $1;
 
380
            my $cmd = qq(cd ${"dir$i"} && dpkg-source -x $dscs[$i] >/dev/null);
 
381
            system $cmd;
 
382
            fatal "$cmd failed" if $? != 0;
 
383
            opendir DIR,${"dir$i"};
 
384
            while ($_ = readdir(DIR)) {
 
385
                    next if $_ eq '.' || $_ eq '..' || ! -d ${"dir$i"}."/$_";
 
386
                    ${"sdir$i"} = $_;
 
387
                    last;
 
388
            }
 
389
            closedir(DIR);
387
390
        }
388
391
        system ("diff", "-Nru", "$dir1/$sdir1", "$dir2/$sdir2");
389
392
    }
532
535
exit 0 unless defined $singledeb[1] and defined $singledeb[2]
533
536
    and $compare_control;
534
537
 
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";
537
540
    exit 0;
538
541
}