Skip to content

Commit

Permalink
fix(srcinfo.sh): CARCH/AARCH replaces (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: ook37 <[email protected]>
  • Loading branch information
oklopfer and ook37 authored Jul 14, 2024
1 parent dcabd33 commit c25fd73
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions scripts/srcinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function srcinfo.vars() {

function srcinfo.write_global() {
unset "${allvars[@]}" "${allars[@]}"
local CARCH='CARCH_REPLACE' DISTRO='DISTROBASE:DISTROVER' CDISTRO='CDISTROBASE:CDISTROVER' AARCH='AARCH_REPLACE' var ar aars bar ars rar rep seek
local CARCH='CARCH_REPLACE' DISTRO='DISTROBASE:DISTROVER' CDISTRO='CDISTROBASE:CDISTROVER' AARCH='AARCH_REPLACE' var ar aars bar ars rar rep seek multilist
local -A AARCHS_MAP=(
["amd64"]="x86_64"
["arm64"]="aarch64"
Expand All @@ -178,9 +178,14 @@ function srcinfo.write_global() {
)
# shellcheck disable=SC1090
source "${1}"
for ar in "${allars[@]}"; do
[[ ${ar} != "arch" ]] \
&& local -n bar="${ar}"
multilist=("${multivalued_arch_attrs[@]}")
for i in "${multivalued_arch_attrs[@]}"; do
for j in {amd64,x86_64,arm64,aarch64,armel,arm,armhf,armv7h,i386,i686,mips64el,ppc64el,riscv64,s390x}; do
multilist+=("${i}_${j}")
done
done
for ar in "${multilist[@]}"; do
local -n bar="${ar}"
if [[ -n ${bar[*]} ]]; then
for ars in "${bar[@]}"; do
ars="${ars//+([[:space:]])/ }"
Expand All @@ -204,16 +209,21 @@ function srcinfo.write_global() {
rep="${aars}"
fi
fi
local -n fin="${ar}_${rep}"
# shellcheck disable=SC2076
if [[ " ${AARCHS_MAP[*]} " =~ " ${ar##*_} " || " ${!AARCHS_MAP[*]} " =~ " ${ar##*_} " || ${ar} == *"x86_64" ]]; then
: "${ar}=${ars}"
[[ ${ar} != *"${aars}" ]] && continue
else
: "${ar}_${aars}=${ars}"
fi
eval "${_//${seek}/${rep}}"
if [[ -z ${fin[*]} ]]; then
eval "${_//${seek}/${rep}}"
fi
done
unset "${ar}"
if [[ " ${multivalued_arch_attrs[*]} " =~ " ${ar} " ]]; then
unset "${ar}"
fi
fi
done
fi
Expand Down

0 comments on commit c25fd73

Please sign in to comment.