On Tue, 25 Dec 2007, Philipp Kern wrote:
> It seems to me that $origtargz is not set correctly, i.e. it's non-empty
> only on some special codepaths, whereas it was initialised on
> declaration before.
Indeed. I committed the patch attached. Feel free to try it and report if
there are any bad side-effects to this change.
Cheers,
--
Raphaël Hertzog
Le best-seller français mis à jour pour Debian Etch :
http://www.ouaza.com/livre/admin-debian/
commit e1cc494b6e8811fd4fc9fed2a7d458ae8849ccdd
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date: Wed Dec 26 14:47:50 2007 +0100
dpkg-source: fix regression in the behaviour of options -sk -sK -sp -sP
Those options need the name of a tarball in $origtargz but this variable
was only set if -sa or -sA was used (or if a tarball was explicitely
listed on the command line). $origtargz is now again set at declaration
time if we can find a corresponding tarball. Also add some comments to
make this part of the code somewhat more understandable.
diff --git a/ChangeLog b/ChangeLog
index 497ba7e..5421f37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-26 Raphael Hertzog <[EMAIL PROTECTED]>
+
+ * scripts/dpkg-source.pl: Provide a sane default $origtargz in all
+ cases when such a file exists.
+
2007-12-20 Raphael Hertzog <[EMAIL PROTECTED]>
* scripts/dpkg-shlibdeps.pl: Always consider the shlibs of the
diff --git a/debian/changelog b/debian/changelog
index a67755f..d962f66 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,7 @@ dpkg (1.14.13) UNRELEASED; urgency=low
sure that the generated dependency is at least as strict as this one.
* Fix dpkg-gensymbols to not update version info of a deprecated symbol.
Closes: #457739
+ * Fix dpkg-source's behaviour with options -sk -sK -sp -sP. Closes: #457784
[ Guillem Jover ]
* Ignore the man pages when building without NLS support. Closes: #457673
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 020a0c4..0640db4 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -416,7 +416,22 @@ if ($opmode eq 'build') {
my $origdir = "$dir.orig";
my $origtargz;
+ # Try to find a .orig tarball for the package
+ my @origtargz = map { "$basename.orig.tar.$comp_ext{$_}" } ($compression,
@comp_supported);
+ foreach my $origtar (@origtargz) {
+ if (stat($origtar)) {
+ -f _ || error(_g("packed orig `%s' exists but is not a plain file"),
+ $origtar);
+ $origtargz = $origtar;
+ last;
+ } elsif ($! != ENOENT) {
+ syserr(_g("unable to stat putative packed orig `%s'"), $origtar);
+ }
+ }
+
if (@ARGV) {
+ # We have a second-argument <orig-dir> or <orig-targz>, check what it
+ # is to decide the mode to use
my $origarg = shift(@ARGV);
if (length($origarg)) {
stat($origarg) ||
@@ -447,27 +462,20 @@ if ($opmode eq 'build') {
$sourcestyle);
}
} elsif ($sourcestyle =~ m/[aA]/) {
- my @origtargz = map { "$basename.orig.tar.$comp_ext{$_}" }
($compression, @comp_supported);
- foreach my $origtar (@origtargz) {
- if (stat($origtar)) {
- -f _ || error(_g("packed orig `%s' exists but is not a plain
file"),
- $origtar);
- $sourcestyle =~ y/aA/pP/;
- $origtargz = $origtar;
- last;
- } elsif ($! != ENOENT) {
- syserr(_g("unable to stat putative packed orig `%s'"),
$origtar);
- }
- }
- if (!$origtargz) {
+ # We have no explicit <orig-dir> or <orig-targz>, try to use
+ # a .orig tarball first, then a .orig directory and fall back to
+ # creating a native .tar.gz
+ if ($origtargz) {
+ $sourcestyle =~ y/aA/pP/; # .orig.tar.<ext>
+ } else {
if (stat($origdir)) {
-d _ || error(_g("unpacked orig `%s' exists but is not a
directory"),
$origdir);
- $sourcestyle =~ y/aA/rR/;
+ $sourcestyle =~ y/aA/rR/; # .orig directory
} elsif ($! != ENOENT) {
syserr(_g("unable to stat putative unpacked orig `%s'"),
$origdir);
} else {
- $sourcestyle =~ y/aA/nn/;
+ $sourcestyle =~ y/aA/nn/; # Native tar.gz
}
}
}