diff -ur dpkg-1.16.4.3.original/debian/changelog dpkg-1.16.4.3/debian/changelog
--- dpkg-1.16.4.3.original/debian/changelog	2012-06-17 08:56:19.000000000 +0000
+++ dpkg-1.16.4.3/debian/changelog	2012-06-28 11:41:03.000000000 +0000
@@ -1,3 +1,9 @@
+dpkg (1.16.4.3bootstrap1) UNRELEASED; urgency=low
+
+  * Add Staged build support
+
+ -- Wookey <wookey@debian.org>  Thu, 28 Jun 2012 12:40:17 +0100
+
 dpkg (1.16.4.3) unstable; urgency=low
 
   * On «update-alternatives --install» only warn for now on out of range
@@ -11,6 +17,13 @@
 
 dpkg (1.16.4.2) unstable; urgency=low
 
+  * Check correctly for out of range negative field width values in dpkg-query
+    --show format strings. Regression introduced in 1.16.4. Closes: #676796
+
+ -- Guillem Jover <guillem@debian.org>  Sat, 09 Jun 2012 16:16:17 +0200
+
+dpkg (1.16.4.2) unstable; urgency=low
+
   * Check correctly for out of range negative field width values in dpkg-query
     --show format strings. Regression introduced in 1.16.4. Closes: #676796
 
diff -ur dpkg-1.16.4.3.original/dpkg-deb/build.c dpkg-1.16.4.3/dpkg-deb/build.c
--- dpkg-1.16.4.3.original/dpkg-deb/build.c	2012-06-14 05:18:31.000000000 +0000
+++ dpkg-1.16.4.3/dpkg-deb/build.c	2012-06-28 17:35:48.000000000 +0000
@@ -296,6 +296,7 @@
   "Installer-Menu-Item",
   "Homepage",
   "Tag",
+  "Build-Stage",
   NULL
 };
 
diff -ur dpkg-1.16.4.3.original/man/dpkg-buildpackage.1 dpkg-1.16.4.3/man/dpkg-buildpackage.1
--- dpkg-1.16.4.3.original/man/dpkg-buildpackage.1	2012-06-15 15:11:03.000000000 +0000
+++ dpkg-1.16.4.3/man/dpkg-buildpackage.1	2012-06-28 11:26:13.000000000 +0000
@@ -261,6 +261,11 @@
 \fBCPPFLAGS\fP and \fBLDFLAGS\fP) with values as returned
 by \fBdpkg\-buildflags\fP. This is no longer the case.
 .
+If DEB_BUILD_OPTIONS contains \fBstage=1\fP or \fBstage=2\fP then
+'staged build' mode is selected and checkbuilddeps is called with the
+--stage=N option so that the alternate Build-Depends-StageN
+build-dependencies are checked.
+.
 .SH BACKWARD COMPATIBILITY
 \fBdpkg\-buildpackage\fP is using the \fBbuild\-arch\fP and
 \fBbuild\-indep\fP targets since version 1.16.2. Those targets are thus
diff -ur dpkg-1.16.4.3.original/man/dpkg-checkbuilddeps.1 dpkg-1.16.4.3/man/dpkg-checkbuilddeps.1
--- dpkg-1.16.4.3.original/man/dpkg-checkbuilddeps.1	2012-06-15 15:11:03.000000000 +0000
+++ dpkg-1.16.4.3/man/dpkg-checkbuilddeps.1	2012-06-28 11:26:13.000000000 +0000
@@ -61,6 +61,11 @@
 the control file is to be built for the given host architecture instead of
 the architecture of the current system.
 .TP
+.BI \-\-stage= stage
+Specify that the Build-Depends-StageN dependency requirements should 
+be checked (if present) instead of the normal fields, for use in
+bootstrapping. Values of 1 and 2 are supported.
+.TP
 .BR \-h ", " \-\-help
 Show the usage message and exit.
 .TP
diff -ur dpkg-1.16.4.3.original/scripts/Dpkg/BuildOptions.pm dpkg-1.16.4.3/scripts/Dpkg/BuildOptions.pm
--- dpkg-1.16.4.3.original/scripts/Dpkg/BuildOptions.pm	2012-06-14 05:12:33.000000000 +0000
+++ dpkg-1.16.4.3/scripts/Dpkg/BuildOptions.pm	2012-06-28 11:26:13.000000000 +0000
@@ -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.4.3.original/scripts/Dpkg/Control/Fields.pm dpkg-1.16.4.3/scripts/Dpkg/Control/Fields.pm
--- dpkg-1.16.4.3.original/scripts/Dpkg/Control/Fields.pm	2012-06-17 08:10:04.000000000 +0000
+++ dpkg-1.16.4.3/scripts/Dpkg/Control/Fields.pm	2012-06-28 17:33:06.000000000 +0000
@@ -53,7 +53,7 @@
     'Breaks' => {
         allowed => ALL_PKG,
         dependency => 'union',
-        dep_order => 7,
+        dep_order => 13,
     },
     'Bugs' => {
         allowed => (ALL_PKG | CTRL_INFO_SRC | CTRL_FILE_VENDOR) & (~CTRL_INFO_PKG),
@@ -61,17 +61,17 @@
     'Build-Conflicts' => {
         allowed => ALL_SRC,
         dependency => 'union',
-        dep_order => 4,
+        dep_order => 10,
     },
     'Build-Conflicts-Arch' => {
         allowed => ALL_SRC,
         dependency => 'union',
-        dep_order => 5,
+        dep_order => 11,
     },
     'Build-Conflicts-Indep' => {
         allowed => ALL_SRC,
         dependency => 'union',
-        dep_order => 6,
+        dep_order => 12,
     },
     'Build-Depends' => {
         allowed => ALL_SRC,
@@ -88,10 +88,43 @@
         dependency => 'normal',
         dep_order => 3,
     },
+    'Build-Depends-Stage1' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 4,
+    },
+    'Build-Depends-Arch-Stage1' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 5,
+    },
+    'Build-Depends-Indep-Stage1' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 6,
+    },
+    'Build-Depends-Stage2' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 7,
+    },
+    'Build-Depends-Arch-Stage2' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 8,
+    },
+    'Build-Depends-Indep-Stage2' => {
+        allowed => ALL_SRC,
+        dependency => 'normal',
+        dep_order => 9,
+    },
+    'Build-Stage' => {
+        allowed => ALL_PKG,
+    },
     'Built-Using' => {
         allowed => ALL_PKG,
         dependency => 'union',
-        dep_order => 10,
+        dep_order => 16,
     },
     'Changed-By' => {
         allowed => CTRL_FILE_CHANGES,
@@ -111,7 +144,7 @@
     'Conflicts' => {
         allowed => ALL_PKG,
         dependency => 'union',
-        dep_order => 6,
+        dep_order => 12,
     },
     'Date' => {
         allowed => ALL_CHANGES,
@@ -133,7 +166,7 @@
     'Enhances' => {
         allowed => ALL_PKG,
         dependency => 'union',
-        dep_order => 5,
+        dep_order => 11,
     },
     'Essential' => {
         allowed => ALL_PKG,
@@ -294,7 +327,7 @@
     CTRL_PKG_DEB() => [
         qw(Package Package-Type Source Version Built-Using Kernel-Version
         Architecture Subarchitecture Installer-Menu-Item Essential Origin Bugs
-        Maintainer Installed-Size), &field_list_pkg_dep(),
+        Maintainer Build-Stage Installed-Size), &field_list_pkg_dep(),
         qw(Section Priority Multi-Arch Homepage Description Tag Task)
     ],
     CTRL_PKG_SRC() => [
diff -ur dpkg-1.16.4.3.original/scripts/dpkg-buildpackage.pl dpkg-1.16.4.3/scripts/dpkg-buildpackage.pl
--- dpkg-1.16.4.3.original/scripts/dpkg-buildpackage.pl	2012-06-14 05:12:34.000000000 +0000
+++ dpkg-1.16.4.3/scripts/dpkg-buildpackage.pl	2012-06-28 11:26:23.000000000 +0000
@@ -126,6 +126,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;
@@ -286,6 +287,9 @@
     $build_opts->export();
 }
 
+$buildstage = $build_opts->get("stage") if $build_opts->has("stage");
+
+
 my $cwd = cwd();
 my $dir = basename($cwd);
 
@@ -349,6 +353,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.4.3.original/scripts/dpkg-checkbuilddeps.pl dpkg-1.16.4.3/scripts/dpkg-checkbuilddeps.pl
--- dpkg-1.16.4.3.original/scripts/dpkg-checkbuilddeps.pl	2012-06-14 05:12:34.000000000 +0000
+++ dpkg-1.16.4.3/scripts/dpkg-checkbuilddeps.pl	2012-06-28 13:00:20.000000000 +0000
@@ -52,6 +52,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(
@@ -63,6 +65,7 @@
 my $ignore_bd_indep = 0;
 my ($bd_value, $bc_value);
 my $host_arch = get_host_arch();
+my $buildstage=0;
 if (!GetOptions('A' => \$ignore_bd_arch,
                 'B' => \$ignore_bd_indep,
                 'help|h' => sub { usage(); exit(0); },
@@ -70,7 +73,8 @@
                 'd=s' => \$bd_value,
                 'c=s' => \$bc_value,
                 'a=s' => \$host_arch,
-                'admindir=s' => \$admindir)) {
+                'admindir=s' => \$admindir,
+                'stage=s' => \$buildstage)) {
 	usage();
 	exit(2);
 }
@@ -83,13 +87,21 @@
 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";
+    my $BDA_key="Build-Depends-Arch";
+    if ($buildstage and defined $fields->{"Build-Depends-Stage".$buildstage}) {
+       $BD_key="Build-Depends-Stage".$buildstage;
+       $BDI_key="Build-Depends-Indep-Stage".$buildstage;
+       $BDA_key="Build-Depends-Arch-Stage".$buildstage;
+    }
     $bd_value = 'build-essential';
-    $bd_value .= ", " . $fields->{"Build-Depends"} if defined $fields->{"Build-Depends"};
-    if (not $ignore_bd_arch and defined $fields->{"Build-Depends-Arch"}) {
-	$bd_value .= ", " . $fields->{"Build-Depends-Arch"};
+    $bd_value .= ", " . $fields->{$BD_key} if defined $fields->{$BD_key};
+    if (not $ignore_bd_arch and defined $fields->{$BDA_key}) {
+	$bd_value .= ", " . $fields->{$BDA_key};
     }
-    if (not $ignore_bd_indep and defined $fields->{"Build-Depends-Indep"}) {
-	$bd_value .= ", " . $fields->{"Build-Depends-Indep"};
+    if (not $ignore_bd_indep and defined $fields->{$BDI_key}) {
+	$bd_value .= ", " . $fields->{$BDI_key};
     }
     $bc_value = $fields->{"Build-Conflicts"} if defined $fields->{"Build-Conflicts"};
     if (not $ignore_bd_arch and defined $fields->{"Build-Conflicts-Arch"}) {
diff -ur dpkg-1.16.4.3.original/scripts/dpkg-gencontrol.pl dpkg-1.16.4.3/scripts/dpkg-gencontrol.pl
--- dpkg-1.16.4.3.original/scripts/dpkg-gencontrol.pl	2012-06-17 08:10:07.000000000 +0000
+++ dpkg-1.16.4.3/scripts/dpkg-gencontrol.pl	2012-06-28 11:19:54.000000000 +0000
@@ -37,6 +37,7 @@
 use Dpkg::Substvars;
 use Dpkg::Vars;
 use Dpkg::Changelog::Parse;
+use Dpkg::BuildOptions;
 
 textdomain("dpkg-dev");
 
@@ -294,6 +295,10 @@
     }
 }
 
+my $build_opts = Dpkg::BuildOptions->new();
+my $buildstage = $build_opts->get("stage") if $build_opts->has("stage");
+$fields->{'Build-Stage'} = $buildstage if defined($buildstage);
+
 my $verdiff = $fields->{'Version'} ne $substvars->get('source:Version') ||
               $fields->{'Version'} ne $sourceversion;
 if ($oppackage ne $sourcepackage || $verdiff) {
diff -ur dpkg-1.16.4.3.original/scripts/dpkg-source.pl dpkg-1.16.4.3/scripts/dpkg-source.pl
--- dpkg-1.16.4.3.original/scripts/dpkg-source.pl	2012-06-17 08:10:07.000000000 +0000
+++ dpkg-1.16.4.3/scripts/dpkg-source.pl	2012-06-28 11:28:38.000000000 +0000
@@ -246,7 +246,7 @@
 	    $fields->{$_} = $v;
 	} elsif (m/^Uploaders$/i) {
 	    ($fields->{$_} = $v) =~ s/\s*[\r\n]\s*/ /g; # Merge in a single-line
-	} elsif (m/^Build-(Depends|Conflicts)(-Arch|-Indep)?$/i) {
+	} elsif (m/^Build-(Depends|Conflicts)(-Arch|-Indep)?(-Stage\d)?$/i) {
 	    my $dep;
 	    my $type = field_get_dep_type($_);
 	    $dep = deps_parse($v, union => $type eq 'union');
