[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Preliminary review of dpkg-genbuildinfo



Jérémy Bobbio <lunar@debian.org> (2015-04-27):
> Now this happened again on vim. The order of files in the .changes is
> not stable:
> https://reproducible.debian.net/dbd/unstable/amd64/vim_7.4.712-1.debbindiff.html
> 
> The full build log is available at:
> https://jenkins.debian.net/job/reproducible_builder_zeta/6733/consoleText
> 
> The build order in the log is identical though:
> dpkg-deb: building package 'pbuilder-satisfydepends-dummy' dpkg-deb: building package 'pbuilder-satisfydepends-dummy'
> dpkg-deb: building package 'vim-tiny'                      dpkg-deb: building package 'vim-tiny'
> dpkg-deb: building package 'vim-nox'                       dpkg-deb: building package 'vim-nox'
> dpkg-deb: building package 'vim-athena'                    dpkg-deb: building package 'vim-athena'
> dpkg-deb: building package 'vim-gtk'                       dpkg-deb: building package 'vim-gtk'
> dpkg-deb: building package 'vim-gnome'                     dpkg-deb: building package 'vim-gnome'
> dpkg-deb: building package 'vim-common'                    dpkg-deb: building package 'vim-common'
> dpkg-deb: building package 'vim'                           dpkg-deb: building package 'vim'
> dpkg-deb: building package 'vim-gui-common'                dpkg-deb: building package 'vim-gui-common'
> dpkg-deb: building package 'vim-runtime'                   dpkg-deb: building package 'vim-runtime'
> dpkg-deb: building package 'vim-doc'                       dpkg-deb: building package 'vim-doc'
> dpkg-deb: building package 'vim-lesstif'                   dpkg-deb: building package 'vim-lesstif'
> dpkg-deb: building package 'vim-dbg'                       dpkg-deb: building package 'vim-dbg'
> 
> Any idea why files in the .changes gets written in a different order?
> (the .buildinfo is fine)

(Please pretend I don't know anything about dpkg.)

After a quick greps it looks like scripts/dpkg-genchanges.pl seems to be
loading files from debian/files:

    if ($include & BUILD_BINARY) {
    …
        $dist_count = $dist->load($fileslistfile) if -e $fileslistfile;
    …
    }

with:

    my $fileslistfile = 'debian/files';

It then iterates over them:

    foreach my $file ($dist->get_files()) {
    …
    }

How's debian/files generated? Apparently not in a reproducible fashion:
scripts/dpkg-distaddfile.pl has indeed:

    # Obtain a lock on debian/control to avoid simultaneous updates
    # of debian/files when parallel building is in use

I'd therefore suggest adding a “sort” on the above mentioned line, see
attached, untested patch.

You may want to check the source part (the “if ($include &
BUILD_SOURCE)” block); there's a foreach on a (different) get_files you
might want to have a look at.


Mraw,
KiBi.
From c16ad71613a153fb850c926937584d77852855a2 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <kibi@debian.org>
Date: Mon, 27 Apr 2015 14:44:02 +0200
Subject: [PATCH] dpkg-genchanges: Improve reproducibility.

Under parallel builds, debian/files lines can get written in any order,
so sort the list of files to try and generate a reproducible changes
file.

Signed-off-by: Cyril Brulebois <kibi@debian.org>
---
 scripts/dpkg-genchanges.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 219ec1b..0b56915 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -332,7 +332,7 @@ if ($include & BUILD_BINARY) {
     error(g_('binary build with no binary artifacts found; cannot distribute'))
         if $dist_count == 0;
 
-    foreach my $file ($dist->get_files()) {
+    foreach my $file (sort $dist->get_files()) {
         if (defined $file->{package} && $file->{package_type} =~ m/^u?deb$/) {
             $p2f{$file->{package}} //= [];
             push @{$p2f{$file->{package}}}, $file->{filename};
-- 
2.1.4

Attachment: signature.asc
Description: Digital signature


Reply to: