[23387] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23041 - trunk/debathena/third/common

daemon@ATHENA.MIT.EDU (ghudson@MIT.EDU)
Thu Jun 26 13:02:49 2008

Date: Thu, 26 Jun 2008 13:02:30 -0400 (EDT)
From: ghudson@MIT.EDU
Message-Id: <200806261702.NAA03103@drugstore.mit.edu>
To: source-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: ghudson
Date: 2008-06-26 13:02:30 -0400 (Thu, 26 Jun 2008)
New Revision: 23041

Modified:
   trunk/debathena/third/common/debathenificator.sh
Log:
In debathenificator, use a single chroot for all operations except
sbuildhack, and run "apt-get update" inside it before starting.
Eliminates the need to run "all-schroots upgrade-schroot" before using
debathenificator.


Modified: trunk/debathena/third/common/debathenificator.sh
===================================================================
--- trunk/debathena/third/common/debathenificator.sh	2008-06-26 14:36:31 UTC (rev 23040)
+++ trunk/debathena/third/common/debathenificator.sh	2008-06-26 17:02:30 UTC (rev 23041)
@@ -5,6 +5,28 @@
 
 : ${DEBATHENA_APT=/mit/debathena/apt}
 
+# Process arguments.
+dist_arch=$1; shift
+a=
+if [ "$1" = "-A" ]; then a=-A; shift; fi
+chroot=$dist_arch-sbuild
+
+if [ -z "$dist_arch" -o $# -eq 0 ]; then
+    echo 'No arguments!' >&2
+    exit 2
+fi
+
+dist=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\1/')
+arch=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\2/')
+
+# Create a chroot and define functions for using it.
+sid=$(schroot -b -c "$chroot")
+trap 'schroot -e -c "$sid"' EXIT
+sch() { schroot -r -c "$sid" -- "$@"; }           # Run in the chroot
+schq() { schroot -q -r -c "$sid" -- "$@"; }       # Run in the chroot quietly
+schr() { schroot -r -c "$sid" -u root -- "$@"; }  # Run in the chroot as root
+schr apt-get -qq -y update
+
 munge_sections () {
     perl -0pe 's/^Section: /Section: debathena-system\//gm or die' -i debian/control
 }
@@ -39,19 +61,14 @@
     echo "Building source for $name-$daversion on $dist_arch" >&2
     
     if ! [ -e "${name}_$version.dsc" ]; then
-	schroot -c "$chroot" -- apt-get -d source "$name"
+	sch apt-get -d source "$name"
     fi
     
     if ! [ -e "${name}_$daversion.dsc" ]; then
-	tmpdir=$(mktemp -td "debathenify.$$.XXXXXXXXXX")
-	trap 'rm -rf "$tmpdir"' EXIT
-	origversion=$(echo "$version" | sed 's/-[^-]*$//')
-	#echo "! [ -e '$tmpdir/${name}_$origversion.orig.tar.gz' ] || diff -u <(xxd '${name}_$origversion.orig.tar.gz') <(xxd '$tmpdir/${name}_$origversion.orig.tar.gz')" >| /tmp/wtf
-	
 	(
-	    sid=$(schroot -b -c "$chroot")
-	    trap 'schroot -e -c "$sid"' EXIT
-	    set -x
+	    tmpdir=$(mktemp -td "debathenify.$$.XXXXXXXXXX")
+	    trap 'rm -rf "$tmpdir"' EXIT
+	    origversion=$(echo "$version" | sed 's/-[^-]*$//')
 	    cp -a "${name}_$origversion.orig.tar.gz" "$tmpdir/"
 	    dscdir=$(pwd)
 	    cd "$tmpdir/"
@@ -60,16 +77,12 @@
 	    dch_done=
 	    hack_package
 	    [ -n "$dch_done" ]
-	    schroot -r -c "$sid" -u root -- apt-get -q -y install devscripts pbuilder
-	    schroot -r -c "$sid" -u root -- /usr/lib/pbuilder/pbuilder-satisfydepends
-	    schroot -r -c "$sid" -- debuild -S -sa -us -uc -i -I.svn
+	    schr apt-get -q -y install devscripts pbuilder
+	    schr /usr/lib/pbuilder/pbuilder-satisfydepends
+	    sch debuild -S -sa -us -uc -i -I.svn && cp -a "../${name}_$daversion"* "$dscdir"
 	)
-	[ $? -eq 0 ] || {
-	    bash -c "diff -u <(xxd '${name}_$origversion.orig.tar.gz') <(xxd '$tmpdir/${name}_$origversion.orig.tar.gz')"
-	    exit 1
-	}
+	[ $? -eq 0 ] || exit 1
 	
-	cp -a "$tmpdir/${name}_$daversion"* .
 	if [ -n "$DA_CHECK_DIFFS" ]; then
 	    interdiff -z "${name}_$version.diff.gz" "${name}_$daversion.diff.gz" | \
 		enscript --color --language=ansi --highlight=diffu --output=- -q | \
@@ -102,21 +115,8 @@
     $REPREPRO include "$dist" "${name}_${daversion}${tag}_${arch}.changes"
 }
 
-dist_arch=$1; shift
-a=
-if [ "$1" = "-A" ]; then a=-A; shift; fi
-chroot=$dist_arch-sbuild
-
-if [ -z "$dist_arch" -o $# -eq 0 ]; then
-    echo 'No arguments!' >&2
-    exit 2
-fi
-
-dist=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\1/')
-arch=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\2/')
-
 version=$(
-    schroot -q -c "$chroot" -- apt-cache showsrc "$name" | \
+    sch apt-cache showsrc "$name" | \
 	sed -n 's/^Version: \(.*\)$/\1/ p' | (
 	version='~~~'
 	while read -r newversion; do


home help back first fref pref prev next nref lref last post