[pacman-dev] [PATCH v2 1/2] makepkg: move config loading into libmakepkg

Allan McRae allan at archlinux.org
Wed May 8 05:08:35 UTC 2019


On 17/4/19 3:17 am, Eli Schwartz wrote:
> Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
> ---
> 

Comments from v1 indicate this will be useful for (e.g.) devtools to
read a makepkg.conf.  But devtools uses a custom makepkg.conf plus info
from a users ~/.makepkg.conf.   This patch will allow reading the custom
makepkg.conf, but as it is not the system makepkg.conf it would then not
parse the ~/. one.  So does this patch achieve its purpose?


> v2: fix a missing dependency, rebase on top of
> https://patchwork.archlinux.org/patch/1074/ because util.sh had a
> missing dependency

<snip>

>  merge_arch_attrs() {
>  	local attr supported_attrs=(
>  		provides conflicts depends replaces optdepends
> @@ -1113,25 +1104,7 @@ restore_envvars=$(declare -p PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR PKGEXT
>  # default config is makepkg.conf
>  MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}

This is not needed any more.  The logic is handled in the
source_makepkg_conf() function.  The MAKEPKG_CONF variable is not used
elsewhere.

> -# Source the config file; fail if it is not found
> -if [[ -r $MAKEPKG_CONF ]]; then
> -	source_safe "$MAKEPKG_CONF"
> -else
> -	error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
> -	plain "$(gettext "Aborting...")"
> -	exit $E_CONFIG_ERROR
> -fi
> -
> -# Source user-specific makepkg.conf overrides, but only if no override config
> -# file was specified
> -XDG_PACMAN_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/pacman"
> -if [[ "$MAKEPKG_CONF" = "$confdir/makepkg.conf" ]]; then
> -	if [[ -r "$XDG_PACMAN_DIR/makepkg.conf" ]]; then
> -		source_safe "$XDG_PACMAN_DIR/makepkg.conf"
> -	elif [[ -r "$HOME/.makepkg.conf" ]]; then
> -		source_safe "$HOME/.makepkg.conf"
> -	fi
> -fi
> +source_makepkg_config "$MAKEPKG_CONF"
>  
>  eval "$restore_envvars"
>  
> 


More information about the pacman-dev mailing list