[Reproducible-builds] [debhelper] 03/07: Add a new program, gen-buildinfo, which outputs a *.buildinfo file

Jérémy Bobbio lunar at moszumanska.debian.org
Sun Aug 31 03:46:51 UTC 2014


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository debhelper.

commit 1b575f057577b44b27838ad06bd824eb47201b70
Author: Niko Tyni <ntyni at debian.org>
Date:   Sat Aug 30 20:14:16 2014 -0700

    Add a new program, gen-buildinfo, which outputs a *.buildinfo file
    
    We outsource all the work to dpkg-genchanges and dh_buildinfo,
    shamelessly abusing them in the process.
    
    This is a proof of concept. The functionality should probably live in
    the dh-buildinfo package, but we're putting it in debhelper for now to
    reduce the number of patched packages needed by the "Debian Reproducible
    Builds" effort.
    
    To comply with the full specification in
     https://wiki.debian.org/ReproducibleBuilds#Recording_the_environment
    dh_buildinfo still needs to learn to include architecture specifications
    in its package list. This script should need no changes when that is
    implemented.
---
 gen-buildinfo | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gen-buildinfo b/gen-buildinfo
new file mode 100755
index 0000000..c595ab2
--- /dev/null
+++ b/gen-buildinfo
@@ -0,0 +1,53 @@
+#!/usr/bin/perl -w
+# Output a *.buildinfo file from dpkg-genchanges and dh_buildinfo output
+# https://wiki.debian.org/ReproducibleBuilds#Recording_the_environment
+#
+# Copyright © 2014 Niko Tyni <ntyni at debian.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+use strict;
+
+my %changes;
+
+my $key;
+for (qx{dpkg-genchanges 2>/dev/null}) {
+    chomp;
+    /^\s+(\S+)/ and $changes{$key} .= "$_\n", next;
+    /^(.+?):\s*(.*)/ and $changes{$key=$1} = "$2\n";
+}
+
+print "$_: $changes{$_}" for (qw(Format Source Version Binary Architecture));
+
+my $arch = qx/dpkg-architecture -qDEB_BUILD_ARCH/;
+print "Build-Architecture: $arch";
+
+print "$_: $changes{$_}" for (qw(Checksums-Sha256));
+
+open(I, "dh_buildinfo generate cat |")
+    or die("exec dh_buildinfo failed: $!");
+
+print "Build-Environment:\n";
+my @out;
+my %dups;
+while (<I>) {
+    next if /^\s/;
+    chomp;
+    my ($pkg, $version) = split;
+    push @out, " $pkg (= $version)" if !$dups{"${pkg}_$version"}++
+}
+close I
+    or die("dh_buildinfo exited with nonzero status");
+print join(",\n", sort @out);
+print "\n";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debhelper.git



More information about the Reproducible-builds mailing list