Your message dated Sat, 17 Dec 2016 01:48:42 +0000
with message-id <[email protected]>
and subject line Bug#671074: fixed in dpkg 1.18.16
has caused the Debian Bug report #671074,
regarding dpkg-buildpackage: option for building multiple times in a row
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
671074: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=671074
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: dpkg-dev
Version: 1.16.3
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: dpkg-buildpackage

The attached patch adds option to build package multiple times in a row. This is useful for testing correctness of the clean target.

The patch looks noisy, because I had to indent a few dozen of lines; but other than that, it adds just a few lines.

If case you wonder why can't I just call dpkg-buildpackage in a loop: I can't if run it through a wrapper like sbuild or $VCS-buildpackage.

--
Jakub Wilk
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -68,6 +68,9 @@
 .IP \fB9.\fP 3
 If \fB\-tc\fP is specified, it will call \fBfakeroot debian/rules clean\fP
 again. Finally it calls \fBdpkg\-source \-\-after\-build\fP.
+.P
+If \fB\-l\fP\fIN\fP is specified, steps 1-9 are repeated \fIN\fP times, with
+the exception that steps 6 and 8 are only executed in the last iteration.
 .
 .SH OPTIONS
 .TP
@@ -90,6 +93,10 @@
 .B \-F
 Specifies a normal full build, binary and source packages will be built.
 This is the same as the default case when no build option is specified.
+.TP
+.BI \-l N
+Build the package \fIN\fP times in a row.  This is useful for testing the
+clean target.
 .P
 .BI \-\-target= target
 .br
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -73,6 +73,7 @@
   -A             binary-only, only arch-indep files. }
   -S             source only, no binary files.     }
   -F             normal full build (binaries and sources).
+  -l<n>          build <n> times in a row
   -t<system>     set GNU system type.           } passed to dpkg-architecture
   -v<version>    changes since version <version>.      }
   -m<maint>      maintainer for package is <maint>.    }
@@ -123,6 +124,7 @@
 my $targetarch = my $targetgnusystem = '';
 my $call_target = '';
 my $call_target_as_root = 0;
+my $nloops = 1;
 my (@checkbuilddep_opts, @changes_opts, @source_opts);
 
 use constant BUILD_DEFAULT    => 1;
@@ -229,6 +231,8 @@
 	!build_normal && usageerr(_g("cannot combine %s and %s"), $_, build_opt);
 	$include = BUILD_ALL;
 	@checkbuilddep_opts = ();
+    } elsif (/^-l(\d+)$/) {
+	$nloops = int($1);
     } elsif (/^-v(.*)$/) {
 	$since = $1;
     } elsif (/^-m(.*)$/) {
@@ -352,162 +356,172 @@
     chmod(0755, "debian/rules"); # No checks of failures, non fatal
 }
 
-unless ($call_target) {
+for my $iter (1 .. $nloops) {
+
+    unless ($call_target) {
+	chdir('..') or syserr('chdir ..');
+	withecho('dpkg-source', @source_opts, '--before-build', $dir);
+	chdir($dir) or syserr("chdir $dir");
+    }
+
+    if ($checkbuilddep) {
+	if ($admindir) {
+	    push @checkbuilddep_opts, "--admindir=$admindir";
+	}
+
+	system('dpkg-checkbuilddeps', @checkbuilddep_opts);
+	if (not WIFEXITED($?)) {
+	    subprocerr('dpkg-checkbuilddeps');
+	} elsif (WEXITSTATUS($?)) {
+	    warning(_g("Build dependencies/conflicts unsatisfied; aborting."));
+	    warning(_g("(Use -d flag to override.)"));
+
+	    if (build_sourceonly) {
+		warning(_g("This is currently a non-fatal warning with -S, but"));
+		warning(_g("will probably become fatal in the future."));
+	    } else {
+		exit 3;
+	    }
+	}
+    }
+
+    if ($call_target) {
+	if ($call_target_as_root or
+	    $call_target =~ /^(clean|binary(|-arch|-indep))$/)
+	{
+	    withecho(@rootcommand, @debian_rules, $call_target);
+	} else {
+	    withecho(@debian_rules, $call_target);
+	}
+	exit 0;
+    }
+
+    unless ($noclean) {
+	withecho(@rootcommand, @debian_rules, 'clean');
+    }
+    unless (build_binaryonly) {
+	warning(_g("it is a bad idea to generate a source package " .
+		   "without cleaning up first, it might contain undesired " .
+		   "files.")) if $noclean;
+	chdir('..') or syserr('chdir ..');
+	withecho('dpkg-source', @source_opts, '-b', $dir);
+	chdir($dir) or syserr("chdir $dir");
+    }
+
+    unless ($buildtarget eq "build" or scalar(@debian_rules) > 1) {
+	# Verify that build-{arch,indep} are supported. If not, fallback to build.
+	# This is a temporary measure to not break too many packages on a flag day.
+	my $pid = spawn(exec => [ "make", "-f", @debian_rules, "-qn", $buildtarget ],
+			from_file => "/dev/null", to_file => "/dev/null",
+			error_to_file => "/dev/null");
+	my $cmdline = "make -f @debian_rules -qn $buildtarget";
+	wait_child($pid, nocheck => 1, cmdline => $cmdline);
+	my $exitcode = WEXITSTATUS($?);
+	subprocerr($cmdline) unless WIFEXITED($?);
+	if ($exitcode == 2) {
+	    warning(_g("%s must be updated to support the 'build-arch' and " .
+		       "'build-indep' targets (at least '%s' seems to be " .
+		       "missing)"), "@debian_rules", $buildtarget);
+	    $buildtarget = "build";
+	}
+    }
+
+    unless (build_sourceonly) {
+	withecho(@debian_rules, $buildtarget);
+	withecho(@rootcommand, @debian_rules, $binarytarget);
+    }
+
+    my $signerrors;
+    if ($iter == $nloops) {
+	if ($usepause &&
+	    ($signchanges || (!build_binaryonly && $signsource))) {
+	    print _g("Press the return key to start signing process\n");
+	    getc();
+	}
+
+	unless (build_binaryonly) {
+	    if ($signsource && signfile("$pv.dsc")) {
+		$signerrors = _g("Failed to sign .dsc and .changes file");
+		$signchanges = 0;
+	    }
+	}
+    }
+
+    if (defined($maint)) { push @changes_opts, "-m$maint" }
+    if (defined($changedby)) { push @changes_opts, "-e$changedby" }
+    if (defined($since)) { push @changes_opts, "-v$since" }
+    if (defined($desc)) { push @changes_opts, "-C$desc" }
+
+    my $chg = "../$pva.changes";
+    print STDERR " dpkg-genchanges @changes_opts >$chg\n";
+    open CHANGES, '-|', 'dpkg-genchanges', @changes_opts
+	or subprocerr('dpkg-genchanges');
+
+    open OUT, '>', $chg or syserr(_g('write changes file'));
+
+    my $infiles = my $files = '';
+    while ($_ = <CHANGES>) {
+	print OUT $_ or syserr(_g('write changes file'));
+	chomp;
+
+	if (/^Files:/i) {
+	    $infiles = 1;
+	} elsif ($infiles && /^\s+(.*)$/) {
+	    $files .= " $1 ";
+	} elsif ($infiles && /^\S/) {
+	    $infiles = 0;
+	}
+    }
+
+    close CHANGES or subprocerr(_g('dpkg-genchanges'));
+    close OUT or syserr(_g('write changes file'));
+
+    my $srcmsg;
+    sub fileomitted($) { return $files !~ /$_[0]/ }
+    my $ext = $compression_re_file_ext;
+    if (fileomitted '\.deb') {
+	# source only upload
+	if (fileomitted "\.diff\.$ext" and fileomitted "\.debian\.tar\.$ext") {
+	    $srcmsg = _g('source only upload: Debian-native package');
+	} elsif (fileomitted "\.orig\.tar\.$ext") {
+	    $srcmsg = _g('source only, diff-only upload (original source NOT included)');
+	} else {
+	    $srcmsg = _g('source only upload (original source is included)');
+	}
+    } else {
+	$srcmsg = _g('full upload (original source is included)');
+	if (fileomitted '\.dsc') {
+	    $srcmsg = _g('binary only upload (no source included)');
+	} elsif (fileomitted "\.diff\.$ext" and fileomitted "\.debian\.tar\.$ext") {
+	    $srcmsg = _g('full upload; Debian-native package (full source is included)');
+	} elsif (fileomitted "\.orig\.tar\.$ext") {
+	    $srcmsg = _g('binary and diff upload (original source NOT included)');
+	} else {
+	    $srcmsg = _g('full upload (original source is included)');
+	}
+    }
+
+    if ($iter == $nloops) {
+	if ($signchanges && signfile("$pva.changes")) {
+	    $signerrors = _g("Failed to sign .changes file");
+	}
+    }
+
+    if ($cleansource) {
+	withecho(@rootcommand, @debian_rules, 'clean');
+    }
     chdir('..') or syserr('chdir ..');
-    withecho('dpkg-source', @source_opts, '--before-build', $dir);
+    withecho('dpkg-source', @source_opts, '--after-build', $dir);
     chdir($dir) or syserr("chdir $dir");
+
+    print "$progname: $srcmsg\n";
+    if ($signerrors) {
+	warning($signerrors);
+	exit 1;
+    }
+
 }
 
-if ($checkbuilddep) {
-    if ($admindir) {
-	push @checkbuilddep_opts, "--admindir=$admindir";
-    }
-
-    system('dpkg-checkbuilddeps', @checkbuilddep_opts);
-    if (not WIFEXITED($?)) {
-        subprocerr('dpkg-checkbuilddeps');
-    } elsif (WEXITSTATUS($?)) {
-	warning(_g("Build dependencies/conflicts unsatisfied; aborting."));
-	warning(_g("(Use -d flag to override.)"));
-
-	if (build_sourceonly) {
-	    warning(_g("This is currently a non-fatal warning with -S, but"));
-	    warning(_g("will probably become fatal in the future."));
-	} else {
-	    exit 3;
-	}
-    }
-}
-
-if ($call_target) {
-    if ($call_target_as_root or
-        $call_target =~ /^(clean|binary(|-arch|-indep))$/)
-    {
-        withecho(@rootcommand, @debian_rules, $call_target);
-    } else {
-        withecho(@debian_rules, $call_target);
-    }
-    exit 0;
-}
-
-unless ($noclean) {
-    withecho(@rootcommand, @debian_rules, 'clean');
-}
-unless (build_binaryonly) {
-    warning(_g("it is a bad idea to generate a source package " .
-               "without cleaning up first, it might contain undesired " .
-               "files.")) if $noclean;
-    chdir('..') or syserr('chdir ..');
-    withecho('dpkg-source', @source_opts, '-b', $dir);
-    chdir($dir) or syserr("chdir $dir");
-}
-
-unless ($buildtarget eq "build" or scalar(@debian_rules) > 1) {
-    # Verify that build-{arch,indep} are supported. If not, fallback to build.
-    # This is a temporary measure to not break too many packages on a flag day.
-    my $pid = spawn(exec => [ "make", "-f", @debian_rules, "-qn", $buildtarget ],
-                    from_file => "/dev/null", to_file => "/dev/null",
-                    error_to_file => "/dev/null");
-    my $cmdline = "make -f @debian_rules -qn $buildtarget";
-    wait_child($pid, nocheck => 1, cmdline => $cmdline);
-    my $exitcode = WEXITSTATUS($?);
-    subprocerr($cmdline) unless WIFEXITED($?);
-    if ($exitcode == 2) {
-        warning(_g("%s must be updated to support the 'build-arch' and " .
-                   "'build-indep' targets (at least '%s' seems to be " .
-                   "missing)"), "@debian_rules", $buildtarget);
-        $buildtarget = "build";
-    }
-}
-
-unless (build_sourceonly) {
-    withecho(@debian_rules, $buildtarget);
-    withecho(@rootcommand, @debian_rules, $binarytarget);
-}
-if ($usepause &&
-    ($signchanges || (!build_binaryonly && $signsource))) {
-    print _g("Press the return key to start signing process\n");
-    getc();
-}
-
-my $signerrors;
-unless (build_binaryonly) {
-    if ($signsource && signfile("$pv.dsc")) {
-	$signerrors = _g("Failed to sign .dsc and .changes file");
-	$signchanges = 0;
-    }
-}
-
-if (defined($maint)) { push @changes_opts, "-m$maint" }
-if (defined($changedby)) { push @changes_opts, "-e$changedby" }
-if (defined($since)) { push @changes_opts, "-v$since" }
-if (defined($desc)) { push @changes_opts, "-C$desc" }
-
-my $chg = "../$pva.changes";
-print STDERR " dpkg-genchanges @changes_opts >$chg\n";
-open CHANGES, '-|', 'dpkg-genchanges', @changes_opts
-    or subprocerr('dpkg-genchanges');
-
-open OUT, '>', $chg or syserr(_g('write changes file'));
-
-my $infiles = my $files = '';
-while ($_ = <CHANGES>) {
-    print OUT $_ or syserr(_g('write changes file'));
-    chomp;
-
-    if (/^Files:/i) {
-	$infiles = 1;
-    } elsif ($infiles && /^\s+(.*)$/) {
-	$files .= " $1 ";
-    } elsif ($infiles && /^\S/) {
-	$infiles = 0;
-    }
-}
-
-close CHANGES or subprocerr(_g('dpkg-genchanges'));
-close OUT or syserr(_g('write changes file'));
-
-my $srcmsg;
-sub fileomitted($) { return $files !~ /$_[0]/ }
-my $ext = $compression_re_file_ext;
-if (fileomitted '\.deb') {
-    # source only upload
-    if (fileomitted "\.diff\.$ext" and fileomitted "\.debian\.tar\.$ext") {
-	$srcmsg = _g('source only upload: Debian-native package');
-    } elsif (fileomitted "\.orig\.tar\.$ext") {
-	$srcmsg = _g('source only, diff-only upload (original source NOT included)');
-    } else {
-	$srcmsg = _g('source only upload (original source is included)');
-    }
-} else {
-    $srcmsg = _g('full upload (original source is included)');
-    if (fileomitted '\.dsc') {
-	$srcmsg = _g('binary only upload (no source included)');
-    } elsif (fileomitted "\.diff\.$ext" and fileomitted "\.debian\.tar\.$ext") {
-	$srcmsg = _g('full upload; Debian-native package (full source is included)');
-    } elsif (fileomitted "\.orig\.tar\.$ext") {
-	$srcmsg = _g('binary and diff upload (original source NOT included)');
-    } else {
-	$srcmsg = _g('full upload (original source is included)');
-    }
-}
-
-if ($signchanges && signfile("$pva.changes")) {
-    $signerrors = _g("Failed to sign .changes file");
-}
-
-if ($cleansource) {
-    withecho(@rootcommand, @debian_rules, 'clean');
-}
-chdir('..') or syserr('chdir ..');
-withecho('dpkg-source', @source_opts, '--after-build', $dir);
-chdir($dir) or syserr("chdir $dir");
-
-print "$progname: $srcmsg\n";
-if ($signerrors) {
-    warning($signerrors);
-    exit 1;
-}
 
 sub mustsetvar {
     my ($var, $text) = @_;

--- End Message ---
--- Begin Message ---
Source: dpkg
Source-Version: 1.18.16

We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Guillem Jover <[email protected]> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Sat, 17 Dec 2016 00:25:53 +0100
Source: dpkg
Binary: dpkg libdpkg-dev dpkg-dev libdpkg-perl dselect
Architecture: source
Version: 1.18.16
Distribution: unstable
Urgency: medium
Maintainer: Dpkg Developers <[email protected]>
Changed-By: Guillem Jover <[email protected]>
Description:
 dpkg       - Debian package management system
 dpkg-dev   - Debian package development tools
 dselect    - Debian package management front-end
 libdpkg-dev - Debian package management static library
 libdpkg-perl - Dpkg perl modules
Closes: 84434 671074 844701 844955 846395 846564 847220 848378 848379
Changes:
 dpkg (1.18.16) unstable; urgency=medium
 .
   [ Guillem Jover ]
   * Add support for specifying multiple targets on «dpkg-buildpackage -T»
     which will be run successively. Closes: #671074
   * Reject empty upstream versions in C and perl code. These are not permitted
     by deb-version(5), but the code was letting those through.
   * Use lzma_cputhreads() instead of sysconf(_SC_NPROCESSORS_ONLN) as the
     former is way more portable.
   * Automatically decrease xz encoder threads to try to not exceed available
     memory limits. This should alleviated the insane requirements of memory
     needed on 32-bit architectures with many cores, which results in more
     than the userspace addressable memory, when using settings such as
     -z9 and/or -Sextreme in dpkg-deb. Closes: #846564
   * Add new dpkg --validate-<thing> commands to validate the syntax of
     various <thing>s, where the current list is «pkgname», «trigname»,
     «archname» and «version».
   * Use the new dpkg --validate-version command in dpkg-maintscript-helper,
     instead of abusing the --compare-versions command to perform version
     validation. Closes: #844701
   * Allow readlink(2) to return a size smaller than stat(2) in dpkg. Some
     bogus filesystems do not return the actual symlink size in st_size,
     which contradicts POSIX. But allowing the case where the returned size
     is smaller than the one used to allocate memory is harmless, although
     suspect. Let it through, but still print a warning so that users can
     install stuff but are reminded they need to get a fixed filesystem in
     place. This has affected at least ecryptfs in the past and now
     file-based encryption support in ext4 on Android N.
   * Add new dpkg-query virtual field source:Upstream-Version. Closes: #84434
   * Perl modules:
     - Whitelist DPKG_GENSYMBOLS_CHECK_LEVEL, DPKG_ROOT, DPKG_ADMINDIR and
       DPKG_DATADIR environment variables in Dpkg::Build::Info.
   * Documentation:
     - State the current working directory used when running dpkg-buildpackage
       hooks.
     - Add a new ENVIRONMENT section to dpkg-gensymbols(1) and document
       DPKG_GENSYMBOLS_CHECK_LEVEL there.
     - Fix bogus description of --force-confmiss in dpkg(1). Regression
       introduced in 1.16.4. Reported by Sven Joachim <[email protected]>.
       Closes: #846395
     - Update dpkg-parsechangelog parser options. The options specific to
       the changelog parser program did not get updated when the parser got
       switched to be a perl module. Missed in dpkg 1.18.8.
   * Build system:
     - Enable compression libs also in automatic check mode in configure.
     - Honor DPKG_DATADIR again in the installed Dpkg modules. This was an
       explicit public interface, documented in the man page.
 .
   [ Updated programs translations ]
   * Dutch (Frans Spiesschaert). Closes: #848378
   * Simplified Chinese (Zhou Mo). Closes: #844955
 .
   [ Updated scripts translations ]
   * German (Helge Kreutzmann).
   * Swedish (Martin Bagge). Closes: #847220
 .
   [ Updated man pages translations ]
   * Dutch (Frans Spiesschaert). Closes: #848379
   * German (Helge Kreutzmann).
Checksums-Sha1:
 e3d512941f09fb28e30fe264698cdc8c349a6e6f 2032 dpkg_1.18.16.dsc
 238330ea73e8b545444e678c820dfe237632d1c5 4498872 dpkg_1.18.16.tar.xz
Checksums-Sha256:
 660dfc799aa67da75157ca6927d2a7c6c5818fe4042f5c6b2c499f3ac12a0259 2032 
dpkg_1.18.16.dsc
 4b147ccf8753e02e2bb598263b4a0ec51418d3c30da08776bad32059a7741388 4498872 
dpkg_1.18.16.tar.xz
Files:
 9142a5ec2c6d1317081b1528bcdb6feb 2032 admin required dpkg_1.18.16.dsc
 60de677bfe04d4ba8adaa22279363af0 4498872 admin required dpkg_1.18.16.tar.xz

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEETz509DYFDBD1aWV0uXK/PqSuV6MFAlhUl0YACgkQuXK/PqSu
V6NMNRAAnGwgOkqH1RhI1kCbE0g+9PbSFbL6WmqvF1tjP25SMnImE3Rubn5/5RLL
hPJvJWLNCNUqhtKzo+7eAP5vDZLIl+DWnzm1wouaHK+p5yZ32wg/W8NqjWvm4plx
cSncbOdWnNs1TjYtTo0IjCt44gQsxw0RhV3TGVivvTWDrZm52VR//AFjWEXnFquA
PSZ17NLfrnqEqaGE5IjnNQpc7UANzDXLRVwyVBNnOaOypV00UJWFVMDevXs3GwMK
qQhmSutIgPA9rX/V7U5PfvEXkX382P8INSQAFNGI/ezUTjo4iswgE/J5xlydprU3
RbOYHM3UwdifjPvxhUVmw/bhVZw57VJ5sSlXj/k4DIkxQnqZ9NbACCsIRizeP24S
GTI79uV7jH2PXAlSZb3ik5fBNVk6zBT27V3w4FtxPkvbn0PhNRb+ini1sOgvT1zT
kBFEmWLyPSaVIEuMLQoqbgPtfnIPZIRUIMsDu33jtvn+2L/Tgtvvv+N31Mw/zuc5
5ja5M8Hkpn9MnRXZyzTp3lZkXhwan5263GbEshEFAsTJPgssAhhrRzyKJWNMPY7x
wknFKq5020Ye0Imr7rGowVorHCa1JJJmgUp2pimGccwE3Al4NhgmndKkD7qf+tfb
IMyr+BdZYhRwNQYTTVmv6SkmhDsOtN+soDXNC6PakMmBWan3QWo=
=qoqy
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to