Просмотр исходного кода

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.
Raphael Hertzog лет назад: 18
Родитель
Сommit
e1cc494b6e
3 измененных файлов с 29 добавлено и 15 удалено
  1. 5 0
      ChangeLog
  2. 1 0
      debian/changelog
  3. 23 15
      scripts/dpkg-source.pl

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2007-12-26  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-source.pl: Provide a sane default $origtargz in all
+	cases when such a file exists.
+
 2007-12-20  Raphael Hertzog  <hertzog@debian.org>
 
 	* scripts/dpkg-shlibdeps.pl: Always consider the shlibs of the

+ 1 - 0
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

+ 23 - 15
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
 	    }
 	}
     }