[devtools,1/7] Handle makepkg.conf more consistently

Message ID 20170405193603.22277-2-lukeshu@lukeshu.com
State Accepted
Headers show
Series [devtools,1/7] Handle makepkg.conf more consistently | expand

Commit Message

Luke Shumaker April 5, 2017, 7:35 p.m. UTC
From: Luke Shumaker <lukeshu@parabola.nu>

 - checkpkg:    Check ~/.config/pacman/makepkg.conf ; not just
                ~/.makepkg.conf
 - commitpkg:   Likewise
 - rebuildpkgs: Check for user makepkg.conf files, not just the system
                one in /etc
---
 checkpkg.in    | 6 ++++--
 commitpkg.in   | 6 ++++--
 rebuildpkgs.in | 7 +++++++
 3 files changed, 15 insertions(+), 4 deletions(-)

Patch

diff --git a/checkpkg.in b/checkpkg.in
index fbd30d3..ec58ff6 100644
--- a/checkpkg.in
+++ b/checkpkg.in
@@ -13,8 +13,10 @@  else
 fi
 
 # Source user-specific makepkg.conf overrides
-if [[ -r ~/.makepkg.conf ]]; then
-	source ~/.makepkg.conf
+if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+	source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
+elif [[ -r "$HOME/.makepkg.conf" ]]; then
+	source "$HOME/.makepkg.conf"
 fi
 
 if [[ ! -f PKGBUILD ]]; then
diff --git a/commitpkg.in b/commitpkg.in
index d31f6ba..1f9492c 100644
--- a/commitpkg.in
+++ b/commitpkg.in
@@ -11,8 +11,10 @@  else
 fi
 
 # Source user-specific makepkg.conf overrides
-if [[ -r ~/.makepkg.conf ]]; then
-	. ~/.makepkg.conf
+if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+	source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
+elif [[ -r "$HOME/.makepkg.conf" ]]; then
+	source "$HOME/.makepkg.conf"
 fi
 
 cmd=${0##*/}
diff --git a/rebuildpkgs.in b/rebuildpkgs.in
index 8a141e0..9197231 100644
--- a/rebuildpkgs.in
+++ b/rebuildpkgs.in
@@ -26,6 +26,13 @@  else
 	die '/etc/makepkg.conf not found!'
 fi
 
+# Source user-specific makepkg.conf overrides
+if [[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf" ]]; then
+	source "${XDG_CONFIG_HOME:-$HOME/.config}/pacman/makepkg.conf"
+elif [[ -r "$HOME/.makepkg.conf" ]]; then
+	source "$HOME/.makepkg.conf"
+fi
+
 bump_pkgrel() {
 	# Get the current pkgrel from SVN and update the working copy with it
 	# This prevents us from incrementing out of control :)