Control: tags -1 + patch
Control: forwarded -1 https://salsa.debian.org/debian/sbuild/merge_requests/4

On Thu, 08 Nov 2018 at 13:27:59 +0000, Simon McVittie wrote:
> Some packages are misbuilt when built in a merged /usr chroot, for example
> quilt <https://bugs.debian.org/913226>. That's a bug in those packages
> (possibly a RC bug - I'm going to query that with the release team), but
> the conservative approach would be for sbuild-createchroot to avoid this
> class of bug in buildd-built packages by using traditional (unmerged /usr)
> chroots. It can do this by depending on debootstrap (>= 1.0.83) (which
> is in stretch but not jessie) and passing the --no-merged-usr option.

Please see https://salsa.debian.org/debian/sbuild/merge_requests/4 or
the attached. This is a patch for the `master` branch, so it doesn't
add the versioned dependency or a changelog entry.

It would also be possible to query the debootstrap version, either with
`debootstrap --version` or `dpkg-query -W debootstrap`, and only pass
these options for versions >= 1.0.83, if support for older debootstrap
is crucial.

Test results, in a current sid VM:

- system sbuild-createchroot, no option => no debootstrap option
- my sbuild-createchroot, no option => debootstrap --no-merged-usr
- my sbuild-createchroot, --no-merged-usr => debootstrap --no-merged-usr
- my sbuild-createchroot, --merged-usr => debootstrap --merged-usr
- my sbuild-createchroot, --auto-merged-usr => no debootstrap option

Thanks,
    smcv
>From 8d01b33d6010a5480a5d7340078df1b5f83e78fb Mon Sep 17 00:00:00 2001
From: Simon McVittie <[email protected]>
Date: Thu, 8 Nov 2018 18:57:03 +0000
Subject: [PATCH] sbuild-createchroot: Don't usrmerge even if it is the
 debootstrap default

Some packages are misbuilt in a merged /usr environment, for example
quilt (#913226) and previously systemd (#843433). For now, let's use
the safe option for buildd chroots.

Closes: #913228
---
 bin/sbuild-createchroot      | 16 ++++++++++++++++
 man/sbuild-createchroot.8.in | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 4d7e74d9..c55bf117 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -92,6 +92,9 @@ sub setup {
 	'CHROOT_MODE'				=> {
 	    DEFAULT => 'schroot'
 	},
+	'MERGED_USR'				=> {
+	    DEFAULT => 0
+	},
     );
 
     $conf->set_allowed_keys(\%createchroot_keys);
@@ -174,6 +177,15 @@ sub set_options {
 	},
         "command-prefix=s" => sub {
 	    $self->set_conf('COMMAND_PREFIX', $_[1]);
+	},
+	"merged-usr" => sub {
+	    $self->set_conf('MERGED_USR', 1)
+	},
+	"auto-merged-usr" => sub {
+	    $self->set_conf('MERGED_USR', 'auto')
+	},
+	"no-merged-usr" => sub {
+	    $self->set_conf('MERGED_USR', 0)
 	});
 }
 
@@ -309,6 +321,10 @@ push @args, "--keyring=" . $conf->get('KEYRING') if $conf->get('KEYRING');
 push @args, "--no-check-gpg" if defined $conf->get('KEYRING') && $conf->get('KEYRING') eq "";
 push @args, $conf->get('RESOLVE_DEPS') ?
     "--resolve-deps" : "--no-resolve-deps";
+if ($conf->get('MERGED_USR') ne 'auto') {
+	push @args, $conf->get('MERGED_USR') ?
+	    "--merged-usr" : "--no-merged-usr";
+}
 push @args, "$suite", "$target", "$mirror";
 push @args, "$script" if $script;
 
diff --git a/man/sbuild-createchroot.8.in b/man/sbuild-createchroot.8.in
index 94e5661c..5321983b 100644
--- a/man/sbuild-createchroot.8.in
+++ b/man/sbuild-createchroot.8.in
@@ -27,6 +27,7 @@ sbuild\-createchroot \- create sbuild chroot
 .RB [ \-\-chroot-mode=\fIschroot|sudo|unshare\fP ]
 .RB [ \-\-foreign ]
 .RB [ \-\-resolve-deps " \[or] " \-\-no-resolve-deps ]
+.RB [ \-\-merged-usr " \[or] " \-\-no-merged-usr " \[or] " \-\-auto-merged-usr ]
 .RB [ \-\-keep-debootstrap-dir ]
 .RB [ \-\-debootstrap=\fIdebootstrap\fP ]
 .RB [ "\-\-include=\fIpackage1[,package2,[packagen]]\fP" ]
@@ -161,6 +162,21 @@ Download signatures for retrieved \fIRelease\fP files and check them against
 \fIkeyring-file\fP.  By default \fI/etc/apt/trusted.gpg\fP is used.  Set to an
 empty string to disable signature checking.
 .TP
+.BR \-\-merged-usr
+Create a chroot in which \fI/bin\fP, \fI/sbin\fP and \fI/lib*\fP are
+symbolic links to their counterparts in \fI/usr\fP.
+.TP
+.BR \-\-no-merged-usr
+Create a chroot in which \fI/bin\fP, \fI/sbin\fP and \fI/lib*\fP are
+ordinary directories distinct from their counterparts in \fI/usr\fP.
+This is the default.
+.TP
+.BR \-\-auto-merged-usr
+Do not specify whether \fI/bin\fP, \fI/sbin\fP and \fI/lib*\fP are
+symbolic links to their counterparts in \fI/usr\fP. In this case
+debootstrap will use its default behaviour (which is suite-specific).
+This might become the default in a future version of sbuild-createchroot.
+.TP
 .B SUITE
 The distribution to bootstrap (e.g. \[oq]stretch[cq], \[oq]buster\[cq],
 \[oq]bullseye\[cq], \[oq]sid\[cq]).  A complete list may be found in
-- 
2.19.1

Reply via email to