Merge lp:~stefanor/ubuntu-dev-tools/mk-sbuild-love into lp:~ubuntu-dev/ubuntu-dev-tools/trunk

Proposed by Stefano Rivera
Status: Merged
Merged at revision: 1075
Proposed branch: lp:~stefanor/ubuntu-dev-tools/mk-sbuild-love
Merge into: lp:~ubuntu-dev/ubuntu-dev-tools/trunk
Diff against target: 608 lines (+260/-151)
4 files modified
debian/changelog (+16/-0)
doc/mk-sbuild.1 (+76/-68)
mk-sbuild (+168/-82)
ubuntutools/test/test_help.py (+0/-1)
To merge this branch: bzr merge lp:~stefanor/ubuntu-dev-tools/mk-sbuild-love
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Review via email: mp+58915@code.launchpad.net

Description of the change

Benjamin: r1084 indicates that debian-distro-info could be more helpful wrt release synonyms.

To post a comment you must log in.
Revision history for this message
Chris Halse Rogers (raof) wrote :

I'd have preferred to have fewer logically independent changes in this merge - one feature per merge request is really nice :).

That said, these appear to me to be good changes, and I've merged them.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-04-23 11:52:28 +0000
3+++ debian/changelog 2011-04-24 20:00:57 +0000
4@@ -1,3 +1,19 @@
5+ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
6+
7+ * mk-sbuild:
8+ - Disable daemons with a policy-rc.d script (like pbuilder does)
9+ - Move package installation after option parsing.
10+ - Exit 0 when showing help, and support -h.
11+ - Determine distribution from release name (via distro-info).
12+ - Reformat manpage.
13+ - Install qemu-user-static instead of qemu-kvm-extras-static.
14+ - Put schroot configuration in chroot.d/sbuild-$chroot (LP: #736808)
15+ - Understand Debian distribution synonyms, and store the chroot under the
16+ code name.
17+ - Support Debian experimental.
18+
19+ -- Stefano Rivera <stefanor@debian.org> Sun, 24 Apr 2011 20:35:51 +0200
20+
21 ubuntu-dev-tools (0.122) unstable; urgency=low
22
23 [ Ted Gould ]
24
25=== modified file 'doc/mk-sbuild.1'
26--- doc/mk-sbuild.1 2010-12-02 23:06:43 +0000
27+++ doc/mk-sbuild.1 2011-04-24 20:00:57 +0000
28@@ -4,10 +4,7 @@
29 mk\-sbuild \- creates chroots via schroot and sbuild
30
31 .SH SYNOPSIS
32-\fBmk\-sbuild\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR]
33-[\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR]
34-[\fB\-\-debootstrap\-mirror=URL\fR] [\fB\-\-distro=DISTRO\fR]
35-[\fB\-\-vg=VOLUME_GROUP\fR] [\fB\-\-type=SCHROOT_TYPE\fR] <\fBRelease\fR>
36+\fBmk\-sbuild\fR [\fIoptions\fR...] <\fIrelease\fR>
37
38 .SH DESCRIPTION
39 \fBmk\-sbuild\fR creates chroots via schroot and sbuild.
40@@ -15,49 +12,54 @@
41 .SH OPTIONS
42 Listed below are the command line options for mk\-sbuild:
43 .TP
44-.B \-\-arch=ARCH
45+.B \-\-arch\fR=\fIARCH
46 What architecture to select (defaults to the native architecture).
47 .TP
48-.B \-\-name=NAME
49+.B \-\-name\fR=\fINAME
50 Base name for the schroot (arch is appended).
51 .TP
52-.B \-\-personality=PERSONALITY
53-What personality to use (defaults to match \-\-arch).
54+.B \-\-personality\fR=\fIPERSONALITY
55+What personality to use (defaults to match \fB\-\-arch\fR).
56 .TP
57 .B \-\-debug
58 Turn on script debugging.
59 .TP
60 .B \-\-skip\-updates
61-Do not include the \-updates pocket in the installed sources.list.
62-.TP
63-.B \-\-source\-template=FILE
64-Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild.sources).
65-.TP
66-.B \-\-debootstrap\-mirror=URL
67-Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
68-official Ubuntu repositories for the supported architectures).
69-.TP
70-.B \-\-debootstrap\-include=alpha,beta
71-Pass along a comma separated list of packages to debootstrap's \-\-include
72-argument. See debootstrap (8) for more details.
73-.TP
74-.B \-\-debootstrap\-exclude=alpha,beta
75-Pass along a comma separated list of packages to debootstrap's \-\-exclude
76-argument. WARNING: be careful using this option as you can end up
77-excluding essential package. See debootstrap (8) for more details.
78-.TP
79-.B \-\-distro=DISTRO
80-Enable distro-specific logic. Currently known distros: "ubuntu" (default)
81-and "debian".
82-.TP
83-.B \-\-vg=VOLUME_GROUP
84-Specify a volume group, and subsequently use a default SCHROOT_TYPE of
85-"lvm-snapshot" rather than "directory" (via aufs) mounts.
86-.TP
87-.B \-\-type=SHROOT_TYPE
88-Specify a SCHROOT_TYPE. Supported values are "directory" (default if
89-\-\-vg not specified), "lvm-snapshot" (default if \-\-vg specified),
90-"btrfs-snapshot", and "file".
91+Do not include the \fB\-updates\fR pocket in the installed
92+\fBsources.list\fR.
93+.TP
94+.B \-\-source\-template\fR=\fIFILE
95+Use \fIFILE\fR as the \fBsources.list\fR template (defaults to
96+\fI$HOME\fB/.mk\-sbuild.sources\fR).
97+.TP
98+.B \-\-debootstrap\-mirror\fR=\fIURL
99+Use \fIURL\fR as the debootstrap source (defaults to
100+\fBhttp://ports.ubuntu.com\fR where appropriate, official Ubuntu
101+repositories for the supported architectures).
102+.TP
103+.B \-\-debootstrap\-include\fR=\fIalpha,beta
104+Pass along a comma separated list of packages to debootstrap's
105+\fB\-\-include\fR argument. See \fBdebootstrap\fR (8) for more details.
106+.TP
107+.B \-\-debootstrap\-exclude\fR=\fIalpha,beta
108+Pass along a comma separated list of packages to debootstrap's
109+\fB\-\-exclude\fR argument.
110+\fBWARNING:\fR be careful using this option as you can end up
111+excluding essential package. See \fBdebootstrap \fR(8) for more details.
112+.TP
113+.B \-\-distro\fR=\fIDISTRO
114+Enable distro-specific logic.
115+When not provided, the distribution is determined from \fIrelease\fR.
116+Currently known distros: "\fBdebian\fR" and "\fBubuntu\fR".
117+.TP
118+.B \-\-vg\fR=\fIVOLUME_GROUP
119+Specify a volume group, and subsequently use a default \fBSCHROOT_TYPE\fR of
120+"\fBlvm-snapshot\fR" rather than "\fBdirectory\fR" (via aufs) mounts.
121+.TP
122+.B \-\-type\fR=\fISHROOT_TYPE
123+Specify a \fBSCHROOT_TYPE\fR. Supported values are "\fBdirectory\fR"
124+(default if \fB\-\-vg\fR not specified), "\fBlvm-snapshot\fR" (default
125+if \fB\-\-vg\fR specified), "\fBbtrfs-snapshot\fR", and "\fBfile\fR".
126
127 .SH ENVIRONMENT VARIABLES
128 .TP
129@@ -71,61 +73,67 @@
130 Lines to append to schroot entries.
131 .TP
132 .B SKIP_UPDATES
133-Do not include the \-updates pocket in the installed sources.list.
134+Do not include the \fB\-updates\fR pocket (same as
135+\fB\-\-skip\-updates\fR)
136 .TP
137 .B DEBOOTSTRAP_MIRROR
138-Mirror location (same as \-\-debootstrap-mirror)
139+Mirror location (same as \fB\-\-debootstrap-mirror\fR)
140 .TP
141 .B DEBOOTSTRAP_INCLUDE
142-Comma separated list of packages to include when bootstrapping (same as \-\-debootstrap-include)
143+Comma separated list of packages to include when bootstrapping (same as
144+\fB\-\-debootstrap-include\fR)
145 .TP
146 .B DEBOOTSTRAP_EXCLUDE
147-Comma separated list of packages to exclude when bootstrapping (same as \-\-debootstrap-exclude; see warning above)
148+Comma separated list of packages to exclude when bootstrapping (same as
149+\fB\-\-debootstrap-exclude\fR; see warning above)
150 .TP
151 .B SOURCE_CHROOTS_DIR
152-use SOURCE_CHROOTS_DIR as home of schroot source directories. (default
153-/var/lib/schroot/chroots)
154+Use \fBSOURCE_CHROOTS_DIR\fR as home of schroot source directories.
155+(default \fB/var/lib/schroot/chroots\fR)
156 .TP
157 .B SOURCE_CHROOTS_TGZ
158-use SOURCE_CHROOTS_TGZ as home of schroot source tarballs. (default
159-/var/lib/schroot/tarballs)
160+Use \fBSOURCE_CHROOTS_TGZ\fR as home of schroot source tarballs.
161+(default \fB/var/lib/schroot/tarballs\fR)
162 .TP
163 .B CHROOT_SNAPSHOT_DIR
164-use CHROOT_SNAPSHOT_DIR as home of mounted btrfs snapshots (default
165-/var/lib/schroot/snapshots)
166+Use \fBCHROOT_SNAPSHOT_DIR\fR as home of mounted btrfs snapshots.
167+(default \fB/var/lib/schroot/snapshots\fR)
168
169
170 .SH FILES
171 .TP
172-.B $HOME/.mk\-sbuild.rc
173+.IB $HOME /.mk\-sbuild.rc
174 Sourced for environment variables (defined above).
175 .TP
176-.B $HOME/.mk\-sbuild.sources[.$DISTRO]
177-Can contain a customized sources.list.
178+.IB $HOME /.mk\-sbuild.sources\fR[\fB. $DISTRO\fR]
179+Can contain a customized \fBsources.list\fR.
180 It will be read when creating the schroot.
181-If a file with ".ubuntu" or ".debian" is found (based on the \-\-distro
182-argument) that file will use used instead.
183-See sources.list(5) for more details on the format.
184+If a file with "\fB.ubuntu\fR" or "\fB.debian\fR" is found (as
185+appropriate) it will use used instead.
186+See \fBsources.list\fR (5) for more details on the format.
187 .TP
188-.B $HOME/.mk\-sbuild.schroot.conf[.$SCHROOT_TYPE]
189+.IB $HOME /.mk\-sbuild.schroot.conf\fR[\fB. $SCHROOT_TYPE\fR]
190 Can contain a customized configuration section to be inserted into
191-/etc/schroot/schroot.conf.
192-If a file with ".lvm-snapshot", ".directory", or ".file" is found (based on the
193-values of the \-\-vg and \-\-type arguments) that file will use used instead.
194-See schroot.conf(5) for more details on the format.
195+\fB/etc/schroot/schroot.conf\fR.
196+If a file with "\fB.lvm-snapshot\fR", "\fB.directory\fR", "\fB.file\fR",
197+or "\fBbtrf-snapshot\fR" is found (as appropriate) that file will use used instead.
198+See \fBschroot.conf\fR (5) for more details on the format.
199 .SH USING THE CHROOTS
200 .TP
201-To CHANGE the golden image: \fBsudo schroot \-c ${CHROOT_NAME}\-source \-u root\fR
202-.TP
203-To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR
204-.TP
205-To BUILD within a snapshot: \fBsbuild \-A \-d ${SCHROOT_NAME} PACKAGE*.dsc\fR
206-.TP
207-for example, to update the packages in a golden image: \fBschroot \-c ${CHROOT_NAME}\-source \-u root -- sh \-c "apt-get \-qq update && apt-get \-qy upgrade && apt-get clean" </dev/null\fR
208+To CHANGE the golden image: \fBsudo schroot \-c \fI${SCHROOT_NAME}\fB\-source \-u root\fR
209+.TP
210+To ENTER an image snapshot: \fBschroot \-c \fI$SCHROOT_NAME\fR
211+.TP
212+To BUILD within a snapshot: \fBsbuild \-A \-d \fI$SCHROOT_NAME $PACKAGE\fB*.dsc\fR
213+.TP
214+for example, to update the packages in a \fBsid\-amd64\fR golden image:
215+\fBschroot \-c sid\-amd64\-source \-u root -- sh \-c "apt-get \-qq update && apt-get \-qy upgrade && apt-get clean" </dev/null\fR
216
217 .SH SEE ALSO
218-sbuild\-setup (7), sources.list (5), schroot.conf (5),
219-https://help.ubuntu.com/community/SbuildLVMHowto
220+.BR sbuild\-setup (7),
221+.BR sources.list (5),
222+.BR schroot.conf (5),
223+.B https://help.ubuntu.com/community/SbuildLVMHowto
224
225 .SH AUTHOR
226 \fBmk\-sbuild\fR was written by Kees Cook <kees@ubuntu.com>.
227
228=== modified file 'mk-sbuild'
229--- mk-sbuild 2011-02-09 00:00:57 +0000
230+++ mk-sbuild 2011-04-24 20:00:57 +0000
231@@ -5,6 +5,7 @@
232 # Kees Cook <kees@ubuntu.com>
233 # Emmet Hikory <persia@ubuntu.com>
234 # Scott Moser <smoser@ubuntu.com>
235+# Stefano Rivera <stefanor@ubuntu.com>
236 #
237 # ##################################################################
238 #
239@@ -30,70 +31,6 @@
240 # It will deal with sbuild having not be installed and configured before.
241 set -e
242
243-# For when schroot enters the chroot, we cannot be in a directory that
244-# will not exist in the chroot.
245-cd /
246-
247-# Make sure we've got a regular user
248-if [ -w /etc/passwd ]; then
249- echo "Please run this script as a regular user, not root." >&2
250- exit 1
251-fi
252-
253-# Perform once-only things to initially set up for using sbuild+schroot
254-if [ ! -w /var/lib/sbuild ]; then
255- # Load all the packages you'll need to do work
256- sudo apt-get install sbuild schroot debootstrap
257- # Add self to the sbuild group
258- sudo adduser "$USER" sbuild
259-
260- # Prepare a usable default .sbuildrc
261- if [ ! -e ~/.sbuildrc ]; then
262- cat > ~/.sbuildrc <<EOM
263-# *** VERIFY AND UPDATE \$mailto and \$maintainer_name BELOW ***
264-
265-# Mail address where logs are sent to (mandatory, no default!)
266-\$mailto = '$USER';
267-
268-# Name to use as override in .changes files for the Maintainer: field
269-# (mandatory, no default!).
270-\$maintainer_name='$USER <$USER@localhost>';
271-
272-# Directory for chroot symlinks and sbuild logs. Defaults to the
273-# current directory if unspecified.
274-#\$build_dir='$HOME/ubuntu/build';
275-
276-# Directory for writing build logs to
277-\$log_dir="$HOME/ubuntu/logs";
278-
279-# don't remove this, Perl needs it:
280-1;
281-EOM
282- sensible-editor ~/.sbuildrc
283- # Create target directories, if needed
284- eval $(egrep '^\$(build|log)_dir[ ]*=' ~/.sbuildrc | cut -c2-)
285- if [ -n "$log_dir" ]; then
286- mkdir -p "$log_dir"
287- fi
288- if [ -n "$build_dir" ]; then
289- mkdir -p "$build_dir"
290- fi
291- else
292- echo "Your ~/.sbuildrc already exists -- leaving it as-is."
293- fi
294-
295- echo '***********************************************'
296- echo '* Before continuing, you MUST restart your *'
297- echo '* session to gain "sbuild" group permissions! *'
298- echo '***********************************************'
299- exit 0
300-fi
301-
302-if ! id | fgrep -q '(sbuild)'; then
303- echo "You must be a member of the 'sbuild' group." >&2
304- exit 1
305-fi
306-
307 # Set up configurable defaults (loaded after option processing)
308 LV_SIZE="5G"
309 SNAPSHOT_SIZE="4G"
310@@ -116,7 +53,8 @@
311 echo " --debootstrap-include=list Comma separated list of packages to include"
312 echo " --debootstrap-exclude=list Comma separated list of packages to exclude"
313 echo " --distro=DISTRO Install specific distro:"
314- echo " 'ubuntu'(default), or 'debian'"
315+ echo " 'ubuntu' or 'debian' "
316+ echo " (defaults to determining from release name)"
317 echo " --type=SCHROOT_TYPE Define the schroot type:"
318 echo " 'directory'(default), 'file', or 'btrfs-snapshot'"
319 echo " 'lvm-snapshot' is selected via --vg"
320@@ -134,18 +72,21 @@
321 echo " DEBOOTSTRAP_EXCLUDE Excluded packages (same as --debootstrap-exclude)"
322 echo " TEMPLATE_SOURCES A template for sources.list"
323 echo " TEMPLATE_SCHROOTCONF A template for schroot.conf stanza"
324- exit 1
325+ if [ -z "$1" ]; then
326+ exit 1
327+ fi
328+ exit $1
329 }
330
331
332 if [ -z "$1" ]; then
333 usage
334 fi
335-OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"`
336+OPTS=`getopt -o 'h' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"`
337 eval set -- "$OPTS"
338
339 VG=""
340-DISTRO="ubuntu"
341+DISTRO=""
342 name=""
343 while :; do
344 case "$1" in
345@@ -209,21 +150,130 @@
346 shift
347 break
348 ;;
349- --help|*)
350- usage
351+ -h|--help|*)
352+ usage 0
353 ;;
354 esac
355 done
356
357+# For when schroot enters the chroot, we cannot be in a directory that
358+# will not exist in the chroot.
359+cd /
360+
361+# Make sure we've got a regular user
362+if [ -w /etc/passwd ]; then
363+ echo "Please run this script as a regular user, not root." >&2
364+ exit 1
365+fi
366+
367+# Perform once-only things to initially set up for using sbuild+schroot
368+if [ ! -w /var/lib/sbuild ]; then
369+ # Load all the packages you'll need to do work
370+ sudo apt-get install sbuild schroot debootstrap
371+ # Add self to the sbuild group
372+ sudo adduser "$USER" sbuild
373+
374+ # Prepare a usable default .sbuildrc
375+ if [ ! -e ~/.sbuildrc ]; then
376+ cat > ~/.sbuildrc <<EOM
377+# *** VERIFY AND UPDATE \$mailto and \$maintainer_name BELOW ***
378+
379+# Mail address where logs are sent to (mandatory, no default!)
380+\$mailto = '$USER';
381+
382+# Name to use as override in .changes files for the Maintainer: field
383+# (mandatory, no default!).
384+\$maintainer_name='$USER <$USER@localhost>';
385+
386+# Directory for chroot symlinks and sbuild logs. Defaults to the
387+# current directory if unspecified.
388+#\$build_dir='$HOME/ubuntu/build';
389+
390+# Directory for writing build logs to
391+\$log_dir="$HOME/ubuntu/logs";
392+
393+# don't remove this, Perl needs it:
394+1;
395+EOM
396+ sensible-editor ~/.sbuildrc
397+ # Create target directories, if needed
398+ eval $(egrep '^\$(build|log)_dir[ ]*=' ~/.sbuildrc | cut -c2-)
399+ if [ -n "$log_dir" ]; then
400+ mkdir -p "$log_dir"
401+ fi
402+ if [ -n "$build_dir" ]; then
403+ mkdir -p "$build_dir"
404+ fi
405+ else
406+ echo "Your ~/.sbuildrc already exists -- leaving it as-is."
407+ fi
408+
409+ echo '***********************************************'
410+ echo '* Before continuing, you MUST restart your *'
411+ echo '* session to gain "sbuild" group permissions! *'
412+ echo '***********************************************'
413+ exit 0
414+fi
415+
416+if ! id | fgrep -q '(sbuild)'; then
417+ echo "You must be a member of the 'sbuild' group." >&2
418+ exit 1
419+fi
420+
421 # To build the chroot, we need to know which release of Ubuntu to debootstrap
422 RELEASE="$1"
423 if [ -z "$RELEASE" ]; then
424 usage
425 fi
426
427+# Determine distribution and possible synonyms
428+synonym=""
429+EXPERIMENTAL=0
430+if debian-distro-info --all | grep -Fqx "$RELEASE"; then
431+ DISTRO="${DISTRO:-debian}"
432+ if [ "$RELEASE" = $(debian-distro-info --devel) ]; then
433+ synonym=unstable
434+ elif [ "$RELEASE" = $(debian-distro-info --testing) ]; then
435+ synonym=testing
436+ elif [ "$RELEASE" = $(debian-distro-info --stable) ]; then
437+ synonym=stable
438+ elif [ "$RELEASE" = $(debian-distro-info --old) ]; then
439+ synonym=oldstable
440+ fi
441+elif ubuntu-distro-info --all | grep -Fqx "$RELEASE"; then
442+ DISTRO="${DISTRO:-ubuntu}"
443+elif [ "$RELEASE" = "unstable" ]; then
444+ DISTRO="${DISTRO:-debian}"
445+ synonym="$RELEASE"
446+ RELEASE=$(debian-distro-info --devel)
447+elif [ "$RELEASE" = "testing" ]; then
448+ DISTRO="${DISTRO:-debian}"
449+ synonym="$RELEASE"
450+ RELEASE=$(debian-distro-info --testing)
451+elif [ "$RELEASE" = "stable" ]; then
452+ DISTRO="${DISTRO:-debian}"
453+ synonym="$RELEASE"
454+ RELEASE=$(debian-distro-info --stable)
455+elif [ "$RELEASE" = "oldstable" ]; then
456+ DISTRO="${DISTRO:-debian}"
457+ synonym="$RELEASE"
458+ RELEASE=$(debian-distro-info --old)
459+elif [ "$RELEASE" = "experimental" ]; then
460+ DISTRO="${DISTRO:-debian}"
461+ EXPERIMENTAL=1
462+ name="${name:-experimental}"
463+ RELEASE=$(debian-distro-info --devel)
464+elif [ -z "$DISTRO" ]; then
465+ echo "Unable to determine distribution, please provide --distro" >&2
466+ exit 1
467+fi
468+
469 # By default, name the schroot the same as the release
470 if [ -z "$name" ]; then
471 name="$RELEASE"
472+else
473+ # Disable synonym when a custom name is used:
474+ synonym=""
475 fi
476
477 # By default, use the native architecture.
478@@ -234,6 +284,12 @@
479
480 CHROOT_NAME="${name}-${CHROOT_ARCH}"
481
482+if [ -z "$synonym" ]; then
483+ CHROOT_SYNONYM=""
484+else
485+ CHROOT_SYNONYM="${synonym}-${CHROOT_ARCH}"
486+fi
487+
488 # Load customizations
489 if [ -r ~/.mk-sbuild.rc ]; then
490 . ~/.mk-sbuild.rc
491@@ -287,10 +343,10 @@
492 ;;
493 "btrfs-snapshot")
494 if [ ! -d "${SOURCE_CHROOTS_DIR}" ]; then
495- sudo mkdir -p "${SOURCE_CHROOTS_DIR}"
496+ sudo mkdir -p "${SOURCE_CHROOTS_DIR}"
497 fi
498 if [ ! -d "${CHROOT_SNAPSHOT_DIR}" ]; then
499- sudo mkdir -p "${CHROOT_SNAPSHOT_DIR}"
500+ sudo mkdir -p "${CHROOT_SNAPSHOT_DIR}"
501 fi
502 CHROOT_PATH="${SOURCE_CHROOTS_DIR}/${CHROOT_NAME}"
503 ;;
504@@ -406,7 +462,7 @@
505 *)
506 DEBOOTSTRAP_COMMAND=qemu-debootstrap
507 if ! which "$DEBOOTSTRAP_COMMAND"; then
508- sudo apt-get install qemu-kvm-extras-static
509+ sudo apt-get install qemu-user-static
510 fi
511 ;;
512 esac
513@@ -460,6 +516,12 @@
514 deb ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
515 deb-src ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
516 EOM
517+ if [ "$EXPERIMENTAL" -eq 1 ]; then
518+ cat >> "$TEMP_SOURCES" <<EOM
519+deb ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
520+deb-src ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
521+EOM
522+ fi
523 if [ -z "$SKIP_UPDATES" ]; then
524 cat >> "$TEMP_SOURCES" <<EOM
525 deb ${DEBOOTSTRAP_MIRROR} RELEASE-updates ${COMPONENTS}
526@@ -476,6 +538,12 @@
527 cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
528 sudo bash -c "cat > $MNT/etc/apt/sources.list"
529 rm -f "$TEMP_SOURCES"
530+
531+if [ "$EXPERIMENTAL" -eq 1 ]; then
532+ echo 'APT::Default-Release "experimental";' \
533+ | sudo tee "$MNT"/etc/apt/apt.conf.d/15sbuild > /dev/null
534+fi
535+
536 # Copy the timezone (comment this out if you want to leave the chroot at UTC)
537 sudo cp /etc/localtime /etc/timezone "$MNT"/etc/
538 # Create a schroot entry for this chroot
539@@ -492,7 +560,6 @@
540 # it helps keep the schroot stanzas separated in the main
541 # /etc/schroot/schroot.conf file.
542 cat > "$TEMP_SCHROOTCONF" <<EOM
543-
544 [CHROOT_NAME]
545 description=CHROOT_NAME
546 groups=sbuild,root,admin
547@@ -528,18 +595,35 @@
548 if [ ! -z "$personality" ]; then
549 echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
550 fi
551+if [ ! -z "$CHROOT_SYNONYM" ]; then
552+ echo "aliases=$CHROOT_SYNONYM" >> "$TEMP_SCHROOTCONF"
553+fi
554 if [ ! -z "$SCHROOT_CONF_SUFFIX" ]; then
555 echo "$SCHROOT_CONF_SUFFIX" >> "$TEMP_SCHROOTCONF"
556 fi
557-cat "$TEMP_SCHROOTCONF" | sed \
558- -e "s|CHROOT_NAME|$CHROOT_NAME|g" \
559- -e "s|CHROOT_PATH|$CHROOT_PATH|g" \
560- -e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
561- -e "s|SCHROOT_TYPE|$SCHROOT_TYPE|g" \
562- -e "s|CHROOT_SNAPSHOT_DIR|$CHROOT_SNAPSHOT_DIR|g" \
563- | \
564- sudo bash -c "cat >> /etc/schroot/schroot.conf"
565+sed -e "s|CHROOT_NAME|$CHROOT_NAME|g" \
566+ -e "s|CHROOT_PATH|$CHROOT_PATH|g" \
567+ -e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
568+ -e "s|SCHROOT_TYPE|$SCHROOT_TYPE|g" \
569+ -e "s|CHROOT_SNAPSHOT_DIR|$CHROOT_SNAPSHOT_DIR|g" \
570+ "$TEMP_SCHROOTCONF" \
571+ | sudo tee "/etc/schroot/chroot.d/sbuild-$CHROOT_NAME" > /dev/null
572 rm -f "$TEMP_SCHROOTCONF"
573+
574+# Disable daemons in chroot:
575+sudo bash -c "cat >> $MNT/usr/sbin/policy-rc.d" <<EOM
576+#!/bin/sh
577+while true; do
578+ case "\$1" in
579+ -*) shift ;;
580+ makedev) exit 0;;
581+ x11-common) exit 0;;
582+ *) exit 101;;
583+ esac
584+done
585+EOM
586+sudo chmod a+x "$MNT"/usr/sbin/policy-rc.d
587+
588 # Create image finalization script
589 sudo bash -c "cat >> $MNT/finish.sh" <<EOM
590 #!/bin/bash
591@@ -593,3 +677,5 @@
592 echo " To ENTER an image snapshot: schroot -c ${CHROOT_NAME}"
593 echo " To BUILD within a snapshot: sbuild -A -d ${CHROOT_NAME} PACKAGE*.dsc"
594 echo ""
595+
596+# vi: set et:
597
598=== modified file 'ubuntutools/test/test_help.py'
599--- ubuntutools/test/test_help.py 2011-01-14 02:14:52 +0000
600+++ ubuntutools/test/test_help.py 2011-04-24 20:00:57 +0000
601@@ -32,7 +32,6 @@
602 'grep-merges': 'No Help',
603 'lp-project-upload': 'Returns non-zero after help. '
604 'Leaving u-d-t in LP: #524680',
605- 'mk-sbuild': 'Fires up apt-get before showing help',
606 'pbuilder-dist-simple': 'No Help',
607 'setup-packaging-environment': 'Throws Error',
608 'submittodebian': 'No Help',

Subscribers

People subscribed via source and target branches

to status/vote changes: