abuild: use subpkgarch to construct the package paths everywhere
This commit is contained in:
parent
f7e2b48d1c
commit
8c8d741b32
129
abuild.in
129
abuild.in
@ -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() {
|
|||||||
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() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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() {
|
|||||||
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() {
|
|||||||
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() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
|
##NOARCH: These packages are really in $CARCH and do not need their
|
||||||
|
# own repository. --rewrite-arch is used below to make sure the index
|
||||||
|
# thinks they are for $CARCH and apk-tools will fetch them from
|
||||||
|
# correct URL path. Remainder of the script uses ${subpkgarch/noarch/$CARCH}
|
||||||
|
# when expanding to the target repository path.
|
||||||
|
[ "$subpkgarch" = "noarch" ] && subpkgarch="$CARCH"
|
||||||
|
list_has "$subpkgarch" "$allarch" || allarch="$allarch $subpkgarch"
|
||||||
|
done
|
||||||
|
subpkg_unset
|
||||||
|
|
||||||
msg "Updating the cached abuild repository index..."
|
for i in $allarch; do
|
||||||
|
cd "$REPODEST/$repo/$i"
|
||||||
|
local index=$i/APKINDEX.tar.gz
|
||||||
|
|
||||||
|
msg "Updating the $repo/$i repository index..."
|
||||||
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}"
|
local sign=".SIGN.RSA.${SIGN_PUBLIC_KEY##*/}"
|
||||||
local oldindex=
|
local oldindex=
|
||||||
if [ -f "$index" ]; then
|
if [ -f APKINDEX.tar.gz ]; then
|
||||||
oldindex="--index $index"
|
oldindex="--index APKINDEX.tar.gz"
|
||||||
fi
|
fi
|
||||||
$APK index --quiet $oldindex --output "$index".unsigned \
|
( $APK index --quiet $oldindex --output APKINDEX.tar.gz.$$ \
|
||||||
--description "$repo $(cd $startdir && git describe)" \
|
--description "$repo $(cd $startdir && git describe)" \
|
||||||
--rewrite-arch $CARCH \
|
--rewrite-arch $i *.apk && \
|
||||||
$CARCH/*.apk || exit 1
|
msg "Signing the index..." && \
|
||||||
msg "Signing the index..."
|
abuild-sign -q APKINDEX.tar.gz.$$ && \
|
||||||
abuild-sign -q "$index".unsigned || exit 1
|
chmod 644 APKINDEX.tar.gz.$$ && \
|
||||||
mv "$index".unsigned "$index"
|
mv APKINDEX.tar.gz.$$ APKINDEX.tar.gz \
|
||||||
chmod 644 "$index"
|
) || (rm -f APKINDEX.tar.gz.$$ ; die "Failed to create index")
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# predefined splitfunc doc
|
# predefined splitfunc doc
|
||||||
@ -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() {
|
|||||||
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"
|
for i in $allpackages; do
|
||||||
|
subpkg_set "$i"
|
||||||
|
local dir="$REPODEST"/$repo/${subpkgarch/noarch/$CARCH}
|
||||||
local idx="$dir"/APKINDEX.tar.gz
|
local idx="$dir"/APKINDEX.tar.gz
|
||||||
local file="$dir"/$apk
|
local file="$dir"/$subpkgname-$pkgver-r$pkgrel.apk
|
||||||
|
|
||||||
# check if index is missing
|
# if any file is missing or .apk is newer then index
|
||||||
[ -f "$idx" ] || return 1
|
# the index needs to be updated
|
||||||
|
if [ ! -f "$idx" -o ! -f "$file" -o "$file" -nt "$idx" ]; then
|
||||||
# if link or file is missing, then we need update abuildrepo index
|
subpkg_unset
|
||||||
[ -f "$file" ] || return 1
|
return 1
|
||||||
|
fi
|
||||||
# if file exists and is newer than index, then we need update index
|
done
|
||||||
[ "$file" -nt "$idx" ] && return 1
|
subpkg_unset
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -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
|
|||||||
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user