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

Bug#536820: please add scratchbox2 variant



On Sat, Jul 18, 2009 at 06:32:54PM -0300, Otavio Salvador wrote:
> On Wed, Jul 15, 2009 at 5:54 PM, Riku Voipio<riku.voipio@iki.fi> wrote:
> > Argh, please forget the previous patch. That one was certainly not the
> > one I wanted to send. The patch attached to this mail has the advantage
> > of actually working.

> Previous comments still fits. It has coding style issues and miss the
> manpage updating.

Manpage updated. I didn't touch the whitespace issues because I already
try match what is in the files it patch - tabs for debootstrap and functions,
mixed for scripts/sid.

There is no apparent whitespace codingstyle in debootstrap. Tabs and spaces
are used in different styles in different files and even different parts of the
same file. If you want me to use a specific coding style, despite of the irregularities
of existing code, you will need to specify exactly what codingstyle I should follow.

Also, I think for low-volume projects such as debootstrap, it is faster to
just fix up the whitespaces while commiting and tell the contributor
to take a close look at whitespace issues before sending the next patch.

> Take also a look at || since you have one missing spaces before and after it.

Fixed too. I have this vague memory that || doesn't allways work properly when
there is spaces around. But I just tested and the modified version still works.

diff -urN debootstrap-1.0.13.old/debian/changelog debootstrap-1.0.13/debian/changelog
--- debootstrap-1.0.13.old/debian/changelog	2009-04-24 22:08:27.000000000 +0300
+++ debootstrap-1.0.13/debian/changelog	2009-07-19 22:50:16.000000000 +0300
@@ -1,3 +1,9 @@
+debootstrap (1.0.14~0.1) unstable; urgency=low
+
+  * scratchbox 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-1.0.13.old/debootstrap debootstrap-1.0.13/debootstrap
--- debootstrap-1.0.13.old/debootstrap	2009-03-24 16:08:43.000000000 +0200
+++ debootstrap-1.0.13/debootstrap	2009-07-19 22:20:28.000000000 +0300
@@ -79,7 +79,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
 
@@ -346,7 +347,23 @@
 	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 -urN debootstrap-1.0.13.old/debootstrap.8 debootstrap-1.0.13/debootstrap.8
--- debootstrap-1.0.13.old/debootstrap.8	2009-01-13 23:46:30.000000000 +0200
+++ debootstrap-1.0.13/debootstrap.8	2009-07-19 22:28:17.000000000 +0300
@@ -70,13 +70,15 @@
 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 -urN debootstrap-1.0.13.old/functions debootstrap-1.0.13/functions
--- debootstrap-1.0.13.old/functions	2009-03-24 16:08:43.000000000 +0200
+++ debootstrap-1.0.13/functions	2009-07-19 22:20:28.000000000 +0300
@@ -730,7 +730,7 @@
 ); }
 
 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 @@
 	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 () {
-	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 -urN debootstrap-1.0.13.old/scripts/debian/sid debootstrap-1.0.13/scripts/debian/sid
--- debootstrap-1.0.13.old/scripts/debian/sid	2009-03-16 14:10:48.000000000 +0200
+++ debootstrap-1.0.13/scripts/debian/sid	2009-07-19 22:41:42.000000000 +0300
@@ -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 @@
       #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"
@@ -52,6 +52,8 @@
 
     if doing_variant fakechroot; then 
         setup_devices_fakechroot
+    elif doing_variant schratchbox; then
+        true
     else
         setup_devices
     fi
@@ -89,6 +91,8 @@
 
     if doing_variant fakechroot; then 
 	setup_proc_fakechroot
+    elif doing_variant scratchbox; then
+	true
     else
 	setup_proc
 	in_target /sbin/ldconfig

Reply to: