Jani Monoses wrote:
> Hello all
> 
> here's a patch against the scripts in /usr/lib/pbuilder (did not bother
> with making a normal debdiff/package yet) which makes pbuilder use
> unionfs if available and told to do so (as in the .pbuilderrc attached)

How interesting, I have done something similar for breezy a while ago,
but I think I have it still on my local queue of things to send to
Debian BTS :)

Anyway, here goes the debdiff of the changes I've made to support
unionfs. It's for pbuilder 0.128, but it could be easily updated to the
latest dapper version (and I plan to do so once Dapper becomes my main
development system.)

I see our implementations have some differences, but maybe we can merge
them into one patch? For instance, my approach was to extend the
"--no-targz" option to use unionfs by default, so no new options were
added and no changes are needed to .pbuilderc.

Here goes a simple usage summary:

# create a new rootstrap
sudo pbuilder create --no-targz

# update a rootstrap
sudo pbuilder update --no-targz

# login to pbuilder chroot
sudo pbuilder login --no-targz

# build a package with pbuilder
pdebuild --auto-debsign -- --no-targz

Regards,
-- 
Anderson Lizardo
diff -Nru pbuilder-0.128/debian/changelog pbuilder-0.128.1custom1/debian/changelog
--- pbuilder-0.128/debian/changelog	2005-07-02 00:20:23.000000000 -0400
+++ pbuilder-0.128.1custom1/debian/changelog	2006-03-19 17:24:31.000000000 -0400
@@ -1,3 +1,11 @@
+pbuilder (0.128.1custom1) breezy; urgency=low
+
+  * Non-maintainer upload.
+  * Fix incorrect find syntax usage.
+  * Add support for unionfs-based buildplace cleanup.
+
+ -- Anderson Lizardo <[EMAIL PROTECTED]>  Sun, 19 Mar 2006 17:24:00 -0400
+
 pbuilder (0.128) unstable; urgency=low
 
   * Add example framework to test package inside chroot
diff -Nru pbuilder-0.128/debian/control pbuilder-0.128.1custom1/debian/control
--- pbuilder-0.128/debian/control	2005-01-03 23:36:13.000000000 -0400
+++ pbuilder-0.128.1custom1/debian/control	2006-01-14 19:28:44.000000000 -0400
@@ -8,7 +8,7 @@
 Package: pbuilder
 Architecture: all
 Depends: debootstrap (>= 0.2.29), wget, gcc, debianutils (>= 1.13.1), coreutils (>= 4.5.8-1)
-Recommends: fakeroot, sudo, devscripts
+Recommends: fakeroot, sudo, devscripts, unionfs-modules
 Suggests: pbuilder-uml
 Description: personal package builder for Debian packages
  pbuilder constructs a chroot system, and builds a package inside the
diff -Nru pbuilder-0.128/pbuilder pbuilder-0.128.1custom1/pbuilder
--- pbuilder-0.128/pbuilder	2005-03-04 00:33:02.000000000 -0400
+++ pbuilder-0.128.1custom1/pbuilder	2006-01-14 19:22:28.000000000 -0400
@@ -54,6 +54,13 @@
 	shift 
 	. /usr/lib/pbuilder/pbuilder-checkparams
 	. /usr/lib/pbuilder/pbuilder-runhooks
+	if [ "${INTERNAL_BUILD_UML}" = "yes" -a "${SAVE_AFTER_LOGIN}" != "yes" ]; then
+	    if ! mkdir -p "/var/cache/pbuilder/pbuilder-snap"; then
+		echo "E: failed to build unionfs snapshot directory"
+		exit 1
+	    fi
+	    mount -t unionfs -o dirs=/var/cache/pbuilder/pbuilder-snap=rw:$BUILDPLACE=ro none $BUILDPLACE
+	fi
 	extractbuildplace
 	trap umountproc_cleanbuildplace exit
 	loadhooks
@@ -75,22 +82,33 @@
 
 	# saving the place afterwards
 	if [ "${SAVE_AFTER_LOGIN}" = "yes" ]; then
-	    if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
-		echo "E: Invalid combination of internal-build-uml and save-after-login flags"
-	    else
-		echo " -> Saving the results, modifications to this session will persist"
-		unloadhooks
-		umountproc
-		trap cleanbuildplace exit
+	    echo " -> Saving the results, modifications to this session will persist"
+	    unloadhooks
+	    umountproc
+	    trap cleanbuildplace exit
+	    if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
 		create_basetgz
 	    fi
 	fi
+	if [ "${INTERNAL_BUILD_UML}" = "yes" -a "${SAVE_AFTER_LOGIN}" != "yes" ]; then
+	    trap - exit
+	    umountproc_cleanbuildplace
+	    umount "$BUILDPLACE"
+	    clean_subdirectories "/var/cache/pbuilder/pbuilder-snap"
+	fi
 	;;
     execute)
 	# try to execute arbitrary program.
 	shift
 	. /usr/lib/pbuilder/pbuilder-checkparams
 	. /usr/lib/pbuilder/pbuilder-runhooks
+	if [ "${INTERNAL_BUILD_UML}" = "yes" -a "${SAVE_AFTER_LOGIN}" != "yes" ]; then
+	    if ! mkdir -p "/var/cache/pbuilder/pbuilder-snap"; then
+		echo "E: failed to build unionfs snapshot directory"
+		exit 1
+	    fi
+	    mount -t unionfs -o dirs=/var/cache/pbuilder/pbuilder-snap=rw:$BUILDPLACE=ro none $BUILDPLACE
+	fi
 	EXECPROGRAM="$1"
 	shift
 	if [ ! -f "${EXECPROGRAM}" ]; then
@@ -116,16 +134,20 @@
 
 	# saving the place afterwards
 	if [ "${SAVE_AFTER_LOGIN}" = "yes" ]; then
-	    if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
-		echo "E: Invalid combination of internal-build-uml and save-after-login flags"
-	    else
-		echo " -> Saving the results, modifications to this session will persist"
-		unloadhooks
-		umountproc
-		trap cleanbuildplace exit
+	    echo " -> Saving the results, modifications to this session will persist"
+	    unloadhooks
+	    umountproc
+	    trap cleanbuildplace exit
+	    if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
 		create_basetgz
 	    fi
 	fi
+	if [ "${INTERNAL_BUILD_UML}" = "yes" -a "${SAVE_AFTER_LOGIN}" != "yes" ]; then
+	    trap - exit
+	    umountproc_cleanbuildplace
+	    umount "$BUILDPLACE"
+	    clean_subdirectories "/var/cache/pbuilder/pbuilder-snap"
+	fi
 	;;
     dumpconfig)
 	shift
diff -Nru pbuilder-0.128/pbuilder-buildpackage pbuilder-0.128.1custom1/pbuilder-buildpackage
--- pbuilder-0.128/pbuilder-buildpackage	2005-06-25 02:27:42.000000000 -0400
+++ pbuilder-0.128.1custom1/pbuilder-buildpackage	2006-01-14 22:02:13.000000000 -0400
@@ -47,6 +47,13 @@
 
 showbuildbanner '$Id: pbuilder-buildpackage,v 1.113 2005/06/25 06:27:42 dancer Exp $'
 echobacktime
+if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
+    if ! mkdir -p "/var/cache/pbuilder/pbuilder-snap"; then
+	echo "E: failed to build unionfs snapshot directory"
+	exit 1
+    fi
+    mount -t unionfs -o dirs=/var/cache/pbuilder/pbuilder-snap=rw:$BUILDPLACE=ro none $BUILDPLACE
+fi
 extractbuildplace 
 trap umountproc_cleanbuildplace exit
 loadhooks
@@ -142,5 +149,12 @@
     echo "E: BUILDRESULT=[$BUILDRESULT] is not a directory." >&2
 fi
 
+if [ "${INTERNAL_BUILD_UML}" = "yes" ]; then
+    trap - exit
+    cleanbuildplace
+    umount "$BUILDPLACE"
+    clean_subdirectories "/var/cache/pbuilder/pbuilder-snap"
+fi
+
 echobacktime
 
diff -Nru pbuilder-0.128/pbuilder-createbuildenv pbuilder-0.128.1custom1/pbuilder-createbuildenv
--- pbuilder-0.128/pbuilder-createbuildenv	2005-06-04 22:50:50.000000000 -0400
+++ pbuilder-0.128.1custom1/pbuilder-createbuildenv	2006-01-14 19:22:29.000000000 -0400
@@ -87,7 +87,9 @@
 umountproc
 $TRAP cleanbuildplace exit
 
-create_basetgz
+if [ "${INTERNAL_BUILD_UML}" != "yes" ]; then
+    create_basetgz
+fi
 if [ "${PRESERVE_BUILDPLACE}" = "yes" ]; then
     trap exit
 fi
diff -Nru pbuilder-0.128/pbuilder-modules pbuilder-0.128.1custom1/pbuilder-modules
--- pbuilder-0.128/pbuilder-modules	2005-06-12 04:28:19.000000000 -0400
+++ pbuilder-0.128.1custom1/pbuilder-modules	2006-01-14 19:22:29.000000000 -0400
@@ -286,9 +286,9 @@
 	    echo "E: failed to extract $BASETGZ to $BUILDPLACE"
 	    exit 1
 	fi
-	echo " -> creating local configuration"
-	hostname -f > "$BUILDPLACE/etc/mailname"
     fi
+    echo " -> creating local configuration"
+    hostname -f > "$BUILDPLACE/etc/mailname"
     copy_local_configuration
     mountproc
     mkdir -p "$BUILDPLACE/tmp/buildd"
@@ -309,7 +309,7 @@
 	    doit=cp
 	fi
 	echo "Obtaining the cached apt archive contents"
-	find "$APTCACHE" -name \*.deb -maxdepth 1 | \
+	find "$APTCACHE" -maxdepth 1 -name \*.deb | \
 	    while read A ; do
 	    $doit "$A" "$BUILDPLACE/var/cache/apt/archives/" || true
 	done
@@ -328,7 +328,7 @@
 	else
 	    doit=cp
 	fi
-	find "$BUILDPLACE/var/cache/apt/archives/" -name \*.deb -maxdepth 1 | \
+	find "$BUILDPLACE/var/cache/apt/archives/" -maxdepth 1 -name \*.deb | \
 	    while read A ;do
 	    if [ ! -f "$APTCACHE/"$(basename "$A") -a -f "$A" ]; then
 		echo " -> new cache content "$(basename "$A")" added"
diff -Nru pbuilder-0.128/pbuilder-updatebuildenv pbuilder-0.128.1custom1/pbuilder-updatebuildenv
--- pbuilder-0.128/pbuilder-updatebuildenv	2005-06-04 22:50:50.000000000 -0400
+++ pbuilder-0.128.1custom1/pbuilder-updatebuildenv	2006-01-14 19:22:29.000000000 -0400
@@ -52,7 +52,7 @@
 if [ "${AUTOCLEANAPTCACHE}" = "yes" -a -n "$APTCACHE" ]; then
     echo " -> Cleaning the cached apt archive"
     $CHROOTEXEC /usr/bin/apt-get autoclean || true
-    find "$APTCACHE/" -name \*.deb -maxdepth 1 | \
+    find "$APTCACHE/" -maxdepth 1 -name \*.deb | \
 	while read A; do
 	    if [ ! -f "$BUILDPLACE/var/cache/apt/archives/"$(basename "$A") -a \
 		-f "$A" ]; then

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
Ubuntu-motu mailing list
Ubuntu-motu@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-motu

Reply via email to