Package: tardiff
Version: 0.1-5
Followup-For: Bug #873615

Amended patch with correct indentation.

-- System Information:
Debian Release: buster/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.12.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages tardiff depends on:
ii  libtext-diff-perl  1.44-1
ii  perl               5.26.0-5

tardiff recommends no packages.

tardiff suggests no packages.

-- no debconf information
>From b2bf0819142a1391020e43a8182bf0b483a70d99 Mon Sep 17 00:00:00 2001
From: Carlos Maddela <e7ap...@gmail.com>
Date: Tue, 29 Aug 2017 23:24:57 +1000
Subject: [PATCH] Handle tarballs with the same top-level directory.

---
 tardiff | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/tardiff b/tardiff
index 2577b8f..c23e683 100755
--- a/tardiff
+++ b/tardiff
@@ -67,6 +67,10 @@ sub arguments{
 
 sub untar{
        my $tarball = shift(@_);
+       my $prefix = shift(@_);
+
+       my $tardir = "$tempdir/$prefix";
+       mkdir $tardir or die "Couldn't create $tardir";
 
        my $flag = "";
        if($tarball =~ /\.gz$/){
@@ -75,7 +79,7 @@ sub untar{
                $flag = "-j";
        }
 
-       open(TARLIST, '-|', qw(tar -C), $tempdir, $flag, qw(-xvf), $tarball)
+       open(TARLIST, '-|', qw(tar -C), $tardir, $flag, qw(-xvf), $tarball)
            or die "Can't call tar as expected: $!";
        local $/ = undef; # slurp mode
        my $list = <TARLIST> or die "Couldn't read from tar";
@@ -174,8 +178,8 @@ sub autofile{
 sub tardiff{
        my $error = 0;
 
-       my $filelist1 = untar($tarball1) or die "Error: Could not unpack 
$tarball1.";
-       my $filelist2 = untar($tarball2) or die "Error: Could not unpack 
$tarball2.";
+       my $filelist1 = untar($tarball1, 1) or die "Error: Could not unpack 
$tarball1.";
+       my $filelist2 = untar($tarball2, 2) or die "Error: Could not unpack 
$tarball2.";
 
        my %files;
 
@@ -189,7 +193,7 @@ sub tardiff{
                        next if $opt_autoskip and autofile($file);
                        my $modified = 0;
                        if($opt_modified){
-                               $modified = comparefile($base1, $base2, $file);
+                               $modified = comparefile("1/$base1", "2/$base2", 
$file);
                                if($modified){
                                        if($opt_stats){
                                                print "/ $file $modified\n";
-- 
2.14.1

Reply via email to