summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-07-26 10:02:24 +0000
committerTimo Teräs <timo.teras@iki.fi>2016-07-26 10:11:46 +0000
commit34081a17198f96d131a64ea0ee454a2e13967df7 (patch)
treeab3df6b7b9419ea2aaa8cfc85766cc2680720ed9
parenta1364565d27d7d318d0eae4eb7679831395aa6fc (diff)
downloadabuild-34081a17198f96d131a64ea0ee454a2e13967df7.tar.bz2
abuild-34081a17198f96d131a64ea0ee454a2e13967df7.tar.xz
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.
-rw-r--r--abuild.in34
1 files changed, 19 insertions, 15 deletions
diff --git a/abuild.in b/abuild.in
index d3e4b02..ee36517 100644
--- a/abuild.in
+++ b/abuild.in
@@ -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
}