aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJunichi Uekawa <dancer@dancer64.netfort.gr.jp>2007-06-07 07:50:37 +0900
committerJunichi Uekawa <dancer@dancer64.netfort.gr.jp>2007-06-07 07:50:37 +0900
commitdf5d8bf2689c623b90fa908d843ba9d6fff3529f (patch)
tree1d20dbda72474038a79dd52426a87e016e297614 /examples
parent00c2811e453885c630f5626331ba5a6f19c74b7b (diff)
downloadpbuilder-df5d8bf2689c623b90fa908d843ba9d6fff3529f.tar
pbuilder-df5d8bf2689c623b90fa908d843ba9d6fff3529f.tar.gz
* add example rebuild script from Bastian Venthur
(http://people.debian.org/~venthur/stuff/2007-06-rebuild/)
Diffstat (limited to 'examples')
-rw-r--r--examples/rebuild/README54
-rwxr-xr-xexamples/rebuild/buildall75
-rwxr-xr-xexamples/rebuild/getlist21
3 files changed, 150 insertions, 0 deletions
diff --git a/examples/rebuild/README b/examples/rebuild/README
new file mode 100644
index 0000000..d34ad26
--- /dev/null
+++ b/examples/rebuild/README
@@ -0,0 +1,54 @@
+:1. Preparing the cowbuilder:
+============================
+
+ sudo aptitude install cowdancer grep-dctrl wget
+ sudo cowbuilder --create --distribution lenny --basepath /var/cache/pbuilder/testing-base.cow
+
+2. Getting the list of packages to build:
+=========================================
+
+ getlist lenny
+
+Will fetch the Sources.gz for main and contrib of the distribution you
+choose and creates two files:
+
+ 1. list.lenny
+ 2. list.lenny.i368
+
+The first list contains the name of all packages followed by all
+architectures it can be build on. The second list Contains the names of
+all packages which can be build on your arch.
+
+3. Setting the rebuild variables:
+=================================
+
+The only setting should change is the BASEPATH variable. It must match
+the --basepath option you gave.
+
+The other settings BUILDDIR and LOGDIR are optional.
+
+4. Rebuilding the archive
+=========================
+
+ rebuild list.lenny.i386 lenny
+
+Will attempt to build all packages appearing in list.testing.i368. It will
+temporarily build them in $BUILDDIR/$PACKAGE and will use $LOGDIR to create
+lock- and logfiles.
+
+NOTES:
+======
+
+ - On a machine with more than one processor you can run multiple instances
+ of the rebuild script in order to speed up the build process by building
+ multiple packages concurrently
+
+ - When building for a different distribution (testing) than the one the host
+ system is running (sid) you got to make sure that apt-get source fetches the
+ right sources. Otherwise you'll rebuild the packages from sid in a testing
+ environment and get false-positive FTBFS.
+
+--
+
+2007-02-21, Bastian Venthur
+
diff --git a/examples/rebuild/buildall b/examples/rebuild/buildall
new file mode 100755
index 0000000..52a68d5
--- /dev/null
+++ b/examples/rebuild/buildall
@@ -0,0 +1,75 @@
+#!/bin/sh
+#
+# rebuild - builds every package in a clean cowbuilder environment
+# Usage: rebuild list
+#
+# Copyright (C) 2007 Bastian Venthur
+#
+# License: GPL 2
+#
+# Version: 2007-06-06
+# * Included many patches from Gregor Herrmann
+# Version: 2007-02-21
+# * Initial release
+
+
+LIST=$1
+DIST=${2:-testing}
+MIRROR=http://ftp.at.debian.org
+
+LOGDIR=$(pwd)/"logs"
+BUILDDIR=$(pwd)/"build"
+BASEPATH="/var/cache/pbuilder/testing-base.cow"
+
+# source lsb-functions for nice log messages
+. /lib/lsb/init-functions
+
+function build {
+ PACKAGE=$1
+
+ mkdir -p $BUILDDIR/$PACKAGE
+ cd $BUILDDIR/$PACKAGE
+
+ #apt-get source $PACKAGE -t $DIST > /dev/null 2> $LOGDIR/.$PACKAGE
+ G=$(grep-dctrl -S -n -s Directory,Version $PACKAGE ../../Sources)
+ set -- $G
+ DIR=$1 VER=$2
+ dget -x ${MIRROR}/debian/${DIR}/${PACKAGE}_${VER}.dsc > /dev/null 2> $LOGDIR/.$PACKAGE
+
+ cd $(find . -type d ! -name .)
+ mkdir -p $BUILDDIR/$PACKAGE/result
+ pdebuild --pbuilder cowbuilder --use-pdebuild-internal --buildresult $BUILDDIR/$PACKAGE/result/ -- --basepath $BASEPATH >> $LOGDIR/.$PACKAGE 2>&1
+
+ if [ $? -eq 0 ]; then
+ mv $LOGDIR/.$PACKAGE $LOGDIR/succeeded-$PACKAGE
+ log_action_end_msg 0
+ else
+ mv $LOGDIR/.$PACKAGE $LOGDIR/failed-$PACKAGE
+ log_action_end_msg 1
+ fi
+
+ cd $BUILDDIR
+ rm -rf $PACKAGE
+}
+
+
+[ -d $LOGDIR ] || mkdir $LOGDIR
+
+if [ ! -e "$LIST" ]; then
+ log_failure_msg "No Buildlist given."
+ exit 1
+fi
+
+while read package; do
+ # Create Lockfile (ln -s is atomic and fails if link already exists)
+ ln -s $package $LOGDIR/.$package.lock 2> /dev/null || continue
+
+ # Build the package if not already built
+ if [ ! -e $LOGDIR/succeeded-$package -a ! -e $LOGDIR/failed-$package ]; then
+ log_action_begin_msg "$(date +%F\ %T) Building $package "
+ build $package
+ fi
+
+ # Remove Lockfile
+ rm -f $LOGDIR/.$package.lock
+done < $LIST
diff --git a/examples/rebuild/getlist b/examples/rebuild/getlist
new file mode 100755
index 0000000..caf9c5f
--- /dev/null
+++ b/examples/rebuild/getlist
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+DIST=$1
+
+BUILD_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
+MIRROR=http://ftp.at.debian.org
+
+if [ -z $DIST ]; then
+ echo "No distribution given."
+ exit 1
+fi
+
+wget -q ${MIRROR}/debian/dists/$DIST/main/source/Sources.gz -O Sources.main.gz
+wget -q ${MIRROR}/debian/dists/$DIST/contrib/source/Sources.gz -O Sources.contrib.gz
+zcat Sources.main.gz Sources.contrib.gz > Sources
+
+grep -E "^Package|^Architecture|^$" Sources | paste -s -d "=" | sed "s/==/\n/g" | sed "s/=/ /g" | cut -d " " -f 2,4- > list.$DIST
+grep -E " all| any| $BUILD_ARCH" list.$DIST | cut -d " " -f 1 > list.$DIST.$BUILD_ARCH
+
+rm -f Sources.main.gz Sources.contrib.gz
+