From fa96f6679ae0df69e817bbb68ff98d4b98dc3619 Mon Sep 17 00:00:00 2001 From: dolik Date: Fri, 27 Jan 2012 22:41:17 +0000 Subject: [PATCH] .lpbuild2: local builds capability git-svn-id: svn://ultimatepp.org/upp/trunk@4478 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppbox/lpbuild2/Makefile | 3 -- uppbox/lpbuild2/localbuild.sh | 28 +++++++++++++++ uppbox/lpbuild2/lpbuild.sh | 7 ++-- uppbox/lpbuild2/pbuilderrc | 68 +++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 6 deletions(-) create mode 100755 uppbox/lpbuild2/localbuild.sh create mode 100644 uppbox/lpbuild2/pbuilderrc diff --git a/uppbox/lpbuild2/Makefile b/uppbox/lpbuild2/Makefile index faa306be5..6e8f6db90 100644 --- a/uppbox/lpbuild2/Makefile +++ b/uppbox/lpbuild2/Makefile @@ -12,16 +12,13 @@ ARCH="`dpkg-architecture -qDEB_HOST_ARCH`" ide: sed -i -e 's/IDE_VERSION[ \t]*"\([0-9]*\)[^"]*"/IDE_VERSION "\1-'$(SERIES)-$(ARCH)'"/' $(CURDIR)/uppsrc/ide/version.h $(MAKE) -f mkfile $(JOBS) PKG=ide $(compiler) "NESTS=uppsrc" "FLAGS=GUI MT GCC SHARED" BINEXT= "BINPREFIX=" - #cp /usr/bin/theide $@ ide-nogtk: sed -i -e 's/IDE_VERSION[ \t]*"\([0-9]*\)[^"]*"/IDE_VERSION "\1-'$(SERIES)-$(ARCH)'-nogtk"/' $(CURDIR)/uppsrc/ide/version.h $(MAKE) -f mkfile $(JOBS) PKG=ide $(compiler) "NESTS=uppsrc" "FLAGS=GUI MT NOGTK GCC SHARED" BINEXT=-nogtk "BINPREFIX=" - #cp /usr/bin/theide $@ umk: $(MAKE) -f mkfile $(JOBS) PKG=umk $(compiler) "NESTS=uppsrc" "FLAGS=GCC SHARED" BINEXT= "BINPREFIX=" - #cp /usr/bin/theide $@ install: # this is just a trick to rename files diff --git a/uppbox/lpbuild2/localbuild.sh b/uppbox/lpbuild2/localbuild.sh new file mode 100755 index 000000000..0944b221b --- /dev/null +++ b/uppbox/lpbuild2/localbuild.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -e +# This scripts is meant to create deb packages for stable releases. It will best +# work with ubuntu, but it should work on debian and even other distros, as long +# as pbuilder, debootstrap and devscripts packages are available. + +# set desired architectures and distributions +archs="i386 amd64" +dists="karmic lucid maverick natty oneiric squeeze wheezy sid" + +# prepare source packages +stable=1 +noupload=1 +scriptpath="$(cd ${0%/*} 2>/dev/null || true; echo $PWD/${0##*/})" +. "$(dirname $scriptpath)/lpbuild.sh" + +for dist in $dists; do + for arch in $archs; do + # create the chroot if it doesn't exist yet + if [ ! -f "/var/cache/pbuilder/$NAME-base.tgz" ]; then + DIST=$dist ARCH=$arch pbuilder --create --configfile "$scriptdir/pbuilderrc" --distribution $dist --architecture $arch + fi; + # build the binary packages + DIST=$dist ARCH=$arch pbuilder --build --configfile "$scriptdir/pbuilderrc" --distribution $dist --architecture $arch "$TMP/upp_${version}-0~${dist}0.dsc" + done +done + +echo "Done!" diff --git a/uppbox/lpbuild2/lpbuild.sh b/uppbox/lpbuild2/lpbuild.sh index a98f0f596..2f41961e7 100755 --- a/uppbox/lpbuild2/lpbuild.sh +++ b/uppbox/lpbuild2/lpbuild.sh @@ -26,7 +26,7 @@ elif [ -d "$tmp" ]; then exit 1 fi -dists="karmic lucid maverick natty oneiric" +[ -z "$dists" ] && dists="karmic lucid maverick natty oneiric" scriptpath="$(cd ${0%/*} 2>/dev/null || true; echo $PWD/${0##*/})" scriptdir="$(dirname $scriptpath)" src="$SRCDIR/upp-x11-src-$version.tar.gz" @@ -38,7 +38,7 @@ cp -r "$scriptdir/debian" "$tmp/debian" for f in Makefile mkfile copyright theide.1 theide.desktop; do cp "$scriptdir/$f" "$tmp/$f" done -[ "$1" = "stable" ] && sed -i '/code.google/s/^/#/;/sf.net/s/^#//;' "$tmp/debian/watch" +[ "$stable" = 1 ] && sed -i '/code.google/s/^/#/;/sf.net/s/^#//;' "$tmp/debian/watch" ln -s "$src" "$TMP/upp_$version.orig.tar.gz" cd $tmp @@ -62,6 +62,7 @@ EOF [ "$skiporig" ] || dpkg-source --commit . packaging packaging.patch dpkg-buildpackage -d -S -k$GPG_KEY -m'Jan Dolinar ' -sgpg -p$GPG_PROG $skiporig - dput -c "$scriptdir/dput.cfg" "upp-$dist" "../upp_"$distver"_source.changes" + [ "$noupload" = 1 ] || dput -c "$scriptdir/dput.cfg" "upp-$dist" "../upp_"$distver"_source.changes" skiporig="-sd" done +set -e diff --git a/uppbox/lpbuild2/pbuilderrc b/uppbox/lpbuild2/pbuilderrc new file mode 100644 index 000000000..84b0de1db --- /dev/null +++ b/uppbox/lpbuild2/pbuilderrc @@ -0,0 +1,68 @@ +# Codenames for Debian suites according to their alias. Update these when +# needed. +UNSTABLE_CODENAME="sid" +TESTING_CODENAME="wheezy" +STABLE_CODENAME="squeeze" +STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports" + +# List of Debian suites. +DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME + "unstable" "testing" "stable") + +# List of Ubuntu suites. Update these when needed. +UBUNTU_SUITES=("precise" "oneiric" "natty" "maverick" "lucid" "karmic" "jaunty" "hardy") + +# Mirrors to use. Update these to your preferred mirror. +DEBIAN_MIRROR="ftp.de.debian.org" +UBUNTU_MIRROR="ftp.ubuntu.com" + +# Optionally use the changelog of a package to determine the suite to use if +# none set. +if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then + DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}') + DIST="${DIST%%-*}" + # Use the unstable suite for certain suite values. + if $(echo "experimental UNRELEASED" | grep -q $DIST); then + DIST="$UNSTABLE_CODENAME" + fi +fi + +# Optionally change Debian release states in $DIST to their names. +case "$DIST" in + unstable) + DIST="$UNSTABLE_CODENAME" + ;; + testing) + DIST="$TESTING_CODENAME" + ;; + stable) + DIST="$STABLE_CODENAME" + ;; +esac + +NAME="$DIST" +if [ -n "${ARCH}" ]; then + NAME="$NAME-$ARCH" + DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}") +fi +BASETGZ="/var/cache/pbuilder/$NAME-base.tgz" +DISTRIBUTION="$DIST" +BUILDRESULT="/var/cache/pbuilder/$NAME/result/" +APTCACHE="/var/cache/pbuilder/$NAME/aptcache/" +BUILDPLACE="/var/cache/pbuilder/build/" + +if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then + # Debian configuration + MIRRORSITE="http://$DEBIAN_MIRROR/debian/" + COMPONENTS="main contrib non-free" + DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg") + +elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then + # Ubuntu configuration + MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/" + COMPONENTS="main restricted universe multiverse" + DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg") +else + echo "Unknown distribution: $DIST" + exit 1 +fi