summaryrefslogtreecommitdiffstats
path: root/devbuild.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-08 13:33:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-08 13:33:34 +0000
commit3d79fb7036e5c42fbe00689f78c222fe66a22a44 (patch)
treecdcc7545290339ffdbfe438c16120c4753bd2e49 /devbuild.in
parent4aee935d8c8d9410f3557be7bc3ee4bce639a6e5 (diff)
downloadabuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.tar.bz2
abuild-3d79fb7036e5c42fbe00689f78c222fe66a22a44.tar.xz
use .in files for scripts
Diffstat (limited to 'devbuild.in')
-rwxr-xr-xdevbuild.in61
1 files changed, 61 insertions, 0 deletions
diff --git a/devbuild.in b/devbuild.in
new file mode 100755
index 0000000..054d02d
--- /dev/null
+++ b/devbuild.in
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# This scripts will:
+# 1. create a dist package for current subproject
+# 2. update the APKBUILD and build the package
+# 3. build the alpine iso
+#
+# The following is assumed from the subproject:
+# * that PACKAGE and VERSION is set in Makefile or defined in a local
+# devbuild.conf file
+# * that 'make dist' will generate a valid dist package
+#
+
+program=${0##*/}
+
+# rebuild env. Those values can be overridden in either
+# /etc/devbuildrc or $HOME/.devbuildrc
+DISTFILES=/var/cache/distfiles
+APORTS_DIR=$HOME/aports
+ALPINE_DIR=$HOME/abuild
+
+# for the local project. Those values can be overridden by
+# a .devbuildrc in the subprojects dir
+PACKAGE=$(grep '^PACKAGE' Makefile | sed 's/.*=[[:blank:]]*//')
+VERSION=$(grep '^VERSION' Makefile | sed 's/.*=[[:blank:]]*//')
+SUFFIX=.tar.bz2
+REPO=core
+
+# let user override the above defaults
+for i in /etc/${program}rc $HOME/.${program}rc ./.${program}rc; do
+ if [ -f $i ]; then
+ . $i
+ fi
+done
+
+# generate a new dist package
+tarball=${PACKAGE}-${VERSION}${SUFFIX}
+make dist || exit 1
+cp $tarball "$DISTFILES/" || exit 1
+
+# update the APKBUILD, in a subshell
+(
+ cd $APORTS_DIR/$REPO/$PACKAGE || exit 1
+ . ./APKBUILD
+ if [ "$pkgver" = "$VERSION" ]; then
+ pkgrel=$(( $pkgrel + 1 ))
+ else
+ pkgrel="0"
+ fi
+ sed -i -e " s/^pkgver=.*/pkgver=$VERSION/;
+ s/^pkgrel=.*/pkgrel=$pkgrel/;
+ /^md5sums=\"/,/\"\$/d" APKBUILD || exit 1
+ export SRCDEST="$DISTFILES"
+ abuild checksum
+ abuild
+ abuild cleanoldpkg
+) || exit 1
+
+# rebuild the iso
+cd "$ALPINE_DIR" && fakeroot ./mkalpine
+