Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2011-06-06 Thread Raphael Hertzog
On Sun, 05 Jun 2011, Bill Allombert wrote:
 Please find a new patch that use the name Build-Features and the module name 
 Dpkg::BuildFeatures.

Thanks, here's a short review with a few details to clean.

1/ You're not consistent with the coding style (see doc/coding-style.txt).
2/ Why are you not calling build-indep for dpkg-buildpackage -A? AFAIU it
should be exactly like the binary target:
  With flag   | Without flag
-b = build   | build
-B = build-arch  | build
-A = build-indep | build
-F = build   | build
3/ You should document the new field in po/deb-src-control.5

 --- a/man/dpkg-buildpackage.1
 +++ b/man/dpkg-buildpackage.1

The doc needs to be updated as per 2/ above.

 --- /dev/null
 +++ b/scripts/Dpkg/BuildFeatures.pm
 +package Dpkg::BuildFeatures;
 +
 +use strict;
 +use warnings;
 +
 +our $VERSION = 1.00;

Please use version 0.01. I don't want this module to be part of the
stable API yet.

 +The Dpkg::BuildFeatures object can be used to query the options
 +stored in the Build-Features control field

Missing dot at the end.

 +=head1 FUNCTIONS
 +
 +=over 4
 +
 +=item my $bo = Dpkg::BuildFeatures-new($controlfile)

s/bo/bf/

 +if (defined($src_fields-{'Build-Features'}))
 +{
 +  my @buildfeats= split(/\s*,\s*/m, $src_fields-{'Build-Features'});

missing space before =

 +  %buildfeats = map { $_ = 1 } @buildfeats;
 +} else
 +{ 
 +  %buildfeats=();
 +}

bad indentation and curly braces on the wrong lines

 +my $self = { options = \%buildfeats }; 
 +bless $self, $class;
 +return $self;
 +}
 +=item $bo-has($option)

Missing empty line before the POD doc.

s/bo/bp/

 diff --git a/scripts/Makefile.am b/scripts/Makefile.am
 index 9b4d394..be376c9 100644
 --- a/scripts/Makefile.am
 +++ b/scripts/Makefile.am
 @@ -56,6 +56,7 @@ nobase_dist_perllib_DATA = \
   Dpkg/Arch.pm \
   Dpkg/BuildFlags.pm \
   Dpkg/BuildOptions.pm \
 + Dpkg/BuildFeatures.pm \
   Dpkg/Changelog.pm \
   Dpkg/Changelog/Debian.pm \
   Dpkg/Changelog/Entry.pm \

You also want to add it to scripts/po/POTFILES.in in case we add
translatable strings in the future.

 diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
 index aaea544..17294cb 100755
 --- a/scripts/dpkg-buildpackage.pl
 +++ b/scripts/dpkg-buildpackage.pl
 @@ -27,6 +27,7 @@ use Dpkg::Gettext;
  use Dpkg::ErrorHandling;
  use Dpkg::BuildFlags;
  use Dpkg::BuildOptions;
 +use Dpkg::BuildFeatures;
  use Dpkg::Compression;
  use Dpkg::Version;
  use Dpkg::Changelog::Parse;
 @@ -100,6 +101,8 @@ Options:
--version  show the version.
  ), $progname;
  }
 +my $controlfile = debian/control;
 +my $buildfeats   = Dpkg::BuildFeatures-new($controlfile);

Do not use a useless intermediary variable. In fact, do not give a value
at all and fix the object's new method to assume debian/control if no
explicit value has been given.

  my @debian_rules = (debian/rules);
  my @rootcommand = ();
 @@ -119,6 +122,7 @@ my $checkbuilddep = 1;
  my $signsource = 1;
  my $signchanges = 1;
  my $binarytarget = 'binary';
 +my $buildtarget  = 'build';

Don't align the value when nothing else is aligned.

  my $targetarch = my $targetgnusystem = '';
  my $call_target = '';
  my $call_target_as_root = 0;
 @@ -247,6 +251,9 @@ if ($noclean) {
  $include = BUILD_BINARY if ($include  BUILD_DEFAULT);
  }
  
 +$buildtarget='build-arch' if ( $binarytarget eq 'binary-arch' 
 +   $buildfeats-has('build-arch'));

Define buildtarget to build-indep/build-arch while parsing the options
but reset it to build here if the flag is missing:
$buildtarget = build unless $buildfeats-has('build-arch');

Thank you for your work on this patch!

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
  ▶ http://RaphaelHertzog.fr (Français)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2011-06-06 Thread Bill Allombert
