Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(srcinfo.sh): CARCH/AARCH replaces #25

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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