summaryrefslogtreecommitdiff
path: root/rebuildpkgs.in
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2011-08-29 10:53:50 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-10-07 21:53:02 +0200
commit46c4def0733a78ce08702d188e3e1a141fb07316 (patch)
tree69fb80eff39981680faeeba01f88be48026fc05f /rebuildpkgs.in
parent142b032212fd94c0fde75a3dd223444c212c2eaa (diff)
Support non-standard install locations
This build system overhaul allows for adding (define-style) macros to our scripts. All source files are now suffixed with ".in" to clarify that they might contain unprocessed defines. The Makefile provides a new rule to preprocess source files and generate proper output scripts. Also, add a "@pkgdatadir@" define (as used in GNU Autotools) and use it instead of hardcoded paths to "/usr/share/devtools" everywhere. We missed this when adding PREFIX support to the build system in commit 35fc83ce7d8dc26cd424321f2e8638d05da0a6d4. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'rebuildpkgs.in')
-rw-r--r--rebuildpkgs.in101
1 files changed, 101 insertions, 0 deletions
diff --git a/rebuildpkgs.in b/rebuildpkgs.in
new file mode 100644
index 0000000..be279bb
--- /dev/null
+++ b/rebuildpkgs.in
@@ -0,0 +1,101 @@
+#!/bin/bash
+# This script rebuilds a list of packages in order
+# and reports anything that fails
+#
+# Due to sudo usage, it is recommended to allow makechrootpkg
+# to be run with NOPASSWD in your sudoers file
+#
+# FIXME
+# Currently uses $(pwd)/rebuilds as the directory for rebuilding...
+# TODO make this work for community too
+
+if [ $# -le 1 ]; then
+ echo "usage: $(basename $0) <chrootdir> <packages to rebuild>"
+ echo " example: $(basename $0) ~/chroot readline bash foo bar baz"
+ exit 1
+fi
+
+# Source makepkg.conf; fail if it is not found
+if [ -r '/etc/makepkg.conf' ]; then
+ source '/etc/makepkg.conf'
+else
+ echo '/etc/makepkg.conf not found!'
+ exit 1
+fi
+
+die () {
+ echo $@ >&2
+ exit 1
+}
+
+bump_pkgrel() {
+ # Get the current pkgrel from SVN and update the working copy with it
+ # This prevents us from incrementing out of control :)
+ pbuild='.svn/text-base/PKGBUILD.svn-base'
+ oldrel=$(grep 'pkgrel=' $pbuild | cut -d= -f2)
+
+ #remove decimals
+ rel=$(echo $oldrel | cut -d. -f1)
+
+ newrel=$(($rel + 1))
+
+ sed -i "s/pkgrel=$oldrel/pkgrel=$newrel/" PKGBUILD
+}
+
+pkg_from_pkgbuild() {
+ # we want the sourcing to be done in a subshell so we don't pollute our current namespace
+ export CARCH PKGEXT
+ (source PKGBUILD; echo "$pkgname-$pkgver-$pkgrel-$CARCH$PKGEXT")
+}
+
+chrootdir="$1"; shift
+pkgs="$@"
+
+SVNPATH='svn+ssh://gerolde.archlinux.org/srv/svn-packages'
+
+echo ":: Work will be done in $(pwd)/rebuilds"
+
+REBUILD_ROOT="$(pwd)/rebuilds"
+mkdir -p "$REBUILD_ROOT"
+cd "$REBUILD_ROOT"
+
+/usr/bin/svn co -N $SVNPATH
+
+FAILED=""
+for pkg in $pkgs; do
+ cd "$REBUILD_ROOT/svn-packages"
+
+ echo ":: Building '$pkg'"
+ /usr/bin/svn update "$pkg"
+ if [ ! -d "$pkg/trunk" ]; then
+ FAILED="$FAILED $pkg"
+ echo ":: $pkg does not exist in SVN"
+ continue
+ fi
+ cd "$pkg/trunk/"
+
+ bump_pkgrel
+
+ if ! sudo makechrootpkg -u -d -r "$chrootdir" -- --noconfirm; then
+ FAILED="$FAILED $pkg"
+ echo ":: $pkg Failed!"
+ else
+ pkgfile=$(pkg_from_pkgbuild)
+ if [ -e "$pkgfile" ]; then
+ echo ":: $pkg Complete"
+ else
+ FAILED="$FAILED $pkg"
+ echo ":: $pkg Failed, no package built!"
+ fi
+ fi
+done
+
+cd "$REBUILD_ROOT"
+if [ "$FAILED" != "" ]; then
+ echo 'Packages failed:'
+ for pkg in $FAILED; do
+ echo -e "\t$pkg"
+ done
+fi
+
+echo 'SVN pkgbumps in svn-packages/ - commit when ready'