On Mon, Jun 06, 2011 at 08:17:11AM +0200, Raphael Hertzog wrote:
 On Sun, 05 Jun 2011, Bill Allombert wrote:
  Please find a new patch that use the name Build-Features and the module 
  name 
  Dpkg::BuildFeatures.
 
 Thanks, here's a short review with a few details to clean.
 
 1/ You're not consistent with the coding style (see doc/coding-style.txt).
 2/ Why are you not calling build-indep for dpkg-buildpackage -A? AFAIU it
 should be exactly like the binary target:
   With flag   | Without flag
 -b = build   | build
 -B = build-arch  | build
 -A = build-indep | build
 -F = build   | build

When this patch was written, -A did not exist, and only -B was considered by 
the policy
proposal since autobuilder always use -B.

 3/ You should document the new field in po/deb-src-control.5

I did a grep 'Build-Depends' to find the relevant files but this one
did not show up. Thanks.

Please find a new patch.

Cheers,
-- 
Bill. ballo...@debian.org

Imagine a large red swirl here. 
From 30d3bf2c1433f26ee1a7288bf0247cde063a0d68 Mon Sep 17 00:00:00 2001
From: Bill Allombert bill.allomb...@math.u-bordeaux.fr
Date: Sun, 6 Sep 2009 13:18:50 +0200
Subject: [PATCH] Add support for Build-Features: build-arch.

New module BuildFeatures
Closes #229357
---
 debian/changelog   |4 ++
 man/deb-src-control.5  |6 +++
 man/dpkg-buildpackage.1|   13 --
 scripts/Dpkg/BuildFeatures.pm  |   86 
 scripts/Dpkg/Control/Fields.pm |3 +
 scripts/Makefile.am|1 +
 scripts/dpkg-buildpackage.pl   |   10 -
 scripts/po/POTFILES.in |1 +
 8 files changed, 118 insertions(+), 6 deletions(-)
 create mode 100644 scripts/Dpkg/BuildFeatures.pm

diff --git a/debian/changelog b/debian/changelog
index afc2283..5f55e8a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -85,6 +85,10 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not warn on missing architecture on packages in config-files state,
 but then make sure the architecture field is usable. Closes: #604241
 
+  [ Bill Allombert]
+  * Add support for Build-Features: build-arch. Closes: #229357
+- New module Dpkg::BuildFeatures.
+
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
 
diff --git a/man/deb-src-control.5 b/man/deb-src-control.5
index 0c5ee67..5b5e816 100644
--- a/man/deb-src-control.5
+++ b/man/deb-src-control.5
@@ -106,6 +106,12 @@ A list of these values can be obtained from the latest version of the
 package.
 
 .TP
+.BR Build\-Features:  features list
+A list of names of build-time features that are supported by \fBdebian/rules\fP.
+They affects \fBdpkg-buildpackage\fP behavior.  Currently the only supported
+feature is \fBbuild-arch\fP.
+
+.TP
 .BR Build\-Depends:  package list
 A list of packages that need to be installed and configured to be able to build
 the source package.
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 6460e51..f303806 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -27,12 +27,15 @@ It calls \fBdpkg-source \-b\fP to generate the source package (unless
 a binary\-only build has been requested with \fB\-b\fP, \fB\-B\fP or
 \fB\-A\fP).
 .IP \fB5.\fP 3
-It calls \fBdebian/rules\fP \fBbuild\fP followed by
+It calls \fBdebian/rules\fP \fIbuild-target\fP followed by
 \fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
-build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
-either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
-or \fBbinary-arch\fP (if \fB\-B\fP is specified) or \fBbinary-indep\fP
-(if \fB\-A\fP is specified).
+build has been requested with \fB\-S\fP). Note that \fIbuild-target\fP
+is \fBbuild\fP unless the the control file defines the build-feature \fBbuild-arch\fP,
+in which case it is either \fBbuild\fP (default case) or \fBbuild-arch\fP (if
+\fB\-B\fP is specified) or \fBbuild-indep\fP (if \fB\-A\fP is specified) and
+that \fIbinary-target\fR is either \fBbinary\fP (default case, or if \fB\-b\fP
+is specified) or \fBbinary-arch\fP (if \fB\-B\fP is specified) or
+\fBbinary-indep\fP (if \fB\-A\fP is specified).
 .IP \fB6.\fP 3
 It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
 \fB\-us\fP is specified).
diff --git a/scripts/Dpkg/BuildFeatures.pm b/scripts/Dpkg/BuildFeatures.pm
new file mode 100644
index 000..2ce1f8c
--- /dev/null
+++ b/scripts/Dpkg/BuildFeatures.pm
@@ -0,0 +1,86 @@
+# Copyright © 2007 Frank Lichtenheld dj...@debian.org
+# Copyright © 2010 Raphaël Hertzog hert...@debian.org
+# Copyright © 2010 Bill Allombertballo...@debian.org
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT 

Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2011-06-06 Thread Raphael Hertzog
Hi,

