[SCM] Git repository for devscripts branch, master, updated. v2.12.0-40-g46ea57e
Christoph Berg
myon at debian.org
Fri Aug 17 06:59:12 UTC 2012
The following commit has been merged in the master branch:
commit 46ea57ebd44bbb63fe73dd6ab7963d3ada2072e6
Author: Christoph Berg <myon at debian.org>
Date: Fri Aug 17 08:57:27 2012 +0200
origtargz: Add --dir option.
diff --git a/scripts/origtargz.pl b/scripts/origtargz.pl
index 6e9c4ef..d8725a9 100755
--- a/scripts/origtargz.pl
+++ b/scripts/origtargz.pl
@@ -39,9 +39,19 @@ determined from F<debian/changelog>. The main use for B<origtargz> is with
debian-dir-only repository checkouts. It should be invoked from the top level
directory of an unpacked Debian source package.
-Various download locations are tried. First, an existing file is looked for.
-Then, B<apt-get source> is tried when B<apt-cache showsrc> reports a matching
-version. Finally, B<uscan --download-current-version> is tried.
+Various download locations are tried:
+
+=over 4
+
+=item * First, an existing file is looked for.
+
+=item * Directories given with B<--dir> are searched.
+
+=item * B<apt-get source> is tried when B<apt-cache showsrc> reports a matching version.
+
+=item * Finally, B<uscan --download-current-version> is tried.
+
+=back
When asked to unpack the orig tarball, B<origtargz> will remove all files and
directories from the current directory, except the debian directory, and the
@@ -74,6 +84,11 @@ useful for downloading the current tarball.
=over
+=item B<--dir> I<directory>
+
+Add I<directory> to the list of locations to search for an existing tarball.
+When found, a hardlink is created if possible, otherwise a symlink.
+
=item B<-u>, B<--unpack>[=B<no>|B<once>|B<yes>]
Unpack the downloaded orig tarball to the current directory, replacing
@@ -140,10 +155,12 @@ use File::Temp qw/tempdir/;
use Getopt::Long qw(:config gnu_getopt);
use Pod::Usage;
+my @dirs = ();
my $tar_only = 0;
my $unpack = 'once'; # default when --unpack is not used
GetOptions(
+ "dir=s" => \@dirs,
"download-only|d" => sub { $unpack = 'no' },
"help|h" => sub { pod2usage({-exitval => 0, -verbose => 1}); },
"tar-only" => \$tar_only,
@@ -182,7 +199,21 @@ sub download_origtar ()
return $f[0];
}
- # TODO: try other well-known file locations (../upstream/ ?) and move file in place
+ # try other directories
+
+ foreach my $dir (@dirs) {
+ $dir =~ s!/$!!;
+
+ if (my @f = glob "$dir/${package}_$fileversion.orig.tar.*") {
+ print "Using $f[0]\n";
+ my $basename = $f[0];
+ $basename =~ s!.*/!!;
+ link $f[0], "../$basename" or
+ symlink $f[0], "../$basename" or
+ die "symlink: $!";
+ return $f[0];
+ }
+ }
# TODO: try pristine-tar
--
Git repository for devscripts
More information about the devscripts-devel
mailing list