Control: tags -1 + patch

Le vendredi 09 mars 2018 à 08:57:20+0100, Uwe Kleine-König a écrit :
> Hello,
> 
> On Fri, Dec 15, 2017 at 07:50:04AM +0100, Nicolas Braud-Santoni wrote:
> > Package: sbuild
> > Version: 0.73.0-4
> > Severity: normal
> > 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA512
> > 
> > Dear maintainer,
> > 
> > When building a package (nyx_2.0.4-2) with the following options, the orig
> > tarball was listed in _amd64.changes but not _source.changes :
> > 
> >     $build_source = 1;
> >     $source_only_changes = 1;
> >     $force_orig_source = 1;
> > 
> > Please find enclosed by .sbuildrc, along with the .changes files produced.
> > 
> > Commit 0f4e77b16e47a7d3c9724033254fcab1661aefc5 in nyx [0] should reproduce 
> > the
> > problem (just running `gbp buildpackage --force-orig-source -s`).
> 
> FTR: the same problem exists when passing:
> 
>       --debbuildopt=-v$someearlierversion
> 
> Then the _$arch.changes contains all requested changelog entries, but
> the _source.changes does not.

Hey,

Here is a rough patch I made that seems to fix both issues.

I tested it on my local build of sbuild and here is an excerpt of the
output.

+------------------------------------------------------------------------------+
| Changes                                                                      |
+------------------------------------------------------------------------------+


django-mailman3_1.1.0-4~bpo9+1_amd64.changes:
---------------------------------------------

Format: 1.8
Date: Tue, 20 Mar 2018 08:45:45 +0100
Source: django-mailman3
Binary: python-django-mailman3
Architecture: source all
Version: 1.1.0-4~bpo9+1
Distribution: stretch-backports
Urgency: medium
Maintainer: Debian Mailman Team <pkg-mailman-hack...@lists.alioth.debian.org>
Changed-By: Pierre-Elliott Bécue <be...@crans.org>
Description:
 python-django-mailman3 - Django library to help interaction with Mailman3 
