[SCM] Git repository for devscripts branch, master, updated. v2.11.7-11-gc11a9e0
James McCoy
jamessan at debian.org
Sun May 27 20:35:18 UTC 2012
The following commit has been merged in the master branch:
commit c11a9e080dcee012d517e1a069027d7c53dec6ec
Author: James McCoy <jamessan at debian.org>
Date: Sun May 27 16:32:14 2012 -0400
debcheckout: Determine the source package name when downloading the source tarball.
Signed-off-by: James McCoy <jamessan at debian.org>
diff --git a/debian/changelog b/debian/changelog
index 29e7dfa..79aaeaf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,9 @@ devscripts (2.11.8) UNRELEASED; urgency=low
#154868 is fixed.
* debcheckout:
+ Document the DEBCHECKOUT_SOURCE configuration variable.
+ + Determine the source package name when downloading the source tarball.
+ This ensures the downloaded files aren't incorrectly removed after being
+ downloaded.
-- David Prévot <taffit at debian.org> Sun, 06 May 2012 23:26:05 -0400
diff --git a/scripts/debcheckout.pl b/scripts/debcheckout.pl
index 5eac91a..2e3b091 100755
--- a/scripts/debcheckout.pl
+++ b/scripts/debcheckout.pl
@@ -810,6 +810,10 @@ sub unpack_source($$$$$) {
return 1 if (defined $origtgz_name and $origtgz_name eq ''); # only really relevant with URL on command line
$destdir ||= $pkg;
+ # Apt will auto-resolve binary package names to source package names. We
+ # need to know the source package name to correctly identify the source
+ # package artifacts (dsc, orig.tar.*, etc)
+ (my $srcpkg = $origtgz_name) =~ s/_.*//;
# is this a debian-dir-only repository?
unless (-d $destdir) {
print STDERR "debcheckout did not create the $destdir directory - this is probably a bug\n";
@@ -826,22 +830,23 @@ sub unpack_source($$$$$) {
print "repository only contains the debian directory, using apt-get source\n";
}
- use File::Temp;
my $tmpdir = File::Temp->newdir(DIR => ".");
# unpack
- my $cmd = "cd $tmpdir && apt-get source ";
- $cmd .= "--download-only " if ($unpack_source eq 'download-only' or not $debian_only);
- $cmd .= $pkg;
- $cmd .= "=$version" if ($version);
- system($cmd);
+ my $oldcwd = getcwd();
+ chdir $tmpdir;
+ my @args = ('source');
+ push @args, '--download-only' if ($unpack_source eq 'download-only' or not $debian_only);
+ push @args, $version ? "$srcpkg=$version" : $srcpkg;
+ system('apt-get', @args);
+ chdir $oldcwd;
if ($? >> 8) {
print STDERR "apt-get source failed\n";
return 0;
}
# put source package in place
- foreach my $sourcefile (glob "$tmpdir/${pkg}_*") {
+ foreach my $sourcefile (glob "$tmpdir/${srcpkg}_*") {
next unless (-f $sourcefile); # skip directories
my $base = $sourcefile;
$base =~ s!.*/!!;
@@ -851,9 +856,9 @@ sub unpack_source($$$$$) {
return 1 if ($unpack_source eq 'download-only' or not $debian_only);
# figure out which directory was created
- my @dirs = glob "$tmpdir/$pkg-*/";
+ my @dirs = glob "$tmpdir/$srcpkg-*/";
unless (@dirs) {
- print STDERR "apt-get source did not create any $tmpdir/$pkg-* directory\n";
+ print STDERR "apt-get source did not create any $tmpdir/$srcpkg-* directory\n";
return 0;
}
my $directory = $dirs[0];
--
Git repository for devscripts
More information about the devscripts-devel
mailing list