Package: dpkg-dev
Version: 1.20.9
Severity: wishlist

Hello.

This pattern seems common:
debian/rules:
  override_dh_gencontrol:
        dh_gencontrol -- "-VBuilt-Using:P1=`dpkg-query -Wf'$${source:Package} 
(= $${source:Version})' P2`"
debian/control:
  Package: P1
  Built-Using: ${Built-Using:P1}

It would be convenient and less error-prone to write:
  Package: P1
  Built-Using: P2
and trust dpkg-gencontrol to replace P2 with the output of
  dpkg-query -Wf '${source:Package} (= ${source:Version})' P2

debian/rules could still use variables, but would not be forced to
deal with dpkg-query anymore.
  override_dh_gencontrol:
    dh_gencontrol -- -VBuilt-Using:P1=$(if TEST,P2)

Especially, conditions depending on architectures or build profiles
could be expressed directly within debian/control:
  Built-Using: P2 [!arm64]

The rewriting should only affect valid package identitiers without
version restriction (after variable substitutions and architecture or
profile restrictions).  Since the Policy requires values matching
'SOURCE (= VERSION)', single identifiers are currently invalid.
Hence, the change would not affect existing packages or, more
generally, explicit values from the maintainer.

Reply via email to