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

Re: Bug#545081: dpkg-dev: dpkg-buildpackage -B should UNCONDITIONALLY invoke debian/rules build-arch



On Sat, Sep 05, 2009 at 01:52:12PM +0200, Raphael Hertzog wrote:
> On Fri, 04 Sep 2009, Zack Weinberg wrote:
>
> You did not look well enough:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229357#304
> 
> This is in 2008. It has been stalled because I tried to embrace other
> bugs while introducing this new field and there was no consensus for this
> apparently. I shall retry with more limited goals but that's it. If you
> want to help here, it's not by discussing things further but by having the
> right branch ready to merge.

Good, good, progress at last. Please find a patch that is a port of the
old patch.3.0 in the first post of #229357 and implement
Build-Options: build-arch as specified therein.

If you would like a git branch, please tell me where to upload it.

Cheers,
-- 
Bill. <ballombe@debian.org>

Imagine a large red swirl here. 
From 17856254f794390216f41851f6a98803594cc9ea Mon Sep 17 00:00:00 2001
From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Date: Sun, 6 Sep 2009 13:18:50 +0200
Subject: [PATCH] Add support for Build-Options: build-arch. Closes: #229357

---
 debian/changelog             |    3 ++-
 scripts/Dpkg/Fields.pm       |    2 +-
 scripts/dpkg-buildpackage.pl |   12 +++++++++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 85a5727..a2a7329 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 dpkg (1.15.5) UNRELEASED; urgency=low
 
-  *
+   [ Bill Allombert]
+   * Add support for Build-Options: build-arch. Closes: #229357
 
  -- Guillem Jover <guillem@debian.org>  Sun, 06 Sep 2009 09:48:45 +0200
 
diff --git a/scripts/Dpkg/Fields.pm b/scripts/Dpkg/Fields.pm
index c6a37fb..c16289d 100644
--- a/scripts/Dpkg/Fields.pm
+++ b/scripts/Dpkg/Fields.pm
@@ -16,7 +16,7 @@ our %EXPORT_TAGS = ('list' => [qw(%control_src_fields %control_pkg_fields
 # Some variables (list of fields)
 our %control_src_fields;
 our %control_pkg_fields;
-$control_src_fields{$_} = 1 foreach (qw(Bugs Dm-Upload-Allowed
+$control_src_fields{$_} = 1 foreach (qw(Bugs Dm-Upload-Allowed Build-Options
     Homepage Origin Maintainer Priority Section Source Standards-Version
     Uploaders Vcs-Browser Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg
     Vcs-Mtn Vcs-Svn));
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index bdab775..651d671 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -8,6 +8,7 @@ use File::Basename;
 use POSIX;
 
 use Dpkg;
+use Dpkg::Control;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::BuildOptions;
@@ -79,6 +80,11 @@ Options:
       --version  show the version.
 "), $progname;
 }
+my $controlfile = "debian/control";
+my $control = Dpkg::Control->new($controlfile);
+my $src_fields = $control->get_source();
+my @buildoptions= split(/\s*,\s*/m, $src_fields->{'Build-Options'});
+my %buildoptions= map { $_ => 1 } @buildoptions;
 
 my @debian_rules = ("debian/rules");
 my @rootcommand = ();
@@ -101,6 +107,7 @@ my $signsource = 1;
 my $signchanges = 1;
 my $diffignore = '';
 my $binarytarget = 'binary';
+my $buildtarget  = 'build';
 my $targetarch = my $targetgnusystem = '';
 my $call_target = '';
 my $call_target_as_root = 0;
@@ -202,6 +209,9 @@ if ($noclean) {
     $binaryonly = '-b' unless ($binaryonly or $sourceonly);
 }
 
+$buildtarget='build-arch' if ( $binarytarget == 'binary-arch' && 
+                               defined($buildoptions{'build-arch'}));
+
 if ($< == 0) {
     warning(_g("using a gain-root-command while being root")) if (@rootcommand);
 } else {
@@ -382,7 +392,7 @@ unless ($binaryonly) {
     chdir($dir) or syserr("chdir $dir");
 }
 unless ($sourceonly) {
-    withecho(@debian_rules, 'build');
+    withecho(@debian_rules, $buildtarget);
     withecho(@rootcommand, @debian_rules, $binarytarget);
 }
 if ($usepause &&
-- 
1.6.3.3

Attachment: signature.asc
Description: Digital signature


Reply to: