Просмотр исходного кода

libdpkg: Skip tar extractor tests if tar is not GNU tar >= 1.27

This allows building on older systems.
Guillem Jover лет назад: 11
Родитель
Сommit
2a7390d110
2 измененных файлов с 13 добавлено и 1 удалено
  1. 1 0
      debian/changelog
  2. 12 1
      lib/dpkg/test/t-tar.t

+ 1 - 0
debian/changelog

@@ -2,6 +2,7 @@ dpkg (1.17.23) UNRELEASED; urgency=low
 
 
   [ Guillem Jover ]
   [ Guillem Jover ]
   * Use a matching group instead of ${^MATCH} in s/// in dselect build script.
   * Use a matching group instead of ${^MATCH} in s/// in dselect build script.
+  * Skip tar extractor tests if tar is not GNU tar >= 1.27.
 
 
   [ Updated programs translations ]
   [ Updated programs translations ]
   * Basque (Iñaki Larrañaga Murgoitio). Closes: #771893
   * Basque (Iñaki Larrañaga Murgoitio). Closes: #771893

+ 12 - 1
lib/dpkg/test/t-tar.t

@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 
-use Test::More tests => 12;
+use Test::More;
 use Cwd;
 use Cwd;
 use File::Path qw(make_path remove_tree);
 use File::Path qw(make_path remove_tree);
 use File::Temp qw(tempdir);
 use File::Temp qw(tempdir);
@@ -27,11 +27,22 @@ use Dpkg::IPC;
 
 
 use strict;
 use strict;
 use warnings;
 use warnings;
+use version;
 
 
 my $srcdir = $ENV{srcdir} || '.';
 my $srcdir = $ENV{srcdir} || '.';
 my $builddir = $ENV{builddir} || '.';
 my $builddir = $ENV{builddir} || '.';
 my $tmpdir = 't.tmp/t-tar';
 my $tmpdir = 't.tmp/t-tar';
 
 
+# We require GNU tar >= 1.27 for --owner=NAME:ID and --group=NAME:ID.
+my $tar_version = qx(tar --version 2>/dev/null);
+if ($tar_version and $tar_version =~ m/^tar \(GNU tar\) (\d+\.\d+)/ and
+    qv("v$1") >= qv('v1.27'))
+{
+    plan tests => 12;
+} else {
+    plan skip_all => 'needs GNU tar >= 1.27';
+}
+
 # Set a known umask.
 # Set a known umask.
 umask 0022;
 umask 0022;