diff options
-rwxr-xr-x | abuild | 30 |
1 files changed, 17 insertions, 13 deletions
@@ -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 |