makerepropkg: Use $CARCH instead of hardcoded x86_64

`makerepropkg` has a hardcoded "x86_64", so fails to run on other
[unofficial] architectures, because it tries to use an x86_64-specific
makepkg config, which overrides CARCH=x86_64.

This patch addresses hardcoded half of the problem; ArchLinux derivates
still needs to ship a custom `devtools` package with their own
`makepkg-$CARCH.conf`. Usually, the only thing that really needs to be
changed in the per-architecture custom makepkg.conf is CARCH and CHOST.

See: https://lists.archlinux.org/archives/list/arch-projects@lists.archlinux.org/thread/XEEW5LXYFN3XXI5YXAUY5E4LZLMKOFTL/
This commit is contained in:
Hugo Osvaldo Barrera 2022-10-17 23:33:27 +02:00 committed by Levente Polyak
parent b64d8ebacf
commit dca8f91d26
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 7 additions and 6 deletions

View File

@ -86,13 +86,14 @@ get_pkgfile() {
get_makepkg_conf() {
local fname=${1}
local makepkg_conf="${2}"
local arch="${2}"
local makepkg_conf="${3}"
if ! buildtool_file=$(get_pkgfile "${fname}"); then
error "failed to retrieve ${fname}"
return 1
fi
msg2 "using makepkg.conf from ${fname}"
bsdtar xOqf "${buildtool_file/file:\/\//}" usr/share/devtools/makepkg-x86_64.conf > "${makepkg_conf}"
bsdtar xOqf "${buildtool_file/file:\/\//}" "usr/share/devtools/makepkg-${arch}.conf" > "${makepkg_conf}"
return 0
}
@ -213,17 +214,17 @@ TEMPDIR=$(mktemp -d --tmpdir makerepropkg.XXXXXXXXXX)
makepkg_conf="${TEMPDIR}/makepkg.conf"
# anything before buildtool support is pinned to the last none buildtool aware release
if [[ -z "${BUILDTOOL}" ]]; then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}" || exit 1
get_makepkg_conf "devtools-20210202-3-any" "${CARCH}" "${makepkg_conf}" || exit 1
# prefere to assume devtools up until matching makepkg version so repository packages remain reproducible
elif [[ "${BUILDTOOL}" = makepkg ]] && (( $(vercmp "${BUILDTOOLVER}" 6.0.1) <= 0 )); then
get_makepkg_conf "devtools-20210202-3-any" "${makepkg_conf}" || exit 1
get_makepkg_conf "devtools-20210202-3-any" "${CARCH}" "${makepkg_conf}" || exit 1
# all devtools builds
elif [[ "${BUILDTOOL}" = devtools ]] && get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${makepkg_conf}"; then
elif [[ "${BUILDTOOL}" = devtools ]] && get_makepkg_conf "${BUILDTOOL}-${BUILDTOOLVER}" "${CARCH}" "${makepkg_conf}"; then
true
# fallback to current makepkg.conf
else
warning "Unknown buildtool (${BUILDTOOL}-${BUILDTOOLVER}), using fallback"
makepkg_conf=@pkgdatadir@/makepkg-x86_64.conf
makepkg_conf=@pkgdatadir@/makepkg-${CARCH}.conf
fi
printf '%s\n' "${allpkgfiles[@]}" | mkarchroot -M "${makepkg_conf}" -U "${archroot_args[@]}" "${namespace}/root" - || exit 1