[devscripts] 01/01: uscan: Remove intermediate files when repacking

Joachim Breitner nomeata at moszumanska.debian.org
Sat Mar 29 21:47:46 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 9e979ea261263242601873ff7280ffbb74a6689b
Author: Joachim Breitner <nomeata at debian.org>
Date:   Sat Mar 29 22:47:10 2014 +0100

    uscan: Remove intermediate files when repacking
    
    as suggested by Andreas Tille.
---
 scripts/uscan.pl |  3 +++
 test/test_uscan  | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index b0d0bfd..2ebc363 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -1505,6 +1505,7 @@ EOF
 	    uscan_die("Repacking from zip or jar to tar.$suffix failed (could not create tarball)\n");
 	}
 	compress_archive("$absdestdir/$compress_file_base", "$absdestdir/$newfile_base_compression", $repack_compression);
+	unlink("$destdir/$newfile_base");
 	$newfile_base = $newfile_base_compression;
 
     } elsif ($repack) { # Repacking from tar to tar, so just change the compression
@@ -1641,6 +1642,8 @@ EOF
 	    symlink $newfile_base, "$destdir/$renamed_base";
 	} elsif ($symlink eq 'rename') {
 	    move "$destdir/$newfile_base", "$destdir/$renamed_base";
+	} elsif ($symlink eq 'files-excluded') {
+	    unlink("$destdir/$newfile_base");
 	}
 	if ($verbose) {
 	    print "-- Successfully downloaded updated package $newfile_base\n";
diff --git a/test/test_uscan b/test/test_uscan
index 52646c3..8e1f988 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -77,9 +77,13 @@ END
       python -m SimpleHTTPServer $PORT &
       echo $! > pid )
 
-    (cd $TMPDIR/$PKG ; $COMMAND --verbose --repack --repack-compression=$to_comp)
+    (cd $TMPDIR/$PKG ; $COMMAND --repack --repack-compression=$to_comp)
 
     TARBALL=${PKG}_1.orig.tar.$to_comp
+    if [ "$from_ext" != "tar.$to_comp" ]
+    then
+	assertFalse 'unrepacked tarball still present' "[ -f $TMPDIR/${PKG}_1.orig.$from_ext ]"
+    fi
     assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
     assertNotNull "pristine tarball is not $to_comp-compressed" \
                   "$( file -L $TMPDIR/$TARBALL | grep "$file_output" )"
@@ -126,13 +130,14 @@ END
     touch $TMPDIR/repo/foo/content
 
     ( cd $TMPDIR/repo ;
-      zip -r $PKG-1.zip * ;
+      zip -q -r $PKG-1.zip * ;
       python -m SimpleHTTPServer $PORT &
       echo $! > pid )
 
-    OUTPUT=$( (cd $TMPDIR/$PKG ; $COMMAND --verbose --repack --repack-compression=$to_comp) )
+    OUTPUT=$( (cd $TMPDIR/$PKG ; $COMMAND --repack --repack-compression=$to_comp) )
 
     TARBALL=${PKG}_1.orig.tar.$to_comp
+    assertFalse 'unrepacked zipfile still present' "[ -f $TMPDIR/${PKG}-1.zip ]"
     assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
     assertNotNull "pristine tarball is not $to_comp-compressed" \
                   "$( file -L $TMPDIR/$TARBALL | grep "$file_output" )"
@@ -223,6 +228,7 @@ testFileExclusion() {
     (cd $TMPDIR/$PKG ; $COMMAND)
 
     TARBALL=${PKG}_1+dfsg.orig.tar.gz
+    assertFalse 'unrepacked tarfile still present' "[ -f $TMPDIR/${PKG}-1.tar.gz ]"
     assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
     assertNotNull 'pristine tarball is not gzip-compressed' \
                   "$( file $TMPDIR/$TARBALL | grep 'gzip compressed data' )"
@@ -251,7 +257,7 @@ http://localhost:$PORT/$PKG-(\d).zip
 END
 
       cd repo
-      zip -r $PKG-1.zip * .hidden;
+      zip -q -r $PKG-1.zip * .hidden;
       python -m SimpleHTTPServer $PORT &
       echo $! > pid )
 
@@ -282,13 +288,15 @@ http://localhost:$PORT/$PKG-(\d).zip
 END
 
       cd repo
-      zip -r $PKG-1.zip * .hidden;
+      zip -q -r $PKG-1.zip * .hidden;
       python -m SimpleHTTPServer $PORT &
       echo $! > pid )
 
     OUTPUT=$( (cd $TMPDIR/$PKG ; $COMMAND --repack) 2>&1)
 
     TARBALL=${PKG}_1+dfsg.orig.tar.xz
+    assertFalse 'unrepacked zipfile still present' "[ -f $TMPDIR/${PKG}-1.zip ]"
+    assertFalse 'unrepacked tarfile still present' "[ -f $TMPDIR/${PKG}-1.tar.xz ]"
     assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
     assertNotNull 'pristine tarball is not xz-compressed' \
                   "$( file $TMPDIR/$TARBALL | grep 'XZ compressed data' )"

-- 
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