Sorry I've let this languish rather - too many things to do. But
Alkmim tried actually using it and as has been pointed out above there
are omissions.
I've been meaning to start a thread on debian-devel to check that
there was reasonable consensus around this approach inorder to answer
the substantive question of 'are we really doing it this way?'. (And
to save us having a long debate on details in this bug prematurely).
I've not finished+sent that mail yet, but really will imminently now
precise is frozen. In the meatime getting a user+GSOC has prompted an
update. :-)
BTW that was alkmim's first ever bugrep above so thanks for being nice
to him.
Attached is a slightly better version which is at least useful enough to
work with.
I've added manpage info and corrected the broken code round setting
$buildstage.
So the current interface is that dpkg-buildpackage does not have a
comand-line option and just changes its behaviour if
DEB_BUILD_OPTIONS=stage=1 is set (syntax copied from parallel=n),
whilst dpkg-chceckbuildopts does not do anything with magic ENV vars
but takes a --stage=n option.
This was because that's how I expect it to be used (cross-building
tools set the apropriate DEB_BUILD_OPTIONS item, and things 'just
work'), but adding the ENV parsing code to dpkg-checkbuilddepends
seemed unnecessary. I'm very happy to take advice on whether this is
the right interface semantics to use.
Maybe I really should add a --stage=n option to dpkg-buildpackage too?
But do we really need more than one way to do this?
The old version of the patch didn't work well if stage=1 is set but no
Build-Depends-Stage1 is actualy present. (it carefully read no build
deps and thus found they were satisfied). Now if falls back to the
normal build deps if no staged build-deps are defined. We could
declare than an error instead, but that makes it harder to iterate
through a package set building and stage1 versions if present. I don't
have strong opinions here.
Wookey
--
Principal hats: Linaro, Emdebian, Wookware, Balloonboard, ARM
http://wookware.org/
diff -ur dpkg-1.16.2.original/man/deb-src-control.5 dpkg-1.16.2/man/deb-src-control.5
--- dpkg-1.16.2.original/man/deb-src-control.5 2012-03-19 06:40:08.000000000 +0000
+++ dpkg-1.16.2/man/deb-src-control.5 2012-04-13 02:42:48.181521792 +0100
@@ -135,6 +135,18 @@
in this case.
.TP
+.BI Build\-Depends\-Stage1: " package-list"
+Modfied \fBBuild\-Depends\fP list of packages needed to build the source
+package in 'bootstrap stage 1' mode. Staged builds are used to break
+build-dependency loops when bootstrapping an architecture.
+
+.TP
+.BI Build\-Depends\-Indep\-Stage1: " package-list"
+Modified \fBBuild\-Depends\-Indep\fPA package list for building the source
+package in 'bootstrap stage 1' mode. Staged builds are used to break
+build-dependency loops when bootstrapping an architecture.
+
+.TP
.BI Build\-Conflicts: " package-list"
A list of packages that should not be installed when the package is build, for
example because they interfere with the used build system.
@@ -146,8 +158,12 @@
The syntax of the
.B Build\-Depends
-and
+,
.B Build\-Depends\-Indep
+,
+.B Build\-Depends\-Stage1
+and
+.B Build\-Depends\-Indep\-Stage1
fields is a list of groups of alternative packages. Each group is a list
of packages separated by vertical bar (or "pipe") symbols, "|". The
groups are separated by commas. Commas are to be read as "AND", and pipes
diff -ur dpkg-1.16.2.original/scripts/Dpkg/BuildOptions.pm dpkg-1.16.2/scripts/Dpkg/BuildOptions.pm
--- dpkg-1.16.2.original/scripts/Dpkg/BuildOptions.pm 2012-03-19 06:40:08.000000000 +0000
+++ dpkg-1.16.2/scripts/Dpkg/BuildOptions.pm 2012-04-13 03:29:29.027410435 +0100
@@ -121,6 +121,9 @@
} elsif ($key eq 'parallel') {
$value = "" if not defined($value);
return 0 if $value !~ /^\d*$/;
+ } elsif ($key eq 'stage') {
+ $value = "" if not defined($value);
+ return 1 if $value !~ /^\d*$/;
}
$self->{'options'}{$key} = $value;
diff -ur dpkg-1.16.2.original/scripts/Dpkg/Control/Fields.pm dpkg-1.16.2/scripts/Dpkg/Control/Fields.pm
--- dpkg-1.16.2.original/scripts/Dpkg/Control/Fields.pm 2012-03-19 06:40:08.000000000 +0000
+++ dpkg-1.16.2/scripts/Dpkg/Control/Fields.pm 2012-04-13 01:46:59.484916503 +0100
@@ -73,10 +73,20 @@
dependency => 'normal',
dep_order => 1,
},
+ 'Build-Depends-Stage1' => {
+ allowed => ALL_SRC,
+ dependency => 'normal',
+ dep_order => 1,
+ },
'Build-Depends-Indep' => {
allowed => ALL_SRC,
dependency => 'normal',
dep_order => 2,
+ },
+ 'Build-Depends-Indep-Stage1' => {
+ allowed => ALL_SRC,
+ dependency => 'normal',
+ dep_order => 2,
},
'Built-Using' => {
allowed => ALL_PKG,
diff -ur dpkg-1.16.2.original/scripts/dpkg-buildpackage.pl dpkg-1.16.2/scripts/dpkg-buildpackage.pl
--- dpkg-1.16.2.original/scripts/dpkg-buildpackage.pl 2012-03-19 06:40:09.000000000 +0000
+++ dpkg-1.16.2/scripts/dpkg-buildpackage.pl 2012-04-13 03:29:31.231421372 +0100
@@ -123,6 +123,7 @@
my $targetarch = my $targetgnusystem = '';
my $call_target = '';
my $call_target_as_root = 0;
+my $buildstage = 0;
my (@checkbuilddep_opts, @changes_opts, @source_opts);
use constant BUILD_DEFAULT => 1;
@@ -299,6 +300,9 @@
$build_opts->export();
}
+$buildstage = $build_opts->get("stage") if $build_opts->has("stage");
+
+
my $cwd = cwd();
my $dir = basename($cwd);
@@ -362,6 +366,9 @@
if ($admindir) {
push @checkbuilddep_opts, "--admindir=$admindir";
}
+ if ($buildstage) {
+ push @checkbuilddep_opts, "--stage=$buildstage";
+ }
system('dpkg-checkbuilddeps', @checkbuilddep_opts);
if (not WIFEXITED($?)) {
diff -ur dpkg-1.16.2.original/scripts/dpkg-checkbuilddeps.pl dpkg-1.16.2/scripts/dpkg-checkbuilddeps.pl
--- dpkg-1.16.2.original/scripts/dpkg-checkbuilddeps.pl 2012-03-19 06:40:09.000000000 +0000
+++ dpkg-1.16.2/scripts/dpkg-checkbuilddeps.pl 2012-04-13 03:46:33.968492845 +0100
@@ -51,6 +51,8 @@
-a arch assume given host architecture
--admindir=<directory>
change the administrative directory.
+ --stage=<level>
+ use build-depends-stage level specified
-h, --help show this help message.
--version show the version.")
. "\n\n" . _g(
@@ -61,13 +63,15 @@
my $binary_only=0;
my ($bd_value, $bc_value);
my $host_arch = get_host_arch();
+my $buildstage=0;
if (!GetOptions('B' => \$binary_only,
'help|h' => sub { usage(); exit(0); },
'version' => \&version,
'd=s' => \$bd_value,
'c=s' => \$bc_value,
'a=s' => \$host_arch,
- 'admindir=s' => \$admindir)) {
+ 'admindir=s' => \$admindir,
+ 'stage=s' => \$buildstage)) {
usage();
exit(2);
}
@@ -80,10 +84,16 @@
my $facts = parse_status("$admindir/status");
unless (defined($bd_value) or defined($bc_value)) {
+ my $BD_key="Build-Depends";
+ my $BDI_key="Build-Depends-Indep";
+ if ($buildstage and defined $fields->{"Build-Depends-Stage".$buildstage}) {
+ $BD_key="Build-Depends-Stage".$buildstage;
+ $BDI_key="Build-Depends-Indep-Stage".$buildstage;
+ }
$bd_value = 'build-essential';
- $bd_value .= ", " . $fields->{"Build-Depends"} if defined $fields->{"Build-Depends"};
- if (not $binary_only and defined $fields->{"Build-Depends-Indep"}) {
- $bd_value .= ", " . $fields->{"Build-Depends-Indep"};
+ $bd_value .= ", " . $fields->{$BD_key} if defined $fields->{$BD_key};
+ if (not $binary_only and defined $fields->{$BDI_key}) {
+ $bd_value .= ", " . $fields->{$BDI_key};
}
$bc_value = $fields->{"Build-Conflicts"} if defined $fields->{"Build-Conflicts"};
if (not $binary_only and defined $fields->{"Build-Conflicts-Indep"}) {