On Mon, 06 Jun 2011, Bill Allombert wrote:
 Please find a new patch.

Did some small changes and merged it. Thanks!

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
  ▶ http://RaphaelHertzog.fr (Français)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2011-06-05 Thread Bill Allombert
On Thu, Nov 25, 2010 at 02:19:35PM +0100, Raphael Hertzog wrote:
 Great... but dpkg-buildpackage will not impose them. If you want
 to help, please implement support of the Build-Features: build-arch
 field that will tell dpkg-buildpackage that it can rely on
 build-arch/indep.
 
 The closest patch was the one of Bill Allombert in
 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229357#429
 
 The only thing that changed since my last
 comments in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229357#401
 is that I will accept a comma-separated field. But I won't merge
 anything without documentation and with a name that leads to confusion.

You did not put me in CC so I only find out about this now.  You should have
proposed the name Build-Features in the matching debian-policy bug report
#218893.
  
Please find a new patch that use the name Build-Features and the module name 
Dpkg::BuildFeatures.

It also adds the documentation to dpkg-buildpackage.1. The documentation for
Debian policy is in #218893 already.

Cheers,
-- 
Bill. ballo...@debian.org

Imagine a large red swirl here. 
From 9ff63218f2642257254c3a40a2dd4397b74f800b Mon Sep 17 00:00:00 2001
From: Bill Allombert bill.allomb...@math.u-bordeaux.fr
Date: Sun, 6 Sep 2009 13:18:50 +0200
Subject: [PATCH] Add support for Build-Features: build-arch.

New module BuildFeatures
Closes #229357
---
 debian/changelog   |4 ++
 man/dpkg-buildpackage.1|   12 +++--
 scripts/Dpkg/BuildFeatures.pm  |   86 
 scripts/Dpkg/Control/Fields.pm |3 +
 scripts/Makefile.am|1 +
 scripts/dpkg-buildpackage.pl   |9 -
 6 files changed, 109 insertions(+), 6 deletions(-)
 create mode 100644 scripts/Dpkg/BuildFeatures.pm

diff --git a/debian/changelog b/debian/changelog
index afc2283..5f55e8a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -85,6 +85,10 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Do not warn on missing architecture on packages in config-files state,
 but then make sure the architecture field is usable. Closes: #604241
 
+  [ Bill Allombert]
+  * Add support for Build-Features: build-arch. Closes: #229357
+- New module Dpkg::BuildFeatures.
+
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312
 
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index 6460e51..6e30736 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -27,12 +27,14 @@ It calls \fBdpkg-source \-b\fP to generate the source package (unless
 a binary\-only build has been requested with \fB\-b\fP, \fB\-B\fP or
 \fB\-A\fP).
 .IP \fB5.\fP 3
-It calls \fBdebian/rules\fP \fBbuild\fP followed by
+It calls \fBdebian/rules\fP \fIbuild-target\fP followed by
 \fBfakeroot debian/rules\fP \fIbinary-target\fP (unless a source-only
-build has been requested with \fB\-S\fP). Note that \fIbinary-target\fR is
-either \fBbinary\fP (default case, or if \fB\-b\fP is specified)
-or \fBbinary-arch\fP (if \fB\-B\fP is specified) or \fBbinary-indep\fP
-(if \fB\-A\fP is specified).
+build has been requested with \fB\-S\fP). Note that \fIbuild-target\fP
+is \fBbuild\fP (default case) or \fBbuild-arch\fP (if \fB\-B\fP is specified
+and the control file defines the build-feature \fBbuild-arch\fP) and that
+\fIbinary-target\fR is either \fBbinary\fP (default case, or if \fB\-b\fP is
+specified) or \fBbinary-arch\fP (if \fB\-B\fP is specified) or
+\fBbinary-indep\fP (if \fB\-A\fP is specified).
 .IP \fB6.\fP 3
 It calls \fBgpg\fP to sign the \fB.dsc\fP file (if any, unless
 \fB\-us\fP is specified).
diff --git a/scripts/Dpkg/BuildFeatures.pm b/scripts/Dpkg/BuildFeatures.pm
new file mode 100644
index 000..6400e7e
--- /dev/null
+++ b/scripts/Dpkg/BuildFeatures.pm
@@ -0,0 +1,86 @@
+# Copyright © 2007 Frank Lichtenheld dj...@debian.org
+# Copyright © 2010 Raphaël Hertzog hert...@debian.org
+# Copyright © 2010 Bill Allombertballo...@debian.org
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see http://www.gnu.org/licenses/.
+
+package Dpkg::BuildFeatures;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.00;
+
+use Dpkg::Control::Info;
+
+=encoding utf8
+
+=head1 NAME
+
+Dpkg::BuildFeatures - parse the Build-Features control field
+
+=head1 DESCRIPTION
+
+The Dpkg::BuildFeatures object can be used to query the options
+stored in the Build-Features control field
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item my $bo = 

Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2010-11-25 Thread Raphael Hertzog
reassign 604919 dpkg-dev 1.15.8.6
forcemerge 229357 604919
thanks

(Yay for yet another duplicate on this one...)

On Thu, 25 Nov 2010, Roger Leigh wrote:
 In order to allow full use of Build-Depends-Indep, and to allow
 autobuilding of arch-indep packages on our buildds, as well as
 more efficient building of arch-any packages (since building
 arch-indep stuff can be skipped), I'd like to get full support
 for the build-arch and build-indep targets in debian/rules as
 a release goal for wheezy.

Great... but dpkg-buildpackage will not impose them. If you want
to help, please implement support of the Build-Features: build-arch
field that will tell dpkg-buildpackage that it can rely on
build-arch/indep.

The closest patch was the one of Bill Allombert in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229357#429

The only thing that changed since my last
comments in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=229357#401
is that I will accept a comma-separated field. But I won't merge
anything without documentation and with a name that leads to confusion.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
  ▶ http://RaphaelHertzog.fr (Français)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2010-11-25 Thread Roger Leigh
On Thu, Nov 25, 2010 at 02:19:35PM +0100, Raphael Hertzog wrote:
 reassign 604919 dpkg-dev 1.15.8.6
 forcemerge 229357 604919
 thanks
 
 (Yay for yet another duplicate on this one...)
 
 On Thu, 25 Nov 2010, Roger Leigh wrote:
  In order to allow full use of Build-Depends-Indep, and to allow
  autobuilding of arch-indep packages on our buildds, as well as
  more efficient building of arch-any packages (since building
  arch-indep stuff can be skipped), I'd like to get full support
  for the build-arch and build-indep targets in debian/rules as
  a release goal for wheezy.
 
 Great... but dpkg-buildpackage will not impose them. If you want
 to help, please implement support of the Build-Features: build-arch
 field that will tell dpkg-buildpackage that it can rely on
 build-arch/indep.

I don't see why we can't just mandate it in Policy, and then
enable it unconditionally if the Standards-Version is = that
policy version.  The package maintainer is declaring that their
package conforms to that policy version, which requires that
those targets be present.  Easy and simple.

This would make the transition smooth; we won't break existing
packages, and developers will naturally adopt it as they update
to the latest Standards Version, so there's no reason the
transition can't also be equally rapid if we push for it.

This isn't an optional build feature like noopt, parallel etc.
It's something which we want to be the default.  We shouldn't
need to jump through extra hoops to enable default behaviour.
Why bother with new fields like Build-Features when we have an
existing simple and robust mechanism to deal with this.  This
has been an outstanding defect for over six years, and it's
incredibly frustrating that it's being held back by this
(unnecessary?) requirement.

With the cdbs and dh support, followed by the addition of
lintian checks, we'll have 50% archive coverage by the end
of the year, and we should get it mandated by Policy.  I'll
be happy to drive this forward by getting the archive
coverage and policy changes done, rather than waiting another
few years for new control fields.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?   http://gutenprint.sourceforge.net/
   `-GPG Public Key: 0x25BFB848   Please GPG sign your mail.


signature.asc
Description: Digital signature


Bug#229357: Bug#604919: dpkg: Please add support for build-arch and build-indep targets

2010-11-25 Thread Raphael Hertzog
Hi,

On Thu, 25 Nov 2010, Roger Leigh wrote:
 I don't see why we can't just mandate it in Policy, and then
 enable it unconditionally if the Standards-Version is = that
 policy version.  The package maintainer is declaring that their
 package conforms to that policy version, which requires that
 those targets be present.  Easy and simple.

Jonathan made a nice summary and I'm following Russ's recommendation
to not use Standards-Version for this.

 This isn't an optional build feature like noopt, parallel etc.
 It's something which we want to be the default.  We shouldn't

It's not clear at all that we want this to be the default. Only a tiny
minority of packages benefit from the split build process. So it makes
sense to use a capability label to enable it conditionnaly.

 existing simple and robust mechanism to deal with this.  This
 has been an outstanding defect for over six years, and it's
 incredibly frustrating that it's being held back by this
 (unnecessary?) requirement.

It's not been held back by this requirement. It's been held back by
the lack of a nice and reliable way to auto-detect the available targets.
And the lack of consensus on the best way to get forward.

I have decided what I'm ready to accept and I will implement it at some
point. But if you want to go faster, you're welcome to provide me
a patch that I can accept...

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Follow my Debian News ▶ http://RaphaelHertzog.com (English)
  ▶ http://RaphaelHertzog.fr (Français)



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org