abuild: treat subpackages items as colon separated lists

This is in preparation to support subpackages="pkg:split:arch"
syntax, and just makes the current code ignore anything after
the second colon if it exists. This allows to use the new syntax
in aports git without running experimental abuild on the official
builders.
This commit is contained in:
Timo Teräs 2016-07-26 10:02:24 +00:00
parent a1364565d2
commit 34081a1719

View File

@ -128,7 +128,7 @@ default_sanitycheck() {
# check so no package names starts with - # check so no package names starts with -
for i in $pkgname $subpackages; do for i in $pkgname $subpackages; do
case $i in case $i in
-*) die "${i%:*} is not a valid package name";; -*) die "${i%%:*} is not a valid package name";;
esac esac
done done
@ -444,7 +444,7 @@ cleancache() {
listpkgnames() { listpkgnames() {
local i local i
for i in $pkgname $subpackages; do for i in $pkgname $subpackages; do
echo ${i%:*} echo ${i%%:*}
done done
for i in $linguas; do for i in $linguas; do
echo $pkgname-lang-$i echo $pkgname-lang-$i
@ -456,7 +456,7 @@ cleanpkg() {
getpkgver || return 1 getpkgver || return 1
msg "Cleaning built packages..." msg "Cleaning built packages..."
for i in $(listpkgnames); do for i in $(listpkgnames); do
local p="${i%:*}-$pkgver-r$pkgrel" local p="${i%%:*}-$pkgver-r$pkgrel"
rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \ rm -f "$PKGDEST/$p.apk" "$PKGDEST/$p.src.tar.gz" \
"$abuildrepo"/$p.apk "$abuildrepo"/*/$p.apk "$abuildrepo"/$p.apk "$abuildrepo"/*/$p.apk
done done
@ -470,7 +470,7 @@ cleanoldpkg() {
getpkgver || return 1 getpkgver || return 1
msg "Cleaning all packages except $pkgver-r$pkgrel..." msg "Cleaning all packages except $pkgver-r$pkgrel..."
for i in $(listpkgnames); do for i in $(listpkgnames); do
local pn=${i%:*} local pn=${i%%:*}
for j in "$PKGDEST"/$pn-[0-9]*.apk ; do for j in "$PKGDEST"/$pn-[0-9]*.apk ; do
[ "$j" = "$PKGDEST/$pn-$pkgver-r$pkgrel.apk" ] \ [ "$j" = "$PKGDEST/$pn-$pkgver-r$pkgrel.apk" ] \
&& continue && continue
@ -576,12 +576,15 @@ targz() {
} }
get_split_func() { get_split_func() {
# get the 'func' from "sub-pkg:func" # get the 'func' from "sub-pkg:func:arch"
local func=${1##*:} local _splitarch=${1#*:}
[ "$_splitarch" = "$1" ] && _splitarch=""
# get 'func' from "sub-pkg-func" if there was no :func local _split=${_splitarch%:*}
[ "$func" = "$1" ] && func=${func##*-} if [ -z "$_split" ]; then
echo $func local _name=${1%%:*}
_split="${_name##*-}"
fi
echo $_split
} }
postcheck() { postcheck() {
@ -685,7 +688,7 @@ prepare_subpackages() {
local func=$(get_split_func $i) local func=$(get_split_func $i)
# call abuild recursively, setting subpkg{dir,name} # call abuild recursively, setting subpkg{dir,name}
msg "Running split function $func..." msg "Running split function $func..."
local dir="$pkgbasedir/${i%:*}" name="${i%:*}" local dir="$pkgbasedir/${i%%:*}" name="${i%%:*}"
( subpkgdir="$dir" subpkgname="$name" \ ( subpkgdir="$dir" subpkgname="$name" \
$0 pre_split $func prepare_package \ $0 pre_split $func prepare_package \
&& postcheck "$dir" "$name" ) || return 1 && postcheck "$dir" "$name" ) || return 1
@ -1652,7 +1655,7 @@ apk_up2date() {
local i s local i s
cd "$startdir" cd "$startdir"
for i in $pkgname $subpackages; do for i in $pkgname $subpackages; do
[ -f "$PKGDEST/${i%:*}-$pkgver-r$pkgrel.apk" ] || return 1 [ -f "$PKGDEST/${i%%:*}-$pkgver-r$pkgrel.apk" ] || return 1
done done
[ -n "$keep" ] && return 0 [ -n "$keep" ] && return 0
@ -1674,7 +1677,7 @@ abuildindex_up2date() {
local i local i
getpkgver || return 1 getpkgver || return 1
local dir="$abuildrepo"/$CARCH local dir="$abuildrepo"/$CARCH
local apk="${pkgname%:*}-$pkgver-r$pkgrel.apk" local apk="${pkgname%%:*}-$pkgver-r$pkgrel.apk"
local idx="$dir"/APKINDEX.tar.gz local idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$apk local file="$dir"/$apk
@ -1959,7 +1962,7 @@ source_has() {
subpackages_has() { subpackages_has() {
local i local i
for i in $subpackages; do for i in $subpackages; do
[ "$1" = "${i%:*}" ] && return 0 [ "$1" = "${i%%:*}" ] && return 0
done done
return 1 return 1
} }
@ -1967,7 +1970,8 @@ subpackages_has() {
subpackage_types_has() { subpackage_types_has() {
local i local i
for i in $subpackages; do for i in $subpackages; do
[ "$1" = "${i##*-}" ] && return 0 local _name="${i%%:*}"
[ "$1" = "${_name##*-}" ] && return 0
done done
return 1 return 1
} }