[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] dpkg-source: do not test source package for --before-build

It is perfectly reasonable to use the before_build and after_build
hooks before the complete source package is ready to be built.

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>
Goswin von Brederlow wrote:

> What version of dpkg-dev is that?

A merge of master and sid.  --before-build and --after-build are from
commit 8c1fc3 (2010-04-28), targetted at 1.15.8, I think.

No changelog entry needed, since the feature is not released yet:
we can pretend it always worked this way. :)

> I don't see why you need the orig.tar.gz for this though.

True.  Maybe something like this will do.

 scripts/dpkg-source.pl |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index a5e29af..b671884 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -322,10 +322,6 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
-    # 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") {
@@ -334,6 +330,10 @@ if ($options{'opmode'} =~ /^(-b|--print-format|--(before|after)-build)$/) {
+    # 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);

Reply to: