summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben@demerara.io>2021-11-17 20:38:38 +0000
committerBen Brown <ben@demerara.io>2021-11-17 20:38:38 +0000
commit8cf1ba0690a8731b2a966ad2d43726c331673745 (patch)
treec9bc2c2fb3eb5bccf3a40d7045a178e478b4ae66
parentbfff9d77b5da74f75a4530387b34ac9164d79029 (diff)
parente4ac7f14e653c8140007bf477a18e56f991b9770 (diff)
downloadlorry-8cf1ba0690a8731b2a966ad2d43726c331673745.tar.gz
Merge branch 'benbrown/global-pax-header' into 'master'
Ignore the global PAX header Closes #25 See merge request CodethinkLabs/lorry/lorry!22
-rwxr-xr-xlorry.tar-importer2
-rwxr-xr-xtests/global-pax-header-ignored.script32
-rwxr-xr-xtests/global-pax-header-ignored.setup40
-rw-r--r--tests/global-pax-header-ignored.stdout1
4 files changed, 75 insertions, 0 deletions
diff --git a/lorry.tar-importer b/lorry.tar-importer
index e25db99..10696bf 100755
--- a/lorry.tar-importer
+++ b/lorry.tar-importer
@@ -146,6 +146,8 @@ foreach my $tar_file (@ARGV)
}
print FI "\n";
+ next if ($typeflag eq 'g'); # ignore global header
+
my $path;
if ($prefix) {
$path = "$prefix/$name";
diff --git a/tests/global-pax-header-ignored.script b/tests/global-pax-header-ignored.script
new file mode 100755
index 0000000..31f0c52
--- /dev/null
+++ b/tests/global-pax-header-ignored.script
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# Tests ignoring of the global PAX header when converting tarballs.
+#
+# Copyright (C) 2021 Ben Brown
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+set -e
+
+logfile="${DATADIR}/tar-global-pax-header.log"
+workdir="${DATADIR}/work-dir"
+
+"${SRCDIR}/test-lorry" \
+ --pull-only \
+ --log="${logfile}" \
+ --working-area="${workdir}" \
+ "${DATADIR}/global-pax-header.lorry" >/dev/null
+
+git -C "${workdir}/global-pax-header/git-a" ls-tree --name-only -r HEAD
diff --git a/tests/global-pax-header-ignored.setup b/tests/global-pax-header-ignored.setup
new file mode 100755
index 0000000..cc7510c
--- /dev/null
+++ b/tests/global-pax-header-ignored.setup
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Creates tarballs constructed with a global PAX header.
+#
+# Copyright (C) 2021 Ben Brown
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+set -e
+
+dir="${DATADIR}/tar-global-pax-header"
+mkdir -p "${dir}"
+touch "${dir}"/test
+
+tar_path="${DATADIR}/global-pax-header.tar"
+tar --pax-option="globexthdr.name=pax_global_header" \
+ --pax-option="foo=bar" \
+ -C "${DATADIR}" -cf "${tar_path}" "$(basename "${dir}")"
+
+# create the .lorry file for the repository
+cat <<EOF > "${DATADIR}/global-pax-header.lorry"
+global-pax-header:
+ type: tarball
+ url: file://${tar_path}
+EOF
+
+# create the working directory
+mkdir -p "${DATADIR}/work-dir"
diff --git a/tests/global-pax-header-ignored.stdout b/tests/global-pax-header-ignored.stdout
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/global-pax-header-ignored.stdout
@@ -0,0 +1 @@
+test