diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2008-11-07 07:43:31 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2008-11-07 07:43:31 +0000 |
commit | 56741bede26dd2954309219dea0325b504b99012 (patch) | |
tree | 557edb2815224326eb2f24795c8942fe1cd53208 | |
parent | fc3d67b16fc88c132d4925830131cb05d033c428 (diff) | |
download | abuild-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.
-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 |