From cc2786d9dadf108f067554ed908307611e954859 Mon Sep 17 00:00:00 2001 From: Otavio Salvador Date: Wed, 22 Jul 2009 15:09:27 +0000 Subject: Apply patch from Riku Voipio to add support for scratchbox variant. Closes: #536820. r59598 --- debian/changelog | 2 ++ debootstrap | 21 +++++++++++++++++++-- debootstrap.8 | 4 +++- functions | 6 +++--- scripts/debian/sid | 6 ++++-- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index ac91ea5..8b75f8e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ debootstrap (1.0.14) UNRELEASED; urgency=low --print-architecture" to avoid deprecation warning. Closes: #531680. * Reference squeeze instead of sarge in manpage. Based on a patch from Geoff Simmons . Closes: #534575. + * Apply patch from Riku Voipio to add support for + scratchbox variant. Closes: #536820. -- Otavio Salvador Wed, 03 Jun 2009 14:26:22 -0300 diff --git a/debootstrap b/debootstrap index dfe3f8b..ac821b8 100755 --- a/debootstrap +++ b/debootstrap @@ -79,7 +79,8 @@ usage() --components=A,B,C use packages from the listed components of the archive --variant=X use variant X of the bootstrap scripts - (currently supported variants: buildd, fakechroot) + (currently supported variants: buildd, fakechroot, + scratchbox) --keyring=K check Release files against keyring K --no-resolve-deps don't try to resolve dependencies automatically @@ -346,7 +347,23 @@ else error 1 WHATARCH "Couldn't work out current architecture" fi -export ARCH SUITE TARGET +if [ "$TARGET" = "/" ]; then + CHROOT_CMD="" +elif doing_variant scratchbox; then + for config in ~/.scratchbox2/*/sb2.config; + do + export `grep ^SBOX_TARGET_ROOT= $config` + if [ "x$SBOX_TARGET_ROOT" = "x$TARGET" ]; then + SB2_TARGET=$(basename $(dirname $config)) + fi + done + [ "x$SB2_TARGET" != "x" ] || error 1 SBOXTARGETREQ "No scratchbox target configured for $TARGET" + CHROOT_CMD="sb2 -eR -t $SB2_TARGET" +else + CHROOT_CMD="chroot $TARGET" +fi + +export ARCH SUITE TARGET CHROOT_CMD if am_doing_phase first_stage second_stage; then if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then diff --git a/debootstrap.8 b/debootstrap.8 index 81a5855..c1995cc 100644 --- a/debootstrap.8 +++ b/debootstrap.8 @@ -70,13 +70,15 @@ or apt, and that it is far better to specify the entire base system than rely on this option. With this option set, this behaviour is disabled. .IP -.IP "\fB\-\-variant=minbase|buildd|fakechroot\fP" +.IP "\fB\-\-variant=minbase|buildd|fakechroot|scratchbox\fP" Name of the bootstrap script variant to use. Currently, the variants supported are minbase, which only includes essential packages and apt; buildd, which installs the build-essential packages into .IR TARGET ; and fakechroot, which installs the packages without root privileges. +Finally there is variant scratchbox, which is for creating targets +for scratchbox usage. The default, with no \fB\-\-variant=X\fP argument, is to create a base Debian installation in .IR TARGET . diff --git a/functions b/functions index 2aecd5d..ae8fd3f 100644 --- a/functions +++ b/functions @@ -730,7 +730,7 @@ extract () { ( ); } in_target_nofail () { - if ! chroot "$TARGET" "$@" 2>/dev/null; then + if ! $CHROOT_CMD "$@" 2>/dev/null; then true fi return 0 @@ -741,7 +741,7 @@ in_target_failmsg () { local msg="$2" local arg="$3" shift; shift; shift - if ! chroot "$TARGET" "$@"; then + if ! $CHROOT_CMD "$@"; then warning "$code" "$msg" "$arg" return 1 fi @@ -749,7 +749,7 @@ in_target_failmsg () { } in_target () { - in_target_failmsg IN_TARGET_FAIL "Failure trying to run: %s" "chroot $TARGET $*" "$@" + in_target_failmsg IN_TARGET_FAIL "Failure trying to run: %s" "$CHROOT_CMD $*" "$@" } ###################################################### standard setup stuff diff --git a/scripts/debian/sid b/scripts/debian/sid index 565ab92..239b0c4 100644 --- a/scripts/debian/sid +++ b/scripts/debian/sid @@ -1,7 +1,7 @@ mirror_style release download_style apt finddebs_style from-indices -variants - buildd fakechroot minbase +variants - buildd fakechroot minbase scratchbox if doing_variant fakechroot; then test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started" @@ -21,7 +21,7 @@ work_out_debs () { #required="$required $(get_debs Priority: important)" # ^^ should be getting debconf here somehow maybe base="$(get_debs Priority: important)" - elif doing_variant buildd; then + elif doing_variant buildd || doing_variant scratchbox; then base="$(get_debs Build-Essential: yes)" elif doing_variant minbase; then base="apt" @@ -89,6 +89,8 @@ second_stage_install () { if doing_variant fakechroot; then setup_proc_fakechroot + elif doing_variant scratchbox; then + true else setup_proc in_target /sbin/ldconfig -- cgit v0.12