[dpkg] 108/187: Dpkg: Add new Dpkg::PROGTAR variable to store GNU tar command name
Reiner Herrmann
reiner at reiner-h.de
Sun Nov 6 12:46:30 UTC 2016
This is an automated email from the git hooks/post-receive script.
deki-guest pushed a commit to branch master
in repository dpkg.
commit 062ee4500fc879735c5b453a8b9e7c6c3cd4be4a
Author: Guillem Jover <guillem at debian.org>
Date: Tue Jan 20 21:46:24 2015 +0100
Dpkg: Add new Dpkg::PROGTAR variable to store GNU tar command name
---
debian/changelog | 1 +
lib/dpkg/t/Makefile.am | 3 +++
lib/dpkg/t/t-tarextract.t | 6 ++++--
scripts/Dpkg.pm | 13 ++++++++++++-
scripts/Dpkg/Source/Archive.pm | 5 +++--
scripts/Makefile.am | 2 ++
6 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ca38fd5..f2ebbe6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -68,6 +68,7 @@ dpkg (1.18.11) UNRELEASED; urgency=medium
Dpkg::Build::Type::get_build_options_from_type().
- Change Dpkg::Compression::FileHandle to inherit directly from IO::File
instead of FileHandle.
+ - Add new Dpkg::PROGTAR variable to store GNU tar command name.
* Packaging:
- Add liblocale-gettext-perl to libdpkg-perl Recommends.
- Wrap and document dependency relationships.
diff --git a/lib/dpkg/t/Makefile.am b/lib/dpkg/t/Makefile.am
index 2bcc8f4..034f3f1 100644
--- a/lib/dpkg/t/Makefile.am
+++ b/lib/dpkg/t/Makefile.am
@@ -13,6 +13,9 @@ EXTRA_DIST = \
$(test_scripts) \
$(nil)
+TEST_ENV_VARS = \
+ DPKG_PROGTAR=$(TAR) \
+ $(nil)
# The tests are sorted in order of increasing complexity.
test_programs = \
diff --git a/lib/dpkg/t/t-tarextract.t b/lib/dpkg/t/t-tarextract.t
index 02f25b7..0f868c8 100755
--- a/lib/dpkg/t/t-tarextract.t
+++ b/lib/dpkg/t/t-tarextract.t
@@ -23,6 +23,7 @@ use File::Spec;
use File::Find;
use POSIX qw(mkfifo);
+use Dpkg ();
use Dpkg::IPC;
use strict;
@@ -34,7 +35,7 @@ my $builddir = $ENV{builddir} || '.';
my $tmpdir = 't.tmp/t-tarextract';
# We require GNU tar >= 1.27 for --owner=NAME:ID and --group=NAME:ID.
-my $tar_version = qx(tar --version 2>/dev/null);
+my $tar_version = qx($Dpkg::PROGTAR --version 2>/dev/null);
if ($tar_version and $tar_version =~ m/^tar \(GNU tar\) (\d+\.\d+)/ and
qv("v$1") >= qv('v1.27'))
{
@@ -140,7 +141,8 @@ TAR
chdir $cwd;
my $paths_list = join "\0", @paths;
- spawn(exec => [ 'tar', '-cf', "$dirtree.tar", '--format', $type,
+ spawn(exec => [ $Dpkg::PROGTAR, '-cf', "$dirtree.tar",
+ '--format', $type,
'-C', $dirtree, '--mtime=@100000000',
'--owner=user:100', '--group=group:200',
'--null', '--no-unquote', '--no-recursion', '-T-' ],
diff --git a/scripts/Dpkg.pm b/scripts/Dpkg.pm
index 89964b4..2eece99 100644
--- a/scripts/Dpkg.pm
+++ b/scripts/Dpkg.pm
@@ -29,10 +29,11 @@ this system installation.
use strict;
use warnings;
-our $VERSION = '1.01';
+our $VERSION = '1.02';
our @EXPORT_OK = qw(
$PROGNAME
$PROGVERSION
+ $PROGTAR
$CONFDIR
$ADMINDIR
$LIBDIR
@@ -60,6 +61,10 @@ Contains the name of the current program.
Contains the version of the dpkg suite.
+=item $Dpkg::PROGTAR
+
+Contains the name of the system GNU tar program.
+
=item $Dpkg::CONFDIR
Contains the path to the dpkg system configuration directory.
@@ -84,6 +89,8 @@ our ($PROGNAME) = $0 =~ m{(?:.*/)?([^/]*)};
# The following lines are automatically fixed at install time
our $PROGVERSION = '1.18.x';
+our $PROGTAR = $ENV{DPKG_PROGTAR} // 'tar';
+
our $CONFDIR = '/etc/dpkg';
our $ADMINDIR = '/var/lib/dpkg';
our $LIBDIR = '.';
@@ -99,6 +106,10 @@ our $pkgdatadir = $DATADIR;
=head1 CHANGES
+=head2 Version 1.02 (dpkg 1.18.11)
+
+New variable: $PROGTAR.
+
=head2 Version 1.01 (dpkg 1.17.0)
New variables: $PROGNAME, $PROGVERSION, $CONFDIR, $ADMINDIR, $LIBDIR and
diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm
index bb2a40d..ba377c0 100644
--- a/scripts/Dpkg/Source/Archive.pm
+++ b/scripts/Dpkg/Source/Archive.pm
@@ -26,6 +26,7 @@ use File::Basename qw(basename);
use File::Spec;
use Cwd;
+use Dpkg ();
use Dpkg::Gettext;
use Dpkg::ErrorHandling;
use Dpkg::IPC;
@@ -50,7 +51,7 @@ sub create {
my $mtime = $opts{source_date} // $ENV{SOURCE_DATE_EPOCH} // time;
# Call tar creation process
$spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
- $spawn_opts{exec} = [ 'tar', '-cf', '-', '--format=gnu', '--sort=name',
+ $spawn_opts{exec} = [ $Dpkg::PROGTAR, '-cf', '-', '--format=gnu', '--sort=name',
'--mtime', "\@$mtime", '--clamp-mtime', '--null',
'--numeric-owner', '--owner=0', '--group=0',
@{$opts{options}}, '-T', '-' ];
@@ -129,7 +130,7 @@ sub extract {
# Call tar extraction process
$spawn_opts{delete_env} = [ 'TAR_OPTIONS' ];
- $spawn_opts{exec} = [ 'tar', '-xf', '-', '--no-same-permissions',
+ $spawn_opts{exec} = [ $Dpkg::PROGTAR, '-xf', '-', '--no-same-permissions',
'--no-same-owner', @{$opts{options}} ];
spawn(%spawn_opts);
$self->close();
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index fd97ea0..264c16c 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -127,6 +127,7 @@ do_perl_subst = $(AM_V_GEN) sed \
-e "s:\$$ADMINDIR = .*;:\$$ADMINDIR = '$(admindir)';:" \
-e "s:\$$LIBDIR = .*;:\$$LIBDIR = '$(pkglibdir)';:" \
-e "s:\$$DATADIR = .*;:\$$DATADIR = '$(pkgdatadir)';:" \
+ -e "s:\$$PROGTAR = .*;:\$$PROGTAR = '$(TAR)';:" \
-e "s:\$$PROGVERSION = .*;:\$$PROGVERSION = '$(PACKAGE_VERSION)';:"
do_shell_subst = $(AM_V_GEN) sed \
@@ -187,6 +188,7 @@ coverage-clean:
rm -rf cover_db
TEST_ENV_VARS = \
+ DPKG_PROGTAR=$(TAR) \
DPKG_DATADIR=$(top_srcdir)/data \
DPKG_ORIGINS_DIR=$(srcdir)/t/origins
TEST_COVERAGE = $(PERL_COVERAGE)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list