[Reproducible-commits] [dpkg] 30/37: dpkg-buildpackage: always create a .buildinfo file
Jérémy Bobbio
lunar at moszumanska.debian.org
Sun Jan 31 16:28:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit 83d85ce78df9a53fe8014dfcf8c0b73b674bfefc
Author: Jérémy Bobbio <lunar at debian.org>
Date: Sat Jan 30 14:00:13 2016 +0000
dpkg-buildpackage: always create a .buildinfo file
Let's create a .buildinfo file even when no .dsc is available, but
make dpkg-genbuildinfo print a warning related to verifiability.
---
scripts/dpkg-buildpackage.pl | 51 ++++++++++++++++++++------------------------
scripts/dpkg-genbuildinfo.pl | 10 ++++++---
2 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 75e895d..ddffd52 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -591,41 +591,36 @@ if ($include & BUILD_BINARY) {
run_hook('binary', 1);
withecho(@rootcommand, @debian_rules, $binarytarget);
- if (-e "../$pv.dsc") {
- run_hook('buildinfo', 1);
+ run_hook('buildinfo', 1);
- push @buildinfo_opts, "--admindir=$admindir" if $admindir;
+ push @buildinfo_opts, "--admindir=$admindir" if $admindir;
- open my $genbuildinfo_fh, '-|', 'dpkg-genbuildinfo', @buildinfo_opts
- or subprocerr('dpkg-genbuildinfo');
- my @buildinfo_content = <$genbuildinfo_fh>;
- close $genbuildinfo_fh;
+ open my $genbuildinfo_fh, '-|', 'dpkg-genbuildinfo', @buildinfo_opts
+ or subprocerr('dpkg-genbuildinfo');
+ my @buildinfo_content = <$genbuildinfo_fh>;
+ close $genbuildinfo_fh;
- if (!defined $buildinfo_identifier) {
- require Digest::MD5;
+ if (!defined $buildinfo_identifier) {
+ require Digest::MD5;
- my $timestamp = strftime('%Y%m%dT%H%M%Sz', gmtime());
- my $buildinfo_md5 = Digest::MD5::md5_hex(@buildinfo_content);
- $buildinfo_identifier = "$timestamp-" . substr($buildinfo_md5, 0, 8);
- }
-
- my $buildinfo = "${pv}_${buildinfo_identifier}.buildinfo";
+ my $timestamp = strftime('%Y%m%dT%H%M%Sz', gmtime());
+ my $buildinfo_md5 = Digest::MD5::md5_hex(@buildinfo_content);
+ $buildinfo_identifier = "$timestamp-" . substr($buildinfo_md5, 0, 8);
+ }
- open my $buildinfo_fh, ">../$buildinfo"
- or syserr(g_('cannot open %s', "../$buildinfo"));
- print $buildinfo_fh, @buildinfo_content;
- close $buildinfo_fh;
+ my $buildinfo = "${pv}_${buildinfo_identifier}.buildinfo";
- my $control = Dpkg::Control::Info->new('debian/control');
- my $sec = $control->get_source->{'Section'} // '-';
- my $pri = $control->get_source->{'Priority'} // '-';
- warning(g_('missing Section for source files')) if $sec eq '-';
- warning(g_('missing Priority for source files')) if $pri eq '-';
- withecho('dpkg-distaddfile', $buildinfo, $sec, $pri);
+ open my $buildinfo_fh, ">../$buildinfo"
+ or syserr(g_('cannot open %s', "../$buildinfo"));
+ print $buildinfo_fh, @buildinfo_content;
+ close $buildinfo_fh;
- } else {
- warning(g_('no .dsc file, skipping .buildinfo generation'));
- }
+ my $control = Dpkg::Control::Info->new('debian/control');
+ my $sec = $control->get_source->{'Section'} // '-';
+ my $pri = $control->get_source->{'Priority'} // '-';
+ warning(g_('missing Section for source files')) if $sec eq '-';
+ warning(g_('missing Priority for source files')) if $pri eq '-';
+ withecho('dpkg-distaddfile', $buildinfo, $sec, $pri);
}
run_hook('changes', 1);
diff --git a/scripts/dpkg-genbuildinfo.pl b/scripts/dpkg-genbuildinfo.pl
index 901b579..46c5d61 100755
--- a/scripts/dpkg-genbuildinfo.pl
+++ b/scripts/dpkg-genbuildinfo.pl
@@ -219,13 +219,17 @@ my $sourceversion = $changelog->{'Binary-Only'} ?
$prev_changelog->{'Version'} : $changelog->{'Version'};
my $binaryversion = $changelog->{'Version'};
-# include .dsc
+# include .dsc if available
my $spackage = $changelog->{'Source'};
(my $sversion = $sourceversion) =~ s/^\d+://;
my $dsc = "${spackage}_${sversion}.dsc";
my $dsc_pathname = "$uploadfilesdir/$dsc";
-my $dsc_fields = Dpkg::Control->new(type => CTRL_PKG_SRC);
-$checksums->add_from_file($dsc_pathname, key => $dsc);
+if ( -e $dsc_pathname) {
+ $checksums->add_from_file($dsc_pathname, key => $dsc);
+} else {
+ warning(g_('no .dsc file found: the resulting .buildinfo will not be ' .
+ 'usable to verify the provenance of the binaries.'));
+}
my $dist_count = 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list