Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-05-22 10:44:26 -0400
committerAllan McRae <allan@archlinux.org>2019-05-28 11:28:30 +1000
commita00615bfdad628299352b94e0f44d211a758fd17 (patch)
tree6ac7380ccbdbfd0dfc64493e2d025952df133e6e /scripts/makepkg.sh.in
parent5caf45cdbb267ee45c7b4a9c815e500efd350e6e (diff)
makepkg: move config loading into libmakepkg
When scripting/automating around makepkg, it is sometimes desirable to know how makepkg will be configured to operate. One example is the archlinux devtools, which must forward select makepkg.conf variables into a build chroot (for example PACKAGER) or use those variables itself (for example {SRC,PKG,LOG}DEST). The configuration file can be in up to 3 places, and should be capable of being overridden via environment variables. It is sufficiently complex to represent distinct functionality, and sufficiently useful to merit easy accessibility in other scripts, therefore, let us move it into a publicly exposed utility library. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in32
1 files changed, 1 insertions, 31 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4d9948ec..f5285a0d 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -354,15 +354,6 @@ error_function() {
exit $E_USER_FUNCTION_FAILED
}
-source_safe() {
- shopt -u extglob
- if ! source "$@"; then
- error "$(gettext "Failed to source %s")" "$1"
- exit $E_MISSING_FILE
- fi
- shopt -s extglob
-}
-
merge_arch_attrs() {
local attr supported_attrs=(
provides conflicts depends replaces optdepends
@@ -1112,28 +1103,7 @@ trap 'trap_exit USR1 "$(gettext "An unknown error has occurred. Exiting...")"' E
# preserve environment variables to override makepkg.conf
restore_envvars=$(declare -p PKGDEST SRCDEST SRCPKGDEST LOGDEST BUILDDIR PKGEXT SRCEXT GPGKEY PACKAGER CARCH 2>/dev/null || true)
-# default config is makepkg.conf
-MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
-
-# 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
eval "$restore_envvars"