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=f42947d83c58014a53542711c0d179bf4a9bf2a5 commit f42947d83c58014a53542711c0d179bf4a9bf2a5 Author: Guillem Jover <[email protected]> AuthorDate: Sat Aug 21 18:41:08 2021 +0200 dpkg-buildpackage: Add new --buildinfo-file option This option is a counter-part to the newly introduced --changes-file, and makes the operation of dpkg-buildpackage more predictable. --- man/dpkg-buildpackage.pod | 4 ++++ scripts/dpkg-buildpackage.pl | 23 +++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/man/dpkg-buildpackage.pod b/man/dpkg-buildpackage.pod index 363aeeba1..170ba367b 100644 --- a/man/dpkg-buildpackage.pod +++ b/man/dpkg-buildpackage.pod @@ -480,6 +480,10 @@ The upstream version. =back +=item B<--buildinfo-file=>I<filename> + +Set the I<filename> for the generated B<.buildinfo> file (since dpkg 1.21.0). + =item B<--buildinfo-option=>I<opt> Pass option I<opt> to B<dpkg-genbuildinfo> (since dpkg 1.18.11). diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index 5d209a3b2..d8ca69814 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -99,6 +99,7 @@ sub usage { --hook-<name>=<command> set <command> as the hook <name>, known hooks: init preclean source build binary buildinfo changes postclean check sign done + --buildinfo-file=<file> set the .buildinfo filename to generate. --buildinfo-option=<opt> pass option <opt> to dpkg-genbuildinfo. --changes-file=<file> set the .changes filename to generate. @@ -181,6 +182,7 @@ my $since; my $maint; my $changedby; my $desc; +my $buildinfo_file; my @buildinfo_opts; my $changes_file; my @changes_opts; @@ -226,8 +228,18 @@ while (@ARGV) { $admindir = $1; } elsif (/^--source-option=(.*)$/) { push @source_opts, $1; + } elsif (/^--buildinfo-file=(.*)$/) { + $buildinfo_file = $1; + usageerr(g_('missing .buildinfo filename')) if not length $buildinfo_file; } elsif (/^--buildinfo-option=(.*)$/) { - push @buildinfo_opts, $1; + my $buildinfo_opt = $1; + if ($buildinfo_opt =~ m/^-O(.*)/) { + warning(g_('passing %s via %s is not supported; please use %s instead'), + '-O', '--buildinfo-option', '--buildinfo-file'); + $buildinfo_file = $1; + } else { + push @buildinfo_opts, $buildinfo_opt; + } } elsif (/^--changes-file=(.*)$/) { $changes_file = $1; usageerr(g_('missing .changes filename')) if not length $changes_file; @@ -597,8 +609,11 @@ if (build_has_any(BUILD_BINARY)) { run_hook('buildinfo', 1); +$buildinfo_file //= "../$pva.buildinfo"; + push @buildinfo_opts, "--build=$build_types" if build_has_none(BUILD_DEFAULT); push @buildinfo_opts, "--admindir=$admindir" if $admindir; +push @buildinfo_opts, "-O$buildinfo_file" if $buildinfo_file; run_cmd('dpkg-genbuildinfo', @buildinfo_opts); @@ -650,12 +665,12 @@ if ($signsource) { # Recompute the checksums as the .dsc has changed now. my $buildinfo = Dpkg::Control->new(type => CTRL_FILE_BUILDINFO); - $buildinfo->load("../$pva.buildinfo"); + $buildinfo->load($buildinfo_file); my $checksums = Dpkg::Checksums->new(); $checksums->add_from_control($buildinfo); $checksums->add_from_file("../$pv.dsc", update => 1, key => "$pv.dsc"); $checksums->export_to_control($buildinfo); - $buildinfo->save("../$pva.buildinfo"); + $buildinfo->save($buildinfo_file); } if ($signbuildinfo && signfile("$pva.buildinfo")) { error(g_('failed to sign %s file'), '.buildinfo'); @@ -666,7 +681,7 @@ if ($signsource or $signbuildinfo) { $checksums->add_from_control($changes); $checksums->add_from_file("../$pv.dsc", update => 1, key => "$pv.dsc") if $signsource; - $checksums->add_from_file("../$pva.buildinfo", update => 1, key => "$pva.buildinfo"); + $checksums->add_from_file($buildinfo_file, update => 1, key => "$pva.buildinfo"); $checksums->export_to_control($changes); delete $changes->{'Checksums-Md5'}; update_files_field($changes, $checksums, "$pv.dsc") -- Dpkg.Org's dpkg

