[buildpkg] splitting packages not work if present multiple 'arch' array
We have an old issue present in buildpkg
function: not working if the multiple PKGBUILD contain a mix of architecture array: in our case if we mix arch=any
and arch=x86_64
.
The problem is here. The post_build
function not recognize the array if is present ( as normally ) inside the package_XXXX()
function of the PKGBUILD
. As i understand is because a variable into a function can't be exported in other scripts . I have tried this approach but without success. I have at the end of the idea. Following the approach of arch is hard because use more scripts and library function into makepkg process to parse e divide the PKGBUILD for any splitted package ( if understand correctly their approach )
post_build(){
source PKGBUILD
if [[ ${#pkgname[@]} > 1 ]]; then
archs=$(grep 'arch=' PKGBUILD | cut -d "=" -f2- | sed 's/.//;s/.$//' | tr '\n' ' ' | sed 's/^/(/;s/$/)/')
echo $archs
s=${#archs[@]}
echo $s
counter=0
echo $counter
while [[ $counter -lt $s ]]; do
local ext='pkg.tar.zst' tarch ver src
for pkg in ${pkgname[$counter]}; do
case ${archs[$counter]} in
any) tarch='any' ;;
*) tarch=${target_arch}
esac
local ver=$(get_full_version "$pkg") src
src=$pkg-$ver-$tarch.$ext
move_to_cache "$src"
done
local name=${pkgbase:-$pkgname}
archive_logs "$name"
counter=$(( $counter + 1 ))
done
else
local ext='pkg.tar.zst' tarch ver src
for pkg in ${pkgname[@]}; do
case $arch in
any) tarch='any' ;;
*) tarch=${target_arch}
esac
local ver=$(get_full_version "$pkg") src
src=$pkg-$ver-$tarch.$ext
move_to_cache "$src"
done
local name=${pkgbase:-$pkgname}
archive_logs "$name"
fi