This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=b7334ac2ba0d3b189add4e5036e614c05d5e02ec

commit b7334ac2ba0d3b189add4e5036e614c05d5e02ec
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Oct 10 23:14:11 2025 +0200

    Dpkg::Control::FieldsCore: Deprecate SC field export rules in binary stanza
    
    Exporting fields into .dsc and .changes files declared in the
    binary stanza of a source package template control file, makes little
    sense, because there if there are multiple binary stanzas the resulting
    value will depend on how the file is evaluated. If there's ever a need
    for this, then proper support needs to be added to dpkg, so that any
    value can be coalesced to generate a single output value.
    
    Prompted-by: Richard Hansen <[email protected]>
    Ref: https://bugs.debian.org/1117566
---
 man/deb-src-control.pod            | 6 ++++++
 scripts/Dpkg/Control/FieldsCore.pm | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/man/deb-src-control.pod b/man/deb-src-control.pod
index 431659c0b..8daef4687 100644
--- a/man/deb-src-control.pod
+++ b/man/deb-src-control.pod
@@ -496,16 +496,22 @@ the letters B<SBC> and a hyphen.
 
 The field will appear in the source package control file, see L<dsc(5)>.
 
+Only expected in the source package stanza.
+
 =item B<B>
 
 The field will appear in the control file in the binary package, see
 L<deb-control(5)>.
 
+Allowed in the source package stanza or any binary package stanza.
+
 =item B<C>
 
 The field will appear in the upload control (.changes) file, see
 L<deb-changes(5)>.
 
+Only expected in the source package stanza.
+
 =back
 
 Note that the B<X>[B<SBC>]B<-> prefixes are stripped when the
diff --git a/scripts/Dpkg/Control/FieldsCore.pm 
b/scripts/Dpkg/Control/FieldsCore.pm
index 3d0ff2fc5..c7d592e3e 100644
--- a/scripts/Dpkg/Control/FieldsCore.pm
+++ b/scripts/Dpkg/Control/FieldsCore.pm
@@ -1130,6 +1130,12 @@ sub field_transfer_single {
         return $field;
     } elsif ($field =~ /^X([SBC]*)-/i) {
         my $dest = $1;
+
+        if ($dest =~ /SC/i and $from_type == CTRL_TMPL_PKG) {
+            warning(g_('non-sensical field export rules (%s) in field %s in ' .
+                       'binary stanza from source package template control 
file'),
+                    $dest, $field);
+        }
         if (($dest =~ /B/i and $to_type == CTRL_DEB) or
             ($dest =~ /S/i and $to_type == CTRL_DSC) or
             ($dest =~ /C/i and $to_type == CTRL_FILE_CHANGES))

-- 
Dpkg.Org's dpkg

Reply via email to