[Pkg-xfce-commits] r4219 - in scripts/pbuilder: . hooks

Yves-Alexis Perez corsac at alioth.debian.org
Sun Aug 15 02:24:19 UTC 2010


Author: corsac
Date: 2010-08-15 14:24:03 +0000 (Sun, 15 Aug 2010)
New Revision: 4219

Modified:
   scripts/pbuilder/hooks/D10aptupdate.sh
   scripts/pbuilder/pdebuild-sources.sh
   scripts/pbuilder/pdebuild.conf
   scripts/pbuilder/pdebuild.wrapper
Log:
large pbuilder update:

* use envvar to specify target distribution, arch and branch
* automagically get the right buildresult as apt source
* try to be smart when possible

(might still be a bit buggy...)


Modified: scripts/pbuilder/hooks/D10aptupdate.sh
===================================================================
--- scripts/pbuilder/hooks/D10aptupdate.sh	2010-08-14 09:21:29 UTC (rev 4218)
+++ scripts/pbuilder/hooks/D10aptupdate.sh	2010-08-15 14:24:03 UTC (rev 4219)
@@ -1,9 +1,11 @@
 #! /bin/bash
 #we use the first apt line to detect the bind-mounted archive folder
-ARCHIVE=$(awk 'NR==1 { print $2 }' /etc/apt/sources.list|sed 's/file\:\/\///')
-if [ -d "$ARCHIVE" ]; then
-  pushd "$ARCHIVE"
+#ARCHIVE=$(awk 'NR==1 { print $2 }' /etc/apt/sources.list|sed 's/file\:\/\///')
+if [ -d "$BUILDRESULT" ]; then
+  echo "deb file://$BUILDRESULT ./" >> /etc/apt/sources.list
+  pushd "$BUILDRESULT"
   dpkg-scanpackages -m . /dev/null > Packages
   popd
 fi
 apt-get update
+#/bin/bash < /dev/tty > /dev/tty

Modified: scripts/pbuilder/pdebuild-sources.sh
===================================================================
--- scripts/pbuilder/pdebuild-sources.sh	2010-08-14 09:21:29 UTC (rev 4218)
+++ scripts/pbuilder/pdebuild-sources.sh	2010-08-15 14:24:03 UTC (rev 4219)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # Copyright (C) 2005 2006 2007 Emanuele Rocca <ema at debian.org>
 # This code is released under the terms of the GNU GPL
 #
@@ -7,9 +7,38 @@
 # Uncomment this variable to debug
 #DEBUG=true
 
+#################
+# How to build? #
+#################
+
+## Simple build:
+# ./pdebuild-source desktop libxfce4util
+
+## Specific targets (BASETGZ or BASEPATH must exist):
+# DISTRIBUTION=lenny ARCH=i386 ./pdebuild-source desktop libxfcegui4
+
+## Backports
+# DISTRIBUTION=lenny BRANCH=lenny-backports DEBBUILDOPTS="-sa -v4.6.2-1" ./pdebuild-source desktop thunar
+
+## Create cowbuilder folder
+# DISTRIBUTION=squeeze ARCH=i386 ./pdebuild-source create
+
+##################
+# Useful folders #
+##################
+
+# xfce/build-$DIST-$ARCH-$BRANCH: result folder, get your built packages there,
+#   it's automagically added to the apt sources when building so dependency are
+#   resolved
+# xfce/cache-$DIST: apt cache folder
+# xfce/log: logs
+
+###############################################################################
+
 CONFFILE=./pdebuild.conf
 . $CONFFILE
 
+export APTGETOPT=('--force-yes')
 if [ ! -d "$BASEDIR/desktop" ] || [ ! -d "$BASEDIR/goodies" ];then
     ( 
         echo "ERROR: \$BASEDIR is not set correctly" 
@@ -53,21 +82,22 @@
     "create")
         echo "Creating $(basename ${BASETGZ})"
 
