Browse Source

dpkg-source: do not ensure prerequisites are met for --before-build/--after-build

It is perfectly reasonable to use the before_build and after_build
hooks in situations where the source package is missing.

Without this change, attempts to build a package of format 3.0 (quilt)
with the upstream tarball missing result in errors.

 $ dpkg-buildpackage -b
 [...]
  dpkg-source -I -i --before-build csound
 dpkg-buildpackage: host architecture i386
 dpkg-source: error: can't build with source format '3.0 (quilt)': no orig.tar file found

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Jonathan Nieder 16 years ago
parent
commit
5e9ddfc441
1 changed files with 5 additions and 7 deletions
  1. 5 7
      scripts/dpkg-source.pl

+ 5 - 7
scripts/dpkg-source.pl

@@ -320,13 +320,7 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
     if ($options{'opmode'} eq "--print-format") {
 	print $fields->{'Format'} . "\n";
 	exit(0);
-    }
-
-    # Verify pre-requesites are met
-    my ($res, $msg) = $srcpkg->can_build($dir);
-    error(_g("can't build with source format '%s': %s"), $build_format, $msg) unless $res;
-
-    if ($options{'opmode'} eq "--before-build") {
+    } elsif ($options{'opmode'} eq "--before-build") {
 	$srcpkg->before_build($dir);
 	exit(0);
     } elsif ($options{'opmode'} eq "--after-build") {
@@ -334,6 +328,10 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
 	exit(0);
     }
 
+    # Verify pre-requisites are met
+    my ($res, $msg) = $srcpkg->can_build($dir);
+    error(_g("can't build with source format '%s': %s"), $build_format, $msg) unless $res;
+
     # Only -b left
     info(_g("using source format `%s'"), $fields->{'Format'});
     run_vendor_hook("before-source-build", $srcpkg);