(Python 2 versio
Changes:
 django-mailman3 (1.1.0-4~bpo9+1) stretch-backports; urgency=medium
 .
   * Rebuild for stretch-backports.
   * Update build-dependencies to match stretch-backports repository
 .
 django-mailman3 (1.1.0-4) unstable; urgency=medium
 .
   [ Jonas Meurer ]
   * d/control:
     - Update Vcs-* fields to point to new repository on salsa.debian.org.
 .
   [ Pierre-Elliott Bécue ]
   * d/control:
     - Raise the dehbelper build-dependency minimal version to 11
   * d/compat:
     - Bump level to 11
   * d/copyright@Format: Use the https url instead of the http one
   * d/s/lintian-overrides: Override django-mailman3 source:
     python-foo-but-no-python3-foo python-django-mailman3 with comments.
   * Move django's static directory in /usr/share/python-django-mailman3
     directory.
Checksums-Sha1:
 4f0a8f9f263a13b61091f1cbe757a932636eed6b 1669 
django-mailman3_1.1.0-4~bpo9+1.dsc
 19ddb65147f3161ee133306826b54441881d832d 339268 
django-mailman3_1.1.0.orig.tar.gz
 91fe63cdd4996d18fa77fea7d510c1fc02d0ab93 801 
django-mailman3_1.1.0.orig.tar.gz.asc
 4085ec4db6fdda37e262eb0f2d5eb2e60044d313 6844 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 57a1febef50c8e3dc7999f35a6dfec1487914b78 6604 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo
 ef806ce47512c89173128d56165eda66b16bbff7 317878 
python-django-mailman3_1.1.0-4~bpo9+1_all.deb
Checksums-Sha256:
 245fa6258db6c2a3ea6b5ed4b6f072b0ab1bfbf85b160132e576caddfc9f5e67 1669 
django-mailman3_1.1.0-4~bpo9+1.dsc
 62f61edaedbee6c917b8da1464e4f32865cd2e6bc5f06ecbcdfe412edd9b4df6 339268 
django-mailman3_1.1.0.orig.tar.gz
 0c0ce8683314053c9d931bcf499202a94bd2195d6b147e390f74451523ec20f0 801 
django-mailman3_1.1.0.orig.tar.gz.asc
 c8aca7bf11c8c53eb97f8e496b83ccd691baaaad221c368188c970fe3387d1f0 6844 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 bf7179042fa5b27275e5688cab497573abb43b7e259d436d2d10922d7d0fc793 6604 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo
 e1879710b72d903905318221814ea387756af28d6be7c8b4a65b16a555c690d5 317878 
python-django-mailman3_1.1.0-4~bpo9+1_all.deb
Files:
 0b5dd3a450f5f0867fa4864e2ccc4395 1669 python optional 
django-mailman3_1.1.0-4~bpo9+1.dsc
 94023459ceba2a036aea25394e9923d7 339268 python optional 
django-mailman3_1.1.0.orig.tar.gz
 bcdc62bd32c9e9840a26fef9936d7270 801 python optional 
django-mailman3_1.1.0.orig.tar.gz.asc
 8967e5e19f1e98181be7ceb9076feae4 6844 python optional 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 b3173094c0545479c71426b6611a1413 6604 python optional 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo
 3860479a7d8c3d573fd8d730e87c747b 317878 python optional 
python-django-mailman3_1.1.0-4~bpo9+1_all.deb

django-mailman3_1.1.0-4~bpo9+1_source.changes:
----------------------------------------------

dpkg-genchanges: info: including full source code in upload
Format: 1.8
Date: Tue, 20 Mar 2018 08:45:45 +0100
Source: django-mailman3
Binary: python-django-mailman3
Architecture: source
Version: 1.1.0-4~bpo9+1
Distribution: stretch-backports
Urgency: medium
Maintainer: Debian Mailman Team <pkg-mailman-hack...@lists.alioth.debian.org>
Changed-By: Pierre-Elliott Bécue <be...@crans.org>
Description:
 python-django-mailman3 - Django library to help interaction with Mailman3 
(Python 2 versio
Changes:
 django-mailman3 (1.1.0-4~bpo9+1) stretch-backports; urgency=medium
 .
   * Rebuild for stretch-backports.
   * Update build-dependencies to match stretch-backports repository
 .
 django-mailman3 (1.1.0-4) unstable; urgency=medium
 .
   [ Jonas Meurer ]
   * d/control:
     - Update Vcs-* fields to point to new repository on salsa.debian.org.
 .
   [ Pierre-Elliott Bécue ]
   * d/control:
     - Raise the dehbelper build-dependency minimal version to 11
   * d/compat:
     - Bump level to 11
   * d/copyright@Format: Use the https url instead of the http one
   * d/s/lintian-overrides: Override django-mailman3 source:
     python-foo-but-no-python3-foo python-django-mailman3 with comments.
   * Move django's static directory in /usr/share/python-django-mailman3
     directory.
Checksums-Sha1:
 4f0a8f9f263a13b61091f1cbe757a932636eed6b 1669 
django-mailman3_1.1.0-4~bpo9+1.dsc
 19ddb65147f3161ee133306826b54441881d832d 339268 
django-mailman3_1.1.0.orig.tar.gz
 91fe63cdd4996d18fa77fea7d510c1fc02d0ab93 801 
django-mailman3_1.1.0.orig.tar.gz.asc
 4085ec4db6fdda37e262eb0f2d5eb2e60044d313 6844 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 57a1febef50c8e3dc7999f35a6dfec1487914b78 6604 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo
Checksums-Sha256:
 245fa6258db6c2a3ea6b5ed4b6f072b0ab1bfbf85b160132e576caddfc9f5e67 1669 
django-mailman3_1.1.0-4~bpo9+1.dsc
 62f61edaedbee6c917b8da1464e4f32865cd2e6bc5f06ecbcdfe412edd9b4df6 339268 
django-mailman3_1.1.0.orig.tar.gz
 0c0ce8683314053c9d931bcf499202a94bd2195d6b147e390f74451523ec20f0 801 
django-mailman3_1.1.0.orig.tar.gz.asc
 c8aca7bf11c8c53eb97f8e496b83ccd691baaaad221c368188c970fe3387d1f0 6844 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 bf7179042fa5b27275e5688cab497573abb43b7e259d436d2d10922d7d0fc793 6604 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo
Files:
 0b5dd3a450f5f0867fa4864e2ccc4395 1669 python optional 
django-mailman3_1.1.0-4~bpo9+1.dsc
 94023459ceba2a036aea25394e9923d7 339268 python optional 
django-mailman3_1.1.0.orig.tar.gz
 bcdc62bd32c9e9840a26fef9936d7270 801 python optional 
django-mailman3_1.1.0.orig.tar.gz.asc
 8967e5e19f1e98181be7ceb9076feae4 6844 python optional 
django-mailman3_1.1.0-4~bpo9+1.debian.tar.xz
 b3173094c0545479c71426b6611a1413 6604 python optional 
django-mailman3_1.1.0-4~bpo9+1_amd64.buildinfo

I'm not sure this patch meets the standards of development in sbuild project
or in perl, as I'm quite rough with this language. Feel free to break it to
pieces and to make it look better!

Cheers,

-- 
Pierre-Elliott Bécue
GPG: 9AE0 4D98 6400 E3B6 7528  F493 0D44 2664 1949 74E2
It's far easier to fight for one's principles than to live up to them.
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 05ce6857..6d412cce 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -2253,7 +2253,6 @@ sub build {
 			  [$self->get_conf('BUILD_ARCH_ALL')]
 			  [$self->get_conf('BUILD_ARCH_ANY')];
     push (@{$buildcmd}, $binopt) if $binopt;
-    push (@{$buildcmd}, "-sa") if ($self->get_conf('BUILD_SOURCE') && $self->get_conf('FORCE_ORIG_SOURCE'));
     push (@{$buildcmd}, "-r" . $self->get_conf('FAKEROOT'));
 
     if (defined($self->get_conf('DPKG_BUILDPACKAGE_USER_OPTIONS')) &&
@@ -2563,6 +2562,10 @@ sub build {
 		    push (@{$genchangescmd}, $self->get_conf('SIGNING_OPTIONS'));
 		}
 	    }
+		my $changes_opts = $self->get_changes_opts();
+		if ($changes_opts) {
+		    push (@{$genchangescmd}, @{$changes_opts});
+		}
 	    my $cfile = $session->read_command(
 		{ COMMAND => $genchangescmd,
 		    USER => $self->get_conf('BUILD_USER'),
@@ -3354,4 +3357,28 @@ sub log_symlink {
     symlink $log, $dest;
 }
 
+sub get_changes_opts {
+    my $self = shift;
+    my @changes_opts = ();
+    foreach (@{$self->get_conf('DPKG_BUILDPACKAGE_USER_OPTIONS')}) {
+        if (/^--changes-option=(.*)$/) {
+            push @changes_opts, $1;
+        } elsif (/^-s[iad]$/) {
+            push @changes_opts, $_;
+        } elsif (/^--build=.*$/) {
+            push @changes_opts, $_;
+        } elsif (/^-m.*$/) {
+            push @changes_opts, $_;
+        } elsif (/^-e.*$/) {
+            push @changes_opts, $_;
+        } elsif (/^-v.*$/) {
+            push @changes_opts, $_;
+        } elsif (/^-C.*$/) {
+            push @changes_opts, $_;
+        }
+    }
+
+    return \@changes_opts;
+}
+
 1;
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index 849acfd5..e44af567 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -595,4 +595,15 @@ sub set_options {
 	);
 }
 
+=pod
+This function allows to extrapolate from the parsed and set options some
+expected behaviours.
+=cut
+sub extrapolate_options {
+    my $self = shift;
+
+    # This allows to pass -sa to all commands instead of passing it just to dpkg-buildpackage
+    push (@{$self->get_conf('DPKG_BUILDPACKAGE_USER_OPTIONS')}, "-sa") if ($self->get_conf('BUILD_SOURCE') && $self->get_conf('FORCE_ORIG_SOURCE'));
+}
+
 1;
diff --git a/lib/Sbuild/OptionsBase.pm b/lib/Sbuild/OptionsBase.pm
index 752ae7de..d9b801b2 100644
--- a/lib/Sbuild/OptionsBase.pm
+++ b/lib/Sbuild/OptionsBase.pm
@@ -68,6 +68,7 @@ sub new {
 	usage_error($program, "Error parsing command-line options");
 	return undef;
     }
+    $self->extrapolate_options();
     return $self;
 }
 
@@ -88,6 +89,10 @@ sub set_options () {
     my $self = shift;
 }
 
+sub extrapolate_options () {
+    my $self = shift;
+}
+
 sub parse_options {
     my $self = shift;
 

Attachment: signature.asc
Description: PGP signature

Reply via email to