[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#536820: please add scratchbox2 variant



Package: debootstrap
Version: 1.0.13
Severity: wishlist
Tags: patch

Two changes needed for supporting scratchbox2:

1) make chrooting optional for --second-stage - after all we are in the
new chroot, if "/" is defined as the target. To facialiate this, we convert
calls of chroot to $CHROOT and set it chroot, unless TARGET is defined as
"/". This change is usefull even without scratchbox.

2) add variant "scratchbox", similar to "fakechroot". since scratchbox handles
"mounting" proc and dev, just skip these parts.
diff -urN debootstrap/debian/changelog debootstrap-1.0.14~0.1/debian/changelog
--- debootstrap/debian/changelog	2009-04-24 22:08:27.000000000 +0300
+++ debootstrap-1.0.14~0.1/debian/changelog	2009-07-13 15:44:18.000000000 +0300
@@ -1,3 +1,9 @@
+debootstrap (1.0.14~0.1) karmic; urgency=low
+
+  * sb2 support
+
+ -- Riku Voipio <riku.voipio@iki.fi>  Mon, 13 Jul 2009 15:43:54 +0300
+
 debootstrap (1.0.13) unstable; urgency=low
 
   [ Otavio Salvador ]
diff -urN debootstrap/debootstrap debootstrap-1.0.14~0.1/debootstrap
--- debootstrap/debootstrap	2009-03-24 16:08:43.000000000 +0200
+++ debootstrap-1.0.14~0.1/debootstrap	2009-07-13 16:33:29.000000000 +0300
@@ -26,6 +26,7 @@
 USE_COMPONENTS=main
 KEYRING=""
 VARIANT=""
+CHROOT="chroot"
 
 DEF_MIRROR="http://ftp.us.debian.org/debian";
 
@@ -79,7 +80,8 @@
       --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
 
@@ -301,6 +303,7 @@
 	fi
 	if [ -z "$CHROOTDIR" ]; then
 		TARGET=/
+        CHROOT=""
 	else
 		TARGET=$CHROOTDIR
 	fi
diff -urN debootstrap/functions debootstrap-1.0.14~0.1/functions
--- debootstrap/functions	2009-03-24 16:08:43.000000000 +0200
+++ debootstrap-1.0.14~0.1/functions	2009-07-13 15:43:42.000000000 +0300
@@ -730,7 +730,7 @@
 ); }
 
 in_target_nofail () {
-	if ! chroot "$TARGET" "$@" 2>/dev/null; then
+	if ! "$CHROOT" "$TARGET" "$@" 2>/dev/null; then
 		true
 	fi
 	return 0
@@ -741,7 +741,7 @@
 	local msg="$2"
 	local arg="$3"
 	shift; shift; shift
-	if ! chroot "$TARGET" "$@"; then
+	if ! "$CHROOT" "$TARGET" "$@"; then
 		warning "$code" "$msg" "$arg"
 		return 1
 	fi
diff -urN debootstrap/scripts/debian/sid debootstrap-1.0.14~0.1/scripts/debian/sid
--- debootstrap/scripts/debian/sid	2009-03-16 14:10:48.000000000 +0200
+++ debootstrap-1.0.14~0.1/scripts/debian/sid	2009-07-13 16:55:27.000000000 +0300
@@ -1,12 +1,24 @@
 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"
 fi
 
+if doing_variant scratchbox; then
+    for config in ~/.scratchbox2/*/;
+    do
+        export `grep ^SBOX_TARGET_ROOT= $config/sb2.config`
+        if [ "x$SBOX_TARGET_ROOT" = "x$TARGET" ]; then 
+            CONFIG=`basename config`
+        fi
+    done
+    [ "x$CONFIG" != "x" ] || error 1 SBOXTARGETREQ "No scratchbox2 target configured for $TARGET"
+    CHROOT="sb2 -eR -t $CONFIG" 
+fi
+
 case $ARCH in
   alpha|ia64) LIBC="libc6.1" ;;
   kfreebsd-*) LIBC="libc0.1" ;;
@@ -52,6 +64,8 @@
 
     if doing_variant fakechroot; then 
         setup_devices_fakechroot
+    elif doing_variant schratchbox; then
+        true
     else
         setup_devices
     fi
@@ -89,6 +103,8 @@
 
     if doing_variant fakechroot; then 
 	setup_proc_fakechroot
+    elif doing_variant scratchbox; then
+    true
     else
 	setup_proc
 	in_target /sbin/ldconfig

Reply to: