[pacman-dev] added --config option to makepkg

hoar heor archye at pycut.com.ar
Thu Aug 7 07:25:19 EDT 2008


I added a --config=value option so you can use makepkg --config=safe
and it will source the makepkg.safe file instead of makepkg.conf


>From 4669853aac72506201af4d6e9ec79f080177d42f Mon Sep 17 00:00:00 2001
From: Imanol Celaya <ilcra1989 at gmail.com>
Date: Thu, 7 Aug 2008 13:15:27 +0200
Subject: [PATCH] adds --config=value option to use makepkg.value
instead of makepkg.conf, as makepkg.safe or makepkg.blender

Signed-off-by: Imanol Celaya <ilcra1989 at gmail.com>
---
 scripts/makepkg.sh.in |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 3604d10..267eb81 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1084,6 +1084,7 @@ usage() {
 	echo "$(gettext "  -m, --nocolor    Disable colorized output messages")"
 	echo "$(gettext "  -o, --nobuild    Download and extract files only")"
 	printf "$(gettext "  -p <buildscript> Use an alternate build script
(instead of '%s')")\n" "$BUILDSCRIPT"
+	echo "$(gettext "      --config=value use /etc/makepkg.value file
instead of makepkg.conf")"
 	echo "$(gettext "  -r, --rmdeps     Remove installed dependencies
after a successful build")"
 	# fix flyspray feature request #2978
 	echo "$(gettext "  -R, --repackage  Repackage contents of pkg/
without building")"
@@ -1126,14 +1127,31 @@ _PKGDEST=${PKGDEST}
 _SRCDEST=${SRCDEST}

 # Source makepkg.conf; fail if it is not found
-if [ -r "$confdir/makepkg.conf" ]; then
-	source "$confdir/makepkg.conf"
-else
-	error "$(gettext "%s not found.")" "$confdir/makepkg.conf"
-	plain "$(gettext "Aborting...")"
-	exit 1 # $E_CONFIG_ERROR
+# if --config=value option found, use makepkg.value
+CUSTOMCONFIG=0
+for ARG in $@; do
+if [ ${ARG:0:9} = "--config=" ]; then
+	if [ -r "$confdir/makepkg.${ARG:9}" ]; then
+		plain "$(gettext "Using custom makepkg file: %s")"
"$confdir/makepkg.${ARG:9}"
+		source "$confdir/makepkg.${ARG:9}"
+		CUSTOMCONFIG=1
+		break
+	else
+		error "$(gettext "%s not found.")" "$confdir/makepkg.${ARG:9}"
+		plain "$(gettext "Aborting...")"
+		exit 1 # $E_CONFIG_ERROR
+fi
+if [ $CUSTOMCONFIG = 0 ]; then
+	if [ -r "$confdir/makepkg.conf" ]; then
+		source "$confdir/makepkg.conf"
+	else
+		error "$(gettext "%s not found.")" "$confdir/makepkg.conf"
+		plain "$(gettext "Aborting...")"
+		exit 1 # $E_CONFIG_ERROR
+	fi
 fi

+
 # Source user-specific makepkg.conf overrides
 if [ -r ~/.makepkg.conf ]; then
 	source ~/.makepkg.conf
@@ -1166,7 +1184,7 @@ while true; do
 		# Pacman Options
 		--noconfirm)      PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;;
 		--noprogressbar)  PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;;
-
+		
 		# Makepkg Options
 		--allsource)      SOURCEONLY=2 ;;
 		--asroot)         ASROOT=1 ;;
-- 
1.5.6.5



More information about the pacman-dev mailing list