[devscripts] 01/01: New option: uscan --copyright-file (passed to mk-origtargz)

Joachim Breitner nomeata at moszumanska.debian.org
Tue Jul 1 15:16:24 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 0226984a92a9ef6e4291f415946cb5d10fb54c1d
Author: Joachim Breitner <nomeata at debian.org>
Date:   Fri Jun 27 13:50:14 2014 -0700

    New option: uscan --copyright-file (passed to mk-origtargz)
---
 scripts/uscan.1  |  4 ++++
 scripts/uscan.pl |  9 ++++++++-
 test/test_uscan  | 34 ++++++++++++++++++++++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/scripts/uscan.1 b/scripts/uscan.1
index 97f832a..8a2e27a 100644
--- a/scripts/uscan.1
+++ b/scripts/uscan.1
@@ -410,6 +410,10 @@ In the case where the upstream sources are repacked (either because
 \fB\-\-repack\fR option is given or \fIdebian/copyright\fR contains the
 field \fBFiles-Excluded\fR), it is possible to control the compression
 method via the parameter (defaults to \fBgzip\fR).
+.TP
+.B \-\-copyright\-file \fIcopyright-file\fR
+Exclude files mentioned in \fBFiles-Excluded\fR in the given copyright file.
+This is useful when running uscan not within a source package directory.
 .RE
 .TP
 .B \-\-dehs
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 334040f..1953c3b 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -147,6 +147,8 @@ Options passed on to mk-origtargz:
     --compression [ gzip | bzip2 | lzma | xz ]
                    When the upstream sources are repacked, use compression COMP
                    for the resulting tarball (default: gzip)
+    --copyright-file FILE
+                   Remove files matching the patterns found in FILE
 
 Default settings modified by devscripts configuration files:
 $modified_conf_msg
@@ -178,6 +180,7 @@ my $report = 0; # report even on up-to-date packages?
 my $repack = 0; # repack .tar.bz2, .tar.lzma, .tar.xz or .zip to .tar.gz
 my $default_compression = 'gzip' ;
 my $repack_compression = $default_compression;
+my $copyright_file = undef;
 my $symlink = 'symlink';
 my $verbose = 0;
 my $check_dirname_level = 1;
@@ -278,7 +281,7 @@ if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
 my $debug = 0;
 my ($opt_h, $opt_v, $opt_destdir, $opt_download, $opt_force_download,
     $opt_report, $opt_passive, $opt_symlink, $opt_repack,
-    $opt_repack_compression, $opt_exclusion);
+    $opt_repack_compression, $opt_exclusion, $opt_copyright_file);
 my ($opt_verbose, $opt_level, $opt_regex, $opt_noconf);
 my ($opt_package, $opt_uversion, $opt_watchfile, $opt_dehs, $opt_timeout);
 my $opt_download_version;
@@ -312,6 +315,7 @@ GetOptions("help" => \$opt_h,
 	   "noconf" => \$opt_noconf,
 	   "no-conf" => \$opt_noconf,
 	   "exclusion!" => \$opt_exclusion,
+	   "copyright-file=s" => \$opt_copyright_file,
 	   "download-current-version" => \$opt_download_current_version,
 	   )
     or die "Usage: $progname [options] [directories]\nRun $progname --help for more details\n";
@@ -354,6 +358,7 @@ if (defined $opt_repack_compression) {
 }
 $dehs = $opt_dehs if defined $opt_dehs;
 $exclusion = $opt_exclusion if defined $opt_exclusion;
+$copyright_file = $opt_copyright_file if defined $opt_copyright_file;
 $user_agent_string = $opt_user_agent if defined $opt_user_agent;
 $download_version = $opt_download_version if defined $opt_download_version;
 
@@ -1475,6 +1480,8 @@ EOF
 	push @cmd, "--directory", $destdir;
 	push @cmd, "--copyright-file", "debian/copyright"
 	    if ($exclusion && -e "debian/copyright");
+	push @cmd, "--copyright-file", $copyright_file
+	    if ($exclusion && defined $copyright_file);
 	push @cmd, "$destdir/$newfile_base";
 
 	spawn(exec => \@cmd,
diff --git a/test/test_uscan b/test/test_uscan
index c7e8e73..e6c19a1 100755
--- a/test/test_uscan
+++ b/test/test_uscan
@@ -253,6 +253,40 @@ testFileExclusion() {
 
 }
 
+# the same, but run from a separate directory
+testFileExclusionSeparateDir() {
+
+    PKG=foo
+    PORT=8000
+    TMPDIR=$(mktemp -d)
+
+    (
+      cd $TMPDIR
+      helperCreateRepo
+      cd repo
+      tar cfz $PKG-1.tar.gz * .hidden
+      python -m SimpleHTTPServer $PORT &
+      echo $! > pid )
+
+    mkdir $TMPDIR/otherdir
+    (
+    	cd $TMPDIR/otherdir; $COMMAND --package $PKG --force-download --upstream-version 1 --watchfile ../$PKG/debian/watch --copyright-file ../$PKG/debian/copyright
+   )
+
+    TARBALL=${PKG}_1.orig.tar.gz
+    assertTrue 'downloaded tarfile not present' "[ -f $TMPDIR/${PKG}-1.tar.gz ]"
+    assertTrue 'pristine tarball is not created' "[ -f $TMPDIR/$TARBALL ]"
+    assertFalse 'pristine tarball is a symlink (nothing repacked?)' "[ -L $TMPDIR/$TARBALL ]"
+    assertNotNull 'pristine tarball is not gzip-compressed' \
+                  "$( file $TMPDIR/$TARBALL | grep 'gzip compressed data' )"
+    CONTENTS="$(tar atf $TMPDIR/$TARBALL)"
+
+    helperTestContent
+
+    cleanup
+
+}
+
 # The same, for a zip file that is being repacked
 
 testFileExclusionZipToTar() {

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