[devscripts] 01/01: mk-origtargz: Run tar taf on the final file
Joachim Breitner
nomeata at moszumanska.debian.org
Thu May 15 14:03:12 UTC 2014
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch master
in repository devscripts.
commit e171437911d3babe5ec7e20da11a2011c0c81142
Author: Joachim Breitner <nomeata at debian.org>
Date: Thu May 15 16:02:25 2014 +0200
mk-origtargz: Run tar taf on the final file
and abort uglily if that fails.
---
scripts/mk-origtargz.pl | 8 ++++++++
test/test_mk-origtargz | 18 +++++++++++++++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/scripts/mk-origtargz.pl b/scripts/mk-origtargz.pl
index 112ea93..fcf077c 100755
--- a/scripts/mk-origtargz.pl
+++ b/scripts/mk-origtargz.pl
@@ -458,6 +458,14 @@ unless ($same_name) {
}
}
+# Final check: Is the tarball usable
+
+# We are lazy and rely on Dpkg::IPC to report an error message (spawn does not report back the error code).
+# We don't expect this to occur often anyways.
+my $ret = spawn(exec => ['tar', '--list', '--auto-compress', '--file', $destfile ],
+ wait_child => 1,
+ to_file => '/dev/null');
+
# Tell the use what we did
my $upstream_nice = File::Spec->canonpath($upstream);
diff --git a/test/test_mk-origtargz b/test/test_mk-origtargz
index e4bdb5d..4238549 100755
--- a/test/test_mk-origtargz
+++ b/test/test_mk-origtargz
@@ -75,6 +75,10 @@ makeTarBall () {
tar --create --auto-compress --file "$TMPDIR/foo-0.1.tar.$comp" --directory "$TMPDIR" foo-0.1
rm -rf "$TMPDIR/foo-0.1"
}
+makeBrokenTarBall () {
+ echo foo > foo.txt
+ tar cf - foo.txt | tr 6 7 | gzip > "$TMPDIR/foo-0.1.tar.gz"
+}
makeZipFile () {
makeUpstreamFiles
@@ -151,7 +155,7 @@ run_mk_origtargz() {
shift
shift
shift
- output="$( cd $TMPDIR/$dir; $MK_ORIGTARGZ "$@" 2> $stderrF )"
+ output="$( cd $TMPDIR/$dir; LANG=C $MK_ORIGTARGZ "$@" 2> $stderrF )"
stderr="$(cat $stderrF)"
retval=$?
assertEquals "standard output of mk-origtargz $*\n" "$exp_stdout" "$output"
@@ -416,4 +420,16 @@ testCopyrightFormatWarning() {
}
+testBrokenTarWarning() {
+ makeBrokenTarBall
+ makeDebanDir
+ run_mk_origtargz foo \
+ "tar: This does not look like a tar archive
+tar: Skipping to next header
+tar: Exiting with failure status due to previous errors
+mk-origtargz.pl: error: tar --list --auto-compress --file ../foo_0.1.orig.tar.xz gave error exit status 2" \
+ "" \
+ ../foo-0.1.tar.gz --repack --compression xz
+}
+
. shunit2
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list