archbuild: prefer repo/arch-specific configs if they exist

When mixing and matching different repos and architectures not present
in mainline archlinux, it is sometimes desirable to set up differing
presets with more granularity than devtools currently allows.

One example of this is when building for architectures that are only
supported by another project -- in order to coexist on a mainline
archlinux host, a different mirrorlist needs to be used.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
Eli Schwartz 2019-05-20 14:10:35 -04:00 committed by Levente Polyak
parent 8e4293034b
commit 10c6efc440
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 13 additions and 4 deletions

View File

@ -20,6 +20,15 @@ fi
chroots='/var/lib/archbuild'
clean_first=false
pacman_config="@pkgdatadir@/pacman-${repo}.conf"
if [[ -f @pkgdatadir@/pacman-${repo}-${arch}.conf ]]; then
pacman_config="@pkgdatadir@/pacman-${repo}-${arch}.conf"
fi
makepkg_config="@pkgdatadir@/makepkg-${arch}.conf"
if [[ -f @pkgdatadir@/makepkg-${repo}-${arch}.conf ]]; then
makepkg_config="@pkgdatadir@/makepkg-${repo}-${arch}.conf"
fi
usage() {
echo "Usage: $cmd [options] -- [makechrootpkg args]"
echo ' -h This help'
@ -61,15 +70,15 @@ if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
rm -rf --one-file-system "${chroots}/${repo}-${arch}"
mkdir -m755 -p "${chroots}/${repo}-${arch}"
setarch "${arch}" mkarchroot \
-C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \
-C "${pacman_config}" \
-M "${makepkg_config}" \
"${chroots}/${repo}-${arch}/root" \
"${base_packages[@]}" || abort
else
lock 9 "${chroots}/${repo}-${arch}/root.lock" "Locking clean chroot"
arch-nspawn \
-C "@pkgdatadir@/pacman-${repo}.conf" \
-M "@pkgdatadir@/makepkg-${arch}.conf" \
-C "${pacman_config}" \
-M "${makepkg_config}" \
"${chroots}/${repo}-${arch}/root" \
pacman -Syuu --noconfirm || abort
fi