[buildd-tools-devel] Bug#778571: sbuild: predictible build location for reproducible builds

Vagrant Cascadian vagrant at debian.org
Mon Feb 16 20:37:00 UTC 2015


Package: sbuild
Version: 0.65.0-1
Severity: wishlist
Tags: patch

Thanks for maintaining sbuild!

In order to use sbuild for reproducible builds, the build dir needs to
be consistent across rebuilds, but sbuild currenty generates a
randomly named build dir.


The following proof-of-concept patch does this by setting the build
dir to /build/PACKAGE-VERSION rather than /build/PACKAGE-XXXXXX:

>From 15b77405a67faaea7bc3974a4e7a3862620d0b42 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant at debian.org>
Date: Fri, 13 Feb 2015 23:18:23 -0800
Subject: [PATCH 1/2] Make predictible build dir location based on the package
 version.

---
 lib/Sbuild/Build.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 155e4fc..5149a8a 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -396,8 +396,8 @@ sub run_chroot_session {
 	# TODO: Don't hack the build location in; add a means to customise
 	# the chroot directly.  i.e. allow changing of /build location.
 	$self->set('Chroot Build Dir',
-		   tempdir($self->get('Package') . '-XXXXXX',
-			   DIR =>  $session->get('Location') . "/build"));
+		   $session->get('Location') . "/build/" . $self->get('Package') . "-" . $self->get('Version'));
+	mkdir $self->get('Chroot Build Dir');
 
 	$self->set('Build Dir', $session->strip_chroot_path($self->get('Chroot Build Dir')));
 
-- 
2.1.4


This patch is really only a small step forward, making the build dir
consistent only when building with sbuild. Ideally, the build dir
should be set to /usr/src/debian/PACKAGE-VERSION (or some other widely
agreed upon dir) so that builds would be reproducible if built with
other tools such as pbuilder using the same build dir.

Making the build dir configurable might also help...


live well,
  vagrant

-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (500, 'testing'), (120, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages sbuild depends on:
ii  adduser         3.113+nmu3
ii  apt-utils       1.0.9.6
ii  libsbuild-perl  0.65.0-1
ii  perl            5.20.1-5
ii  perl-modules    5.20.1-5

Versions of packages sbuild recommends:
ii  debootstrap  1.0.66
ii  fakeroot     1.20.2-1

Versions of packages sbuild suggests:
pn  deborphan  <none>
ii  wget       1.16-1

-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/buildd-tools-devel/attachments/20150216/29321fa9/attachment.sig>


More information about the Buildd-tools-devel mailing list