diff --git a/functions.sh.in b/functions.sh.in index 898381e..784be0f 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -77,7 +77,7 @@ readconfig() { [ -n "${SRCDEST+x}" ] && _SRCDEST=$SRCDEST [ -n "${CC+x}" ] && _CC=$CC [ -n "${CXX+x}" ] && _CXX=$CXX - [ -n "${LD+x}" ] && _LD=$LD + [ -n "${LD+x}" ] && _LD=$LD [ -n "${CARCH+x}" ] && _CARCH=$CARCH [ -n "${CHOST+x}" ] && _CHOST=$CHOST [ -n "${CTARGET+x}" ] && _CTARGET=$CTARGET @@ -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} diff --git a/tests/functions_test b/tests/functions_test index 06cba40..b7928de 100755 --- a/tests/functions_test +++ b/tests/functions_test @@ -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\""