summaryrefslogtreecommitdiff
path: root/abuild
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2008-11-07 07:43:31 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2008-11-07 07:43:31 +0000
commit56741bede26dd2954309219dea0325b504b99012 (patch)
tree557edb2815224326eb2f24795c8942fe1cd53208 /abuild
parentfc3d67b16fc88c132d4925830131cb05d033c428 (diff)
downloadabuild-56741bede26dd2954309219dea0325b504b99012.tar.gz
abuild-56741bede26dd2954309219dea0325b504b99012.tar.bz2
abuild-56741bede26dd2954309219dea0325b504b99012.tar.xz
abuild-56741bede26dd2954309219dea0325b504b99012.zip
do not use splitfuncs variable
the split function name is extraced from the subpackage name in subpackages variable in one of the following formats: 1. subpackage:func The ':' serves as a separator. subpackage is first part, function second 2. subpackage-func Without ':' separator, the subpackage is the entire string. In the example above, the package name is 'subpackage-func'. Function is extracted from the text after last '-'. 3. subpackage Without either ':' and '-' the function name will be the subpackage name itself.
Diffstat (limited to 'abuild')
-rwxr-xr-xabuild30
1 files changed, 17 insertions, 13 deletions
diff --git a/abuild b/abuild
index c047000..574a70c 100755
--- a/abuild
+++ b/abuild
@@ -59,10 +59,6 @@ sanitycheck() {
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"
@@ -145,8 +141,8 @@ clean() {
rm -rf "$srcdir"
rm -rf "$pkgdir"
local i
- for i in $splitfuncs; do
- rm -rf "$pkgdir-$i"
+ for i in $subpackages; do
+ rm -rf "$pkgdir-$(get_split_func $i)"
done
}
@@ -180,17 +176,26 @@ build() {
die "No build() function found in $APKBUILD"
}
+get_split_func() {
+ # get the 'func' from "sub-pkg:func"
+ local func=${1##*:}
+
+ # get 'func' from "sub-pkg-func" if there was no :func
+ [ "$func" = "$1" ] && func=${func##*-}
+ echo $func
+}
+
subpkg() {
- if [ -z "$splitfuncs" ] && [ -z "$subpackages" ]; then
+ if [ -z "$subpackages" ]; then
return 0
fi
local i
cd "$startdir"
- set $splitfuncs
for i in $subpackages; do
- subpkgdir="$startdir/pkg-$1" subpkgname="$i" $0 $1 package \
- || return 1
- shift
+ local func=$(get_split_func $i)
+ # call abuild recursively, setting subpkg{dir,name}
+ subpkgdir="$startdir/pkg-$func" subpkgname="$i" \
+ $0 $func package || return 1
done
}
@@ -387,9 +392,8 @@ shift $(( $OPTIND - 1 ))
[ -f "$APKBUILD" ] || die "Could not find $APKBUILD (PWD=$PWD)"
. "$APKBUILD"
-# If we are handling a sub package then reset splitfuncs and subpackages
+# If we are handling a sub package then reset subpackages
if [ -n "$subpkgname" ]; then
- splitfuncs=
subpackages=
fi