[buildd-tools-devel] Bug#870260: [PATCH] sbuild-createchroot: add --command-prefix
Michael Stapelberg
stapelberg at debian.org
Mon Jul 31 11:51:14 UTC 2017
Package: sbuild
Version: 0.73.0-4
Severity: wishlist
Tags: patch
(Split out of #859867 as requested.)
Please consider merging the attached patch.
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armel, mipsel, arm64
Kernel: Linux 4.11.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE.UTF-8 (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.115
ii libsbuild-perl 0.73.0-4
ii perl 5.26.0-4
Versions of packages sbuild recommends:
ii autopkgtest 4.4
ii debootstrap 1.0.90
ii schroot 1.6.10-4
Versions of packages sbuild suggests:
ii deborphan 1.7.28.8-0.3+b1
ii kmod 24-1
ii wget 1.19.1-4
-- Configuration Files:
/etc/sbuild/sbuild.conf [Errno 2] No such file or directory: '/etc/sbuild/sbuild.conf'
-- no debconf information
-------------- next part --------------
>From 66942194595362efb7be9f2f574f094a171f5639 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelberg at debian.org>
Date: Mon, 31 Jul 2017 13:48:03 +0200
Subject: [PATCH] sbuild-createchroot: add --command-prefix
Successfully tested using:
% sudo ./bin/sbuild-createchroot --include=eatmydata \
--chroot-suffix=eatmydata --command-prefix=eatmydata \
stretch /srv/chroot/stretch-eatmydata-amd64-sbuild \
http://deb.debian.org/debian
% cd /tmp
% dget \
http://http.debian.net/debian/pool/main/f/freeradius/freeradius_3.0.12+dfsg-5.dsc
% cd freeradius-3.0.12+dfsg
% sbuild -d stretch -c stretch-amd64eatmydata
---
bin/sbuild-createchroot | 10 ++++++++++
man/sbuild-createchroot.8.in | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/bin/sbuild-createchroot b/bin/sbuild-createchroot
index 2d2bbe4a..1a5493e6 100755
--- a/bin/sbuild-createchroot
+++ b/bin/sbuild-createchroot
@@ -84,6 +84,9 @@ sub setup {
'EXTRA_REPOSITORIES' => {
DEFAULT => []
},
+ 'COMMAND_PREFIX' => {
+ DEFAULT => ''
+ },
);
$conf->set_allowed_keys(\%createchroot_keys);
@@ -160,6 +163,9 @@ sub set_options {
},
"extra-repository=s" => sub {
push @{$self->get_conf('EXTRA_REPOSITORIES')}, $_[1];
+ },
+ "command-prefix=s" => sub {
+ $self->set_conf('COMMAND_PREFIX', $_[1]);
});
}
@@ -386,6 +392,10 @@ if (scalar @{$conf->get('ALIASES')} > 0) {
$config_entry .= "aliases=$aliases\n";
}
+if ($conf->get('COMMAND_PREFIX') ne '') {
+ $config_entry .= "command-prefix=" . $conf->get('COMMAND_PREFIX') . "\n";
+}
+
if (-d "/etc/schroot/chroot.d") {
# TODO: Don't hardcode path
my $SCHROOT_CONF =
diff --git a/man/sbuild-createchroot.8.in b/man/sbuild-createchroot.8.in
index ee2ac898..dbc31c79 100644
--- a/man/sbuild-createchroot.8.in
+++ b/man/sbuild-createchroot.8.in
@@ -37,6 +37,7 @@ sbuild\-createchroot \- create sbuild chroot
.RB [ "\-\-no\-deb\-src" ]
.RB [ "\-\-alias=\fIalias\fP" ]
.RB [ \-\-extra\-repository=\fIspec\fP ]
+.RB [ "\-\-command\-prefix=\fIprefix\fP" ]
.B SUITE TARGET-DIRECTORY DEBIAN-MIRROR-URI
.RB [ SCRIPT ]
.PP
@@ -206,6 +207,13 @@ to allow packages in the experimental distribution to fulfill
build-dependencies. Note that the build chroot must already trust the key of
this repository. See the EXAMPLES section for how to combine this option with
--chroot-prefix and --alias.
+.TP
+.BR \-\-command\-prefix=\fIprefix\fP
+Set the chroot \fIcommand-prefix\fP option as specified. A common use-case is
+to specify eatmydata, thereby preventing all commands executed in the chroot
+from syncing data to disk. See
+.BR schroot.conf (5)
+for more details.
.SH TARBALL FILE
When creating an sbuild tarball \fIfile\fP, the compression format used to
generate the tarball depends on the entension used in \fIfile\fP. Here is a
--
2.13.2
More information about the Buildd-tools-devel
mailing list