diff -Nru dpkg-1.16.7/debian/changelog dpkg-1.16.7+nmu1/debian/changelog
--- dpkg-1.16.7/debian/changelog	2012-07-02 15:23:31.000000000 -0400
+++ dpkg-1.16.7+nmu1/debian/changelog	2012-07-14 07:05:38.000000000 -0400
@@ -1,3 +1,10 @@
+dpkg (1.16.7+nmu1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add support for build profiles.
+
+ -- P. J. McDermott <pjm@nac.net>  Sat, 14 Jul 2012 07:05:11 -0400
+
 dpkg (1.16.7) unstable; urgency=low
 
   [ Guillem Jover ]
diff -Nru dpkg-1.16.7/man/deb-src-control.5 dpkg-1.16.7+nmu1/man/deb-src-control.5
--- dpkg-1.16.7/man/deb-src-control.5	2012-06-30 03:21:47.000000000 -0400
+++ dpkg-1.16.7+nmu1/man/deb-src-control.5	2012-07-14 12:53:03.000000000 -0400
@@ -177,8 +177,9 @@
 of packages separated by vertical bar (or "pipe") symbols, "|". The
 groups are separated by commas. Commas are to be read as "AND", and pipes
 as "OR", with pipes binding more tightly. Each package name is
-optionally followed by a version number specification in parentheses and an
-architecture specification in square brackets.
+optionally followed by a version number specification in parentheses, an
+architecture specification in square brackets, and a profile specification
+in angle brackets.
 
 The syntax of the
 .BR Build\-Conflicts ,
@@ -188,7 +189,8 @@
 fields is a list of comma-separated package names, where the comma is read
 as an "AND". Specifying alternative packages using a "pipe" is not supported.
 Each package name is optionally followed by a version number specification in
-parentheses and an architecture specification in square brackets.
+parentheses, an architecture specification in square brackets, and a profile
+specification in angle brackets.
 
 A version number may start with a ">>", in which case any later version
 will match, and may specify or omit the Debian packaging revision (separated
diff -Nru dpkg-1.16.7/man/dpkg-checkbuilddeps.1 dpkg-1.16.7+nmu1/man/dpkg-checkbuilddeps.1
--- dpkg-1.16.7/man/dpkg-checkbuilddeps.1	2012-06-30 03:21:47.000000000 -0400
+++ dpkg-1.16.7+nmu1/man/dpkg-checkbuilddeps.1	2012-07-14 12:55:22.000000000 -0400
@@ -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 "\-p " profile
+Check build dependencies/conflicts assuming that the package described in
+the control file is to be built for the given build profile instead of the
+default full profile.
+.TP
 .BR \-? ", " \-\-help
 Show the usage message and exit.
 .TP
diff -Nru dpkg-1.16.7/scripts/Dpkg/Deps.pm dpkg-1.16.7+nmu1/scripts/Dpkg/Deps.pm
--- dpkg-1.16.7/scripts/Dpkg/Deps.pm	2012-06-30 03:21:47.000000000 -0400
+++ dpkg-1.16.7+nmu1/scripts/Dpkg/Deps.pm	2012-07-14 07:44:46.000000000 -0400
@@ -286,6 +286,8 @@
     $options{use_arch} = 1 if not exists $options{use_arch};
     $options{reduce_arch} = 0 if not exists $options{reduce_arch};
     $options{host_arch} = get_host_arch() if not exists $options{host_arch};
+    $options{reduce_profile} = 0 if not exists $options{reduce_profile};
+    $options{build_profile} = '' if not exists $options{build_profile};
     $options{union} = 0 if not exists $options{union};
     $options{build_dep} = 0 if not exists $options{build_dep};
 
@@ -299,6 +301,8 @@
         foreach my $dep_or (split(/\s*\|\s*/m, $dep_and)) {
 	    my $dep_simple = Dpkg::Deps::Simple->new($dep_or, host_arch =>
 	                                             $options{host_arch},
+	                                             build_profile =>
+	                                             $options{build_profile},
 	                                             build_dep =>
 	                                             $options{build_dep});
 	    if (not defined $dep_simple->{package}) {
@@ -310,6 +314,10 @@
 		$dep_simple->reduce_arch($options{host_arch});
 		next if not $dep_simple->arch_is_concerned($options{host_arch});
 	    }
+            if ($options{reduce_profile}) {
+		$dep_simple->reduce_profile($options{build_profile});
+		next if not $dep_simple->profile_is_concerned($options{build_profile});
+	    }
 	    push @or_list, $dep_simple;
         }
 	next if not @or_list;
@@ -558,6 +566,7 @@
     $self->{'relation'} = undef;
     $self->{'version'} = undef;
     $self->{'arches'} = undef;
+    $self->{'profiles'} = undef;
     $self->{'archqual'} = undef;
 }
 
@@ -588,6 +597,11 @@
                 \s* (.*?)                   # don't parse architectures now
                 \s* \]                      # closing bracket
               )?                            # end of optional architecture
+              (?:                           # start of optional profile
+                \s* <                       # open bracket for profile
+                \s* (.*?)                   # don't parse profiles now
+                \s* >                       # closing bracket
+              )?                            # end of optional profile
 	      \s*$			    # trailing spaces at end
             /x;
     if (defined($2)) {
@@ -602,6 +616,9 @@
     if (defined($5)) {
 	$self->{arches} = [ split(/\s+/, $5) ];
     }
+    if (defined($6)) {
+	$self->{profiles} = [ split(/\s+/, $6) ];
+    }
 }
 
 sub output {
@@ -616,6 +633,9 @@
     if (defined($self->{'arches'})) {
 	$res .= " [" . join(" ", @{$self->{arches}}) . "]";
     }
+    if (defined($self->{'profiles'})) {
+	$res .= " <" . join(" ", @{$self->{profiles}}) . ">";
+    }
     if (defined($fh)) {
 	print $fh $res;
     }
@@ -745,6 +765,45 @@
     }
 }
 
+sub profile_is_concerned {
+    my ($self, $build_profile) = @_;
+
+    return 0 if not defined $self->{package};  # Empty dep
+    return 1 if not defined $self->{profiles}; # Dep without profile spec
+
+    my $seen_profile = 0;
+    foreach my $profile (@{$self->{profiles}}) {
+	$profile=lc($profile);
+
+	if ($profile =~ /^!/) {
+	    my $not_profile = $profile;
+	    $not_profile =~ s/^!//;
+
+	    if ($build_profile eq $not_profile) {
+		$seen_profile = 0;
+		last;
+	    } else {
+		# !profile includes by default all other profiles
+		# unless they also appear in a !otherprofile
+		$seen_profile = 1;
+	    }
+	} elsif ($build_profile eq $profile) {
+	    $seen_profile = 1;
+	    last;
+	}
+    }
+    return $seen_profile;
+}
+
+sub reduce_profile {
+    my ($self, $build_profile) = @_;
+    if (not $self->profile_is_concerned($build_profile)) {
+	$self->reset();
+    } else {
+	$self->{profiles} = undef;
+    }
+}
+
 sub get_evaluation {
     my ($self, $facts) = @_;
     return undef if not defined $self->{package};
diff -Nru dpkg-1.16.7/scripts/dpkg-checkbuilddeps.pl dpkg-1.16.7+nmu1/scripts/dpkg-checkbuilddeps.pl
--- dpkg-1.16.7/scripts/dpkg-checkbuilddeps.pl	2012-06-30 03:21:47.000000000 -0400
+++ dpkg-1.16.7+nmu1/scripts/dpkg-checkbuilddeps.pl	2012-07-14 07:30:45.000000000 -0400
@@ -51,6 +51,7 @@
   -c build-conf  use given string for build conflicts instead of
                  retrieving them from control file
   -a arch        assume given host architecture
+  -p profile     assume given build profile
   --admindir=<directory>
                  change the administrative directory.
   -?, --help     show this help message.
@@ -64,6 +65,7 @@
 my $ignore_bd_indep = 0;
 my ($bd_value, $bc_value);
 my $host_arch = get_host_arch();
+my $build_profile = '';
 if (!GetOptions('A' => \$ignore_bd_arch,
                 'B' => \$ignore_bd_indep,
                 'help|?' => sub { usage(); exit(0); },
@@ -71,6 +73,7 @@
                 'd=s' => \$bd_value,
                 'c=s' => \$bc_value,
                 'a=s' => \$host_arch,
+                'p=s' => \$build_profile,
                 'admindir=s' => \$admindir)) {
 	usage();
 	exit(2);
@@ -113,12 +116,14 @@
 if ($bd_value) {
 	push @unmet, build_depends('Build-Depends/Build-Depends-Arch/Build-Depends-Indep',
 		deps_parse($bd_value, build_dep => 1, host_arch => $host_arch,
-			   reduce_arch => 1), $facts);
+			   reduce_arch => 1, build_profile => $build_profile,
+			   reduce_profile => 1), $facts);
 }
 if ($bc_value) {
 	push @conflicts, build_conflicts('Build-Conflicts/Build-Conflicts-Arch/Build-Conflicts-Indep',
 		deps_parse($bc_value, build_dep => 1, host_arch => $host_arch,
-			   reduce_arch => 1, union => 1), $facts);
+			   reduce_arch => 1, build_profile => $build_profile,
+			   reduce_profile => 1, union => 1), $facts);
 }
 
 if (@unmet) {
