[Reproducible-commits] [dpkg] 56/63: dpkg-buildpackage: always create a .buildinfo file

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Mar 4 17:44:46 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 8eb20538c962fbcf043bcba1964adaa2e6513f90
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 0d1b901..11285be 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -550,41 +550,36 @@ if (build_has(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