summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-11-06 16:08:30 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-11-06 16:08:30 +0000
commitbd245c07d7bfe758c6483d0333968d4b918f7233 (patch)
tree0fc2afa7f5ab76759cd50b9356a2f5e03c02fe3d
parent59bcc571dadaf1054016d4ac8d0a992d0b3a29d2 (diff)
downloadabuild-bd245c07d7bfe758c6483d0333968d4b918f7233.tar.gz
abuild-bd245c07d7bfe758c6483d0333968d4b918f7233.tar.bz2
abuild-bd245c07d7bfe758c6483d0333968d4b918f7233.tar.xz
abuild-bd245c07d7bfe758c6483d0333968d4b918f7233.zip
implement new way of doing subpackages
subpackages contains a list of (full) names of the sub packages splitfuncs contains a list of corresponding function names to be called
-rwxr-xr-xabuild47
1 files changed, 30 insertions, 17 deletions
diff --git a/abuild b/abuild
index b479b94..36830f3 100755
--- a/abuild
+++ b/abuild
@@ -29,8 +29,8 @@ all_cmds="checksum fetch unpack rootpkg build package cleancache clean srcpkg"
# functions
msg() {
local sub=
- [ -n "$INSUB" ] && sub="(sub)"
- [ -z "$quiet" ] && echo ">>> $pkgname $sub:" "$@" >&2
+ [ -n "$subpkgname" ] && sub="(sub)"
+ [ -z "$quiet" ] && echo ">>> ${subpkgname:-$pkgname} $sub:" "$@" >&2
}
warning() {
@@ -55,6 +55,14 @@ sanitycheck() {
[ -z "$url" ] && die "Missing url in APKBUILD"
[ -z "$license" ] && die "Missing license in APKBULID"
+ if [ "$(echo $source | wc -l)" -ne "$(echo $md5sums | wc -l)" ]; then
+ die "Number of md5sums does not correspond to number of sources"
+ fi
+
+ if [ "$(echo $subpackages | wc -w)" -ne "$(echo $splitfuncs | wc -w)" ]; then
+ die "Number of subpackages does not correspond to number of splitfuncs"
+ fi
+
# common spelling errors
[ -n "$depend" ] && die "APKBUILD contains 'depend'. It should be depends"
[ -n "$makedepend" ] && die "APKBUILD contains 'makedepend'. It should be makedepends"
@@ -154,11 +162,10 @@ cleancache() {
}
cleanpkg() {
- local p="$pkgname-$pkgver-$pkgrel"
- rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz"
local i
- for i in $splitfuncs; do
- INSUB=1 subpkgdir="$pkgdir-$i" $0 $i cleanpkg
+ for i in $pkgname $subpackages; do
+ local p="$i-$pkgver-$pkgrel"
+ rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz"
done
}
@@ -174,18 +181,24 @@ build() {
}
subpkg() {
- [ -z "$splitfuncs" ] && return 0
+ if [ -z "$splitfuncs" ] && [ -z "$subpackages" ]; then
+ return 0
+ fi
local i
cd "$startdir"
- for i in $splitfuncs; do
- INSUB=1 subpkgdir="$pkgdir-$i" $0 $i package || return 1
+ set $splitfuncs
+ for i in $subpackages; do
+ subpkgdir="$startdir/pkg-$1" subpkgname="$i" $0 $1 package \
+ || return 1
+ shift
done
}
package_apk() {
- [ -z "${pkgname##* *}" ] && die "pkgname contains spaces"
+ local name=${subpkgname:-$pkgname}
+ [ -z "${name##* *}" ] && die "package name contains spaces"
local dir=${subpkgdir:-$pkgdir}
- local pkg="$pkgname-$pkgver-$pkgrel.apk"
+ local pkg="$name-$pkgver-$pkgrel.apk"
[ ! -d "$dir" ] && die "Missing $dir"
cd "$dir"
@@ -199,7 +212,7 @@ package_apk() {
fi
echo "# $(date -u)" >> .PKGINFO
cat >> .PKGINFO <<EOF
-pkgname = $pkgname
+pkgname = $name
pkgver = $pkgver-$pkgrel
pkgdesc = $pkgdesc
url = $url
@@ -250,7 +263,6 @@ package() {
# predefined splitfunc doc
doc() {
- pkgname="$pkgname-doc"
depends=""
local i
for i in doc man info html sgml; do
@@ -269,7 +281,6 @@ doc() {
# predefined splitfunc mod
mod() {
- pkgname="$pkgname-mod"
depends="$kernel"
for i in firmware modules; do
if [ -d "$pkgdir/lib/$i" ]; then
@@ -283,7 +294,6 @@ mod() {
# predefined splitfunc dev
dev() {
depends="$pkgname"
- pkgname="$pkgname-dev"
for i in $(cd "$pkgdir" && find usr/lib -name '*.a' -o \
-name '*.la' -o -name '*.o' 2>/dev/null) \
usr/include usr/lib/pkgconfig usr/share/aclocal; do
@@ -377,8 +387,11 @@ shift $(( $OPTIND - 1 ))
[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)"
. "$APKBUILD"
-# If we are handling a sub package then reset splitfuncs
-[ -n "$INSUB" ] && splitfuncs=
+# If we are handling a sub package then reset splitfuncs and subpackages
+if [ -n "$subpkgname" ]; then
+ splitfuncs=
+ subpackages=
+fi
trap 'die "Aborted by user"' INT