-        [ "$DEBUG" ] || sudo $PDEBUILD_PBUILDER --create --debug \
+        [ "$DEBUG" ] || $PBUILDERROOTCMD $PDEBUILD_PBUILDER --create --debug \
                 --configfile $CONFFILE > $PBUILDERDIR/log/pbuilder-create.log \
                      2> $PBUILDERDIR/log/pbuilder-create-errors.log
         exit 0
         ;;
 	"update")
 		echo "Updating $(basename ${BASETGZ})"
-		[ "$DEBUG" ] || sudo $PDEBUILD_PBUILDER --update --debug \
-			--configfile $CONFFILE > $PBUILDERDIR/log/pbuilder-update.log \
-		        	2> $PBUILDERDIR/log/pbuilder-update-errors.log
+		[ "$DEBUG" ] || $PBUILDERROOTCMD $PDEBUILD_PBUILDER --update --debug \
+			--configfile $CONFFILE --override-config \
+			> $PBUILDERDIR/log/pbuilder-update.log \
+			2> $PBUILDERDIR/log/pbuilder-update-errors.log
 		exit 0
 		;;
 	"login")
 		echo "Entering chroot"
-		[ "$DEBUG" ] || sudo $PDEBUILD_PBUILDER --login --configfile $CONFFILE 
+		[ "$DEBUG" ] || $PBUILDERROOTCMD $PDEBUILD_PBUILDER --login --configfile $CONFFILE 
 		exit 0
 		;;
 	*)
@@ -83,13 +113,13 @@
 	if [ -d "$BUILDDIR/$pkg" ];
 	then
 		cd $BUILDDIR/$pkg
-		version=$(dpkg-parsechangelog --count 1 | grep Version | awk '{ print $2 }')
-		if [ -f $SCRIPTSDIR/pbuilder/xfce/build/${pkg}_${version}_${arch}.changes ]; 
+		version=$(dpkg-parsechangelog --count 1 | grep '^Version:' | awk '{ print $2 }')
+		if [ -f $SCRIPTSDIR/pbuilder/xfce/build/${pkg}_${version}_${ARCH}.changes ]; 
 		then
 			echo "$pkg already built, skipping"
 		else
       # pass variables to the build
-      export pkg version arch
+      export pkg version ARCH DISTRIBUTION BRANCH DEBBUILDOPTS BUILDRESULT
 			[ "$DEBUG" ] || svn-buildpackage --svn-ignore-new \
 				--svn-builder $SCRIPTSDIR/pbuilder/pdebuild.wrapper &&
 			echo "done"
@@ -111,11 +141,20 @@
 done
 
 [ -d "$BUILDPLACE" ] || mkdir -p "$BUILDPLACE"
+#sudo mount -t tmpfs tmpfs $BUILDPLACE
 [ -d "$PBUILDERDIR/log" ] || mkdir -p "$PBUILDERDIR/log"
 
-if [ ! -f "$BASETGZ" ]; then
-    echo "${BASETGZ} is missing. Use '$0 create' to create it"
-    exit
+if [ "$PDEBUILD_PBUILDER" = "cowbuilder" ]; then
+  if [ ! -d "$BASEPATH" ]; then
+      echo "${BASEPATH} is missing. Use '$0 create' to create it"
+      exit
+  fi
+  else
+  if [ ! -f "$BASETGZ" ]; then
+      echo "${BASETGZ} is missing. Use '$0 create' to create it"
+      exit
+      #sudo umount $BUILDPLACE
+  fi
 fi
 
 if [ -z "$PACKAGES" ]; then
@@ -131,3 +170,4 @@
 	done
 fi
 
+#sudo umount $BUILDPLACE

Modified: scripts/pbuilder/pdebuild.conf
===================================================================
--- scripts/pbuilder/pdebuild.conf	2010-08-14 09:21:29 UTC (rev 4218)
+++ scripts/pbuilder/pdebuild.conf	2010-08-15 14:24:03 UTC (rev 4219)
@@ -1,28 +1,28 @@
 # read pbuilderrc.5 document for notes on specific options.
-#PDEBUILD_PBUILDER=cowbuilder
 
+
 BASEDIR=$HOME/debian/pkg-xfce
-DESKTOPDIR=$BASEDIR/desktop/trunk
-#DESKTOPDIR=$BASEDIR/desktop/branches/lenny-backports
-GOODIESDIR=$BASEDIR/goodies/trunk
-#GOODIESDIR=$BASEDIR/goodies/branches/old
 SCRIPTSDIR=$BASEDIR/scripts
+PBUILDERDIR=$BASEDIR/scripts/pbuilder/xfce
 
-DISTRIBUTION=sid
-arch="amd64"
-#arch="i386" can be useful
+DISTRIBUTION=${DISTRIBUTION:-sid}
+ARCH=${ARCH:-$(dpkg-architecture -qDEB_BUILD_ARCH)}
+BRANCH=${BRANCH:-trunk}
 
-PBUILDERDIR=$BASEDIR/scripts/pbuilder/xfce
-BASETGZ=$PBUILDERDIR/base-${DISTRIBUTION}-$arch.tgz
-#PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends-experimental
+DESKTOPDIR=$BASEDIR/desktop/${BRANCH}
+GOODIESDIR=$BASEDIR/goodies/${BRANCH}
+BRANCH=${BRANCH#branches/}
 
-BUILDPLACE=$PBUILDERDIR
-BUILDRESULT=$PBUILDERDIR/build
+BASETGZ=$PBUILDERDIR/base-${DISTRIBUTION}-${ARCH}.tgz
+BASEPATH=$PBUILDERDIR/base-${DISTRIBUTION}-${ARCH}.cow
+
+BUILDPLACE=$PBUILDERDIR/tmpfs
+BUILDRESULT=$PBUILDERDIR/build-${DISTRIBUTION}-${ARCH}-${BRANCH}
 BINDMOUNTS=$BUILDRESULT
-OTHERMIRROR="deb file://$PBUILDERDIR/build ./"
+OTHERMIRROR="deb file://$BUILDRESULT ./"
 
 HOOKDIR=$BASEDIR/scripts/pbuilder/hooks
-APTCACHE=$PBUILDERDIR/cache
+APTCACHE=$PBUILDERDIR/cache-${DISTRIBUTION}
 
 
 MIRRORSITE=http://ftp.fr.debian.org/debian
@@ -30,17 +30,14 @@
 USEDEVPTS=yes
 USEDEVFS=no
 BUILDSOURCEROOTCMD="fakeroot"
-PBUILDERROOTCMD="sudo"
+PBUILDERROOTCMD="sudo -E"
 AUTO_DEBSIGN=no
 
-PBUILDER=/usr/sbin/pbuilder
+PDEBUILD_PBUILDER=cowbuilder
 DEBOOTSTRAP="cdebootstrap"
 #Useful for creating a chroot with another arch
 #DEBOOTSTRAPOPTS[0]="--variant=buildd"
 #DEBOOTSTRAPOPTS[1]="--arch=i386"
 
-#export CCACHE_DIR="$PBUILDERDIR/ccache"
-#export PATH="/usr/lib/ccache:${PATH}"
-#EXTRAPACKAGES=ccache
-#BINDMOUNTS="$BINDMOUNTS ${CCACHE_DIR}"
-
+export CCACHEDIR="$PBUILDERDIR/ccache"
+export CCACHE_DIR=$CCACHEDIR

Modified: scripts/pbuilder/pdebuild.wrapper
===================================================================
--- scripts/pbuilder/pdebuild.wrapper	2010-08-14 09:21:29 UTC (rev 4218)
+++ scripts/pbuilder/pdebuild.wrapper	2010-08-15 14:24:03 UTC (rev 4219)
@@ -3,6 +3,5 @@
 D=$PKGXFCEBASEDIR/scripts/pbuilder
 
 pdebuild --configfile $D/pdebuild.conf \
-	--logfile $D/xfce/log/${pkg}_${version}_${arch}.log
-# -- --debbuildopts '-v0.2.12-3~bpo50+1 -sa' 
-#-- --debbuildopts -b
+  --logfile $D/xfce/log/${pkg}_${version}_${ARCH}.log \
+  -- --debbuildopts="$DEBBUILDOPTS"




More information about the Pkg-xfce-commits mailing list