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
1 changed files with 19 additions and 15 deletions

View File

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