Package: dpkg-dev
Followup-For: Bug #990073
Control: tags -1 + patch

Here is a proof of concept passing the following tests.
gcc                                       -> gcc-defaults (= .*)
bla (= 1), gcc, foo (= 2)                 -> bla (= 1), foo (= 2), gcc-defaults 
(= .*)
bla (= 1), gcc, g++, foo (= 2)            -> bla (= 1), foo (= 2), gcc-defaults 
(= .*)
bla (= 1), foo (= 2) [arm64], g++ [arm64] -> bla (= 1)
bla, gcc, g++, foo (= 2)                  -> error message with 'bla gcc g++'

--- a/man/dpkg-gencontrol.pod
+++ b/man/dpkg-gencontrol.pod
@@ -58,6 +58,10 @@ B<dpkg-gencontrol>
 also adds an entry for the binary package to
 B<debian/files>.
 
+Each unversioned dependency in the B<Built-Using> field is assumed to
+be installed on the system (usually, via B<Build-Depends>), and
+replaced with the matching source package and version.
+
 =head1 OPTIONS
 
 =over
--- a/scripts/dpkg-gencontrol.pl
+++ b/scripts/dpkg-gencontrol.pl
@@ -293,6 +293,13 @@ foreach my $field (field_list_pkg_dep()) {
                              reduce_profiles => 1, union => 1);
             error(g_("parsing package '%s' %s field: %s"), $oppackage,
                   $field, $field_value) unless defined $dep;
+            if ($field eq 'Built-Using'
+                and (my @changed = grep { not defined $_->{'version'} } 
$dep->get_deps())) {
+                my $debs = join(' ', map { $_->{'package'} } @changed);
+                my @lines = `dpkg-query -Wf '\${source:Package} (= 
\${source:Version})\\n' $debs`;
+                error(g_('failed to expand Built-Using: %s'), $debs) if $?;
+                $_->parse_string(shift @lines) for (@changed);
+            }
            $dep->simplify_deps($facts);
             $dep->sort();
        }

Reply via email to