From: Raphael Hertzog Date: Wed, 26 Dec 2007 13:47:50 +0000 (+0100) Subject: dpkg-source: fix regression in the behaviour of options -sk -sK -sp -sP X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1cc494b6e8811fd4fc9fed2a7d458ae8849ccdd;p=dpkg 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 497ba7e7..5421f37f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-12-26 Raphael Hertzog + + * scripts/dpkg-source.pl: Provide a sane default $origtargz in all + cases when such a file exists. + 2007-12-20 Raphael Hertzog * scripts/dpkg-shlibdeps.pl: Always consider the shlibs of the diff --git a/debian/changelog b/debian/changelog index a67755fc..d962f664 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 020a0c4a..0640db4f 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 or , 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 or , 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. + } 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 } } }