functions: read default configs from /usr/share/abuild/default.conf

This makes it easier to push default config updates with apk
This commit is contained in:
Natanael Copa 2023-04-18 13:26:49 +02:00
parent fe26e9483b
commit a1b672cad2
2 changed files with 13 additions and 4 deletions

View File

@ -96,9 +96,11 @@ readconfig() {
[ -n "${PACKAGER+x}" ] && _PACKAGER=$PACKAGER
[ -n "${USE_COLORS+x}" ] && _USE_COLORS="$USE_COLORS"
[ -n "${USE_CCACHE+x}" ] && _USE_CCACHE="$USE_CCACHE"
: ${ABUILD_DEFCONF:=$ABUILD_SHAREDIR/default.conf}
: ${ABUILD_CONF:=$sysconfdir/abuild.conf}
: ${ABUILD_USERDIR:=$HOME/.abuild}
: ${ABUILD_USERCONF:=$ABUILD_USERDIR/abuild.conf}
[ -f "$ABUILD_DEFCONF" ] && . "$ABUILD_DEFCONF"
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
[ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF"
APORTSDIR=${_APORTSDIR-$APORTSDIR}

View File

@ -56,22 +56,29 @@ funcs_check_env_set_but_empty_body() {
}
funcs_check_defconfig_body() {
echo "CFLAGS=defcflags" > def.conf
echo "CFLAGS=syscflags" > etc.conf
echo "CFLAGS=usercflags" > user.conf
# test /usr/share/abuild/default.conf
ABUILD_DEFCONF="$PWD"/def.conf ABUILD_CONF=/dev/null ABUILD_USERCONF=/dev/null \
atf_check -o match:"defcflags" \
sh -e -c " . $FUNCS; echo \"\$CFLAGS\""
# test /etc/abuild.conf
ABUILD_CONF="$PWD"/etc.conf atf_check \
ABUILD_DEFCONF=/dev/null ABUILD_CONF="$PWD"/etc.conf ABUILD_USERCONF=/dev/null \
atf_check \
-o match:"syscflags" \
sh -e -c " . $FUNCS; echo \"\$CFLAGS\""
# user config ($HOME/.abuild/abuild.conf) wins over /etc/abuild.conf
ABUILD_CONF="$PWD/etc.conf" ABUILD_USERCONF="$PWD/user.conf" \
ABUILD_DEFCONF="$PWD"/def.conf ABUILD_CONF="$PWD/etc.conf" ABUILD_USERCONF="$PWD/user.conf" \
atf_check \
-o match:"usercflags" \
sh -e -c " . $FUNCS; echo \"\$CFLAGS\""
# environment wins
ABUILD_CONF="$PWD/etc.conf" ABUILD_USERCONF="$PWD/user.conf" \
ABUILD_DEFCONF="$PWD"/def.conf ABUILD_CONF="$PWD/etc.conf" ABUILD_USERCONF="$PWD/user.conf" \
CFLAGS="envcflags" atf_check \
-o match:"envcflags" \
sh -e -c " . $FUNCS; echo \"\$CFLAGS\""