Commit 8c8d741b authored by Timo Teräs's avatar Timo Teräs

abuild: use subpkgarch to construct the package paths everywhere

parent f7e2b48d
...@@ -456,25 +456,17 @@ subpkg_set() { ...@@ -456,25 +456,17 @@ subpkg_set() {
fi fi
} }
listpkgnames() {
local i
for i in $pkgname $subpackages; do
echo ${i%%:*}
done
for i in $linguas; do
echo $pkgname-lang-$i
done
}
cleanpkg() { cleanpkg() {
local i local i
getpkgver || return 1 getpkgver || return 1
msg "Cleaning built packages..." msg "Cleaning built packages..."
for i in $(listpkgnames); do rm -f "$REPODEST/$repo/src/$pkgname-$pkgver-r$pkgrel.src.tar.gz"
local p="${i%%:*}-$pkgver-r$pkgrel" for i in $allpackages; do
rm -f "$REPODEST/$repo/$CARCH/$p.apk" \ subpkg_set "$i"
"$REPODEST/$repo/src/$p.src.tar.gz" rm -f "$REPODEST/$repo/$subpkgarch/$subpkgname-$pkgver-r$pkgrel.apk"
done done
subpkg_unset
# remove given packages from index # remove given packages from index
update_abuildrepo_index update_abuildrepo_index
} }
...@@ -484,14 +476,15 @@ cleanoldpkg() { ...@@ -484,14 +476,15 @@ cleanoldpkg() {
local i j local i j
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 $allpackages; do
local pn=${i%%:*} subpkg_set "$i"
for j in "$REPODEST"/$repo/*/$pn-[0-9]*.apk ; do for j in "$REPODEST"/$repo/*/$subpkgname-[0-9]*.apk ; do
[ "${j##*/}" = "$pn-$pkgver-r$pkgrel.apk" ] \ [ "${j##*/}" = "$subpkgname-$pkgver-r$pkgrel.apk" ] \
&& continue && continue
rm -f "$j" rm -f "$j"
done done
done done
subpkg_unset
update_abuildrepo_index update_abuildrepo_index
return 0 return 0
} }
...@@ -738,6 +731,7 @@ lang_subpkg() { ...@@ -738,6 +731,7 @@ lang_subpkg() {
} }
prepare_language_packs() { prepare_language_packs() {
local lang
for lang in $linguas; do for lang in $linguas; do
lang="$lang" \ lang="$lang" \
subpkgname="$pkgname-lang-$lang" \ subpkgname="$pkgname-lang-$lang" \
...@@ -1319,6 +1313,7 @@ create_apks() { ...@@ -1319,6 +1313,7 @@ create_apks() {
local apk=$name-$ver.apk local apk=$name-$ver.apk
local datadir="$pkgbasedir"/$name local datadir="$pkgbasedir"/$name
local subpkgname=$name local subpkgname=$name
local subpkgarch=$(pkginfo_val arch $file)
trace_apk_deps "$name" "$dir" || return 1 trace_apk_deps "$name" "$dir" || return 1
msg "Package size: ${size}" msg "Package size: ${size}"
...@@ -1345,9 +1340,8 @@ create_apks() { ...@@ -1345,9 +1340,8 @@ create_apks() {
abuild-sign -q control.tar.gz || exit 1 abuild-sign -q control.tar.gz || exit 1
msg "Create $apk" msg "Create $apk"
# create the final apk mkdir -p "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}
mkdir -p "$REPODEST"/$repo/$CARCH cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}/$apk
cat control.tar.gz data.tar.gz > "$REPODEST"/$repo/$CARCH/$apk
) )
done done
} }
...@@ -1371,23 +1365,38 @@ build_abuildrepo() { ...@@ -1371,23 +1365,38 @@ build_abuildrepo() {
} }
update_abuildrepo_index() { update_abuildrepo_index() {
cd "$REPODEST/$repo" local i allarch=""
local index=$CARCH/APKINDEX.tar.gz for i in $allpackages; do
subpkg_set "$i"
msg "Updating the cached abuild repository index..." ##NOARCH: These packages are really in $CARCH and do not need their
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}" # own repository. --rewrite-arch is used below to make sure the index
local oldindex= # thinks they are for $CARCH and apk-tools will fetch them from
if [ -f "$index" ]; then # correct URL path. Remainder of the script uses ${subpkgarch/noarch/$CARCH}
oldindex="--index $index" # when expanding to the target repository path.
fi [ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
$APK index --quiet $oldindex --output "$index".unsigned \ list_has "$subpkgarch" "$allarch" || allarch="$allarch $subpkgarch"
--description "$repo $(cd $startdir && git describe)" \ done
--rewrite-arch $CARCH \ subpkg_unset
$CARCH/*.apk || exit 1
msg "Signing the index..." for i in $allarch; do
abuild-sign -q "$index".unsigned || exit 1 cd "$REPODEST/$repo/$i"
mv "$index".unsigned "$index" local index=$i/APKINDEX.tar.gz
chmod 644 "$index"
msg "Updating the $repo/$i repository index..."
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}"
local oldindex=
if [ -f APKINDEX.tar.gz ]; then
oldindex="--index APKINDEX.tar.gz"
fi
( $APK index --quiet $oldindex --output APKINDEX.tar.gz.$$ \
--description "$repo $(cd $startdir && git describe)" \
--rewrite-arch $i *.apk && \
msg "Signing the index..." && \
abuild-sign -q APKINDEX.tar.gz.$$ && \
chmod 644 APKINDEX.tar.gz.$$ && \
mv APKINDEX.tar.gz.$$ APKINDEX.tar.gz \
) || (rm -f APKINDEX.tar.gz.$$ ; die "Failed to create index")
done
} }
# predefined splitfunc doc # predefined splitfunc doc
...@@ -1614,22 +1623,26 @@ check_libc() { ...@@ -1614,22 +1623,26 @@ check_libc() {
# check if package is up to date # check if package is up to date
apk_up2date() { apk_up2date() {
getpkgver || return 1 getpkgver || return 1
local pkg="$REPODEST/$repo/$CARCH/$pkgname-$pkgver-r$pkgrel.apk"
local i s local i s
cd "$startdir" for i in $allpackages; do
for i in $pkgname $subpackages; do subpkg_set "$i"
[ -f "$REPODEST/$repo/$CARCH/${i%:*}-$pkgver-r$pkgrel.apk" ] || return 1 if [ ! -f "$REPODEST/$repo/${subpkgarch/noarch/$CARCH}/$subpkgname-$pkgver-r$pkgrel.apk" ]; then
subpkg_unset
return 1
fi
done done
subpkg_unset
[ -n "$keep" ] && return 0 [ -n "$keep" ] && return 0
cd "$startdir"
for i in $source APKBUILD; do for i in $source APKBUILD; do
local s
if is_remote "$i"; then if is_remote "$i"; then
s="$SRCDEST/$(filename_from_uri $i)" s="$SRCDEST/$(filename_from_uri $i)"
else else
s="$startdir/${i##*/}" s="$startdir/${i##*/}"
fi fi
if [ "$s" -nt "$pkg" ]; then if [ "$s" -nt "$REPODEST/$repo/$pkgarch/$pkgname-$pkgver-r$pkgrel.apk" ]; then
return 1 return 1
fi fi
done done
...@@ -1639,19 +1652,21 @@ apk_up2date() { ...@@ -1639,19 +1652,21 @@ apk_up2date() {
abuildindex_up2date() { abuildindex_up2date() {
local i local i
getpkgver || return 1 getpkgver || return 1
local dir="$REPODEST"/$repo/$CARCH
local apk="${pkgname%%:*}-$pkgver-r$pkgrel.apk"
local idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$apk
# check if index is missing
[ -f "$idx" ] || return 1
# if link or file is missing, then we need update abuildrepo index for i in $allpackages; do
[ -f "$file" ] || return 1 subpkg_set "$i"
local dir="$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}
local idx="$dir"/APKINDEX.tar.gz
local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk
# if file exists and is newer than index, then we need update index # if any file is missing or .apk is newer then index
[ "$file" -nt "$idx" ] && return 1 # the index needs to be updated
if [ ! -f "$idx" -o ! -f "$file" -o "$file" -nt "$idx" ]; then
subpkg_unset
return 1
fi
done
subpkg_unset
return 0 return 0
} }
...@@ -1916,9 +1931,11 @@ stripbin() { ...@@ -1916,9 +1931,11 @@ stripbin() {
listpkg() { listpkg() {
local name local name
getpkgver || return 1 getpkgver || return 1
for name in $(listpkgnames) ; do for name in $allpackages ; do
echo "$name-$pkgver-r$pkgrel.apk" subpkg_set $name
echo "$subpkgname-$pkgver-r$pkgrel.apk"
done done
subpkg_unset
} }
source_has() { source_has() {
...@@ -2213,10 +2230,16 @@ if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then ...@@ -2213,10 +2230,16 @@ if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then
options="$options !strip" options="$options !strip"
fi fi
# If we are handling a sub package then reset subpackages and install
if [ -n "$subpkgname" ]; then if [ -n "$subpkgname" ]; then
# If we are handling a sub package then reset subpackages and install
origsubpackages="$subpackages" origsubpackages="$subpackages"
subpackages= subpackages=
else
local i
allpackages="$pkgname $subpackages"
for i in $linguas; do
allpackages="$allpackages $pkgname-lang-$i::noarch"
done
fi fi
apkbuild_arch="$arch" apkbuild_arch="$arch"
pkgdir="$pkgbasedir/$pkgname" pkgdir="$pkgbasedir/$pkgname"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment