From b2758dccf01c9d46d3083accab97f48c7978b5b0 Mon Sep 17 00:00:00 2001 From: Torsten Maehne Date: Mon, 30 Jul 2012 19:00:31 +0200 Subject: [PATCH] Factorize external program names into variables The external programs (tar, xdelta) called by the pristine-tar script have been hardcoded until now. This requires that both program names are the first in the user's PATH, which can lead to problems, especially on non-GNU/Linux platforms: * Pristine-tar uses options (e.g., "--owner"), which are only present in GNU tar. * Pristine-tar uses the old 1.1 release series Xdelta, which is syntactically incompatible to the 3.0 release series of Xdelta. This commit centralizes the definition of the program names of tar and xdelta so that their exact names (or locations) can be easily configured. Signed-off-by: Philipp A. Hartmann --- pristine-tar | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pristine-tar b/pristine-tar index c75e4fc..c670d2d 100755 --- a/pristine-tar +++ b/pristine-tar @@ -189,6 +189,9 @@ $ENV{LANG}='C'; delete $ENV{TAR_OPTIONS}; delete $ENV{TAPE}; +my $tar_program = "tar"; +my $xdelta_program = "xdelta"; + my $message; dispatch( @@ -345,7 +348,7 @@ sub recreatetarball_helper { my $ret="$tempdir/recreatetarball"; - doit("tar", "cf", $ret, "--owner", 0, "--group", 0, + doit($tar_program, "cf", $ret, "--owner", 0, "--group", 0, "--numeric-owner", "-C", "$tempdir/workdir", "--no-recursion", "--mode", "0644", "--files-from", "$tempdir/manifest"); @@ -391,7 +394,7 @@ sub gentar { my $ok; foreach my $variant (@try) { my $recreatetarball=$variant->(); - my $ret=try_doit("xdelta", "patch", $delta->{delta}, $recreatetarball, $out); + my $ret=try_doit($xdelta_program, "patch", $delta->{delta}, $recreatetarball, $out); if ($ret == 0) { $ok=1; last; @@ -489,7 +492,7 @@ sub gendelta { if (! exists $opts{recreatetarball}) { my $sourcedir="$tempdir/tmp"; doit("mkdir", $sourcedir); - doit("tar", "xf", File::Spec->rel2abs($tarball), "-C", $sourcedir); + doit($tar_program, "xf", File::Spec->rel2abs($tarball), "-C", $sourcedir); # if all files were in a subdir, use the subdir as the sourcedir my @out=grep { $_ ne "$sourcedir/.." && $_ ne "$sourcedir/." } (glob("$sourcedir/*"), glob("$sourcedir/.*")); @@ -503,7 +506,7 @@ sub gendelta { } $delta{delta}="$tempdir/delta"; - my $ret=system("xdelta delta -0 --pristine $recreatetarball $tarball $delta{delta}") >> 8; + my $ret=system("$xdelta_program delta -0 --pristine $recreatetarball $tarball $delta{delta}") >> 8; # xdelta exits 1 on success if there were differences if ($ret != 1 && $ret != 0) { error "xdelta failed with return code $ret"; -- 2.34.1