You are not logged in.
I have created a patch that adds an option to makepkg that allows you to specify the path to pacman.conf.
I tried to send this patch to the mailing list but for some reason it doesn't work.
This patch has some issues due to my lack of time.
I would like to discuss alternatives and improvements, including that.
What should i do?
From bd9de6ef7de96cb05125292c263daf175c7675fa Mon Sep 17 00:00:00 2001
From: hayao <hayao@fascode.net>
Date: Sun, 21 Mar 2021 09:56:36 +0900
Subject: [PATCH] makepkg: add --pm-config
You can specify which pacman.conf to use with the --pm-config argument or makepkg.conf
This patch still has some issues.
First of all, shell completion is not available.
Second, the default values may not be appropriate.
The last added text has not been translated.
---
etc/makepkg.conf.in | 2 ++
scripts/makepkg.sh.in | 9 ++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in
index 43a69df6..b0216717 100644
--- a/etc/makepkg.conf.in
+++ b/etc/makepkg.conf.in
@@ -107,6 +107,8 @@ DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#-- Directory to store source code in for debug packages
DBGSRCDIR="/usr/src/debug"
+#-- Files to use as pacman.conf
+PACMAN_CONF="/etc/pacman.conf"
#########################################################################
# PACKAGE OUTPUT
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f4a2de7d..df5205f1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -985,6 +985,7 @@ usage() {
printf -- "$(gettext " --noprepare Do not run the %s function in the %s")\n" "prepare()" "$BUILDSCRIPT"
printf -- "$(gettext " --nosign Do not create a signature for the package")\n"
printf -- "$(gettext " --packagelist Only list package filepaths that would be produced")\n"
+ printf -- "$(gettext " --pconfig <file> Use an alternate pacman config file (instead of '%s')")\n" "/etc/pacman.conf"
printf -- "$(gettext " --printsrcinfo Print the generated SRCINFO and exit")\n"
printf -- "$(gettext " --sign Sign the resulting package with %s")\n" "gpg"
printf -- "$(gettext " --skipchecksums Do not verify checksums of the source files")\n"
@@ -1032,7 +1033,7 @@ OPT_SHORT="AcCdefFghiLmop:rRsSV"
OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist'
- 'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
+ 'pconfig:' 'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
# Pacman Options
@@ -1077,6 +1078,7 @@ while true; do
-o|--nobuild) BUILDPKG=0 NOBUILD=1 ;;
-p) shift; BUILDFILE=$1 ;;
--packagelist) BUILDPKG=0 PACKAGELIST=1 IGNOREARCH=1;;
+ --pconfig) shift; PACMAN_CONF=$1 ;;
--printsrcinfo) BUILDPKG=0 PRINTSRCINFO=1 IGNOREARCH=1;;
-r|--rmdeps) RMDEPS=1 ;;
-R|--repackage) REPKG=1 ;;
@@ -1132,6 +1134,11 @@ PACKAGER=${PACKAGER:-"Unknown Packager"}
PACMAN=${PACMAN:-pacman}
# save full path to command as PATH may change when sourcing /etc/profile
PACMAN_PATH=$(type -P $PACMAN)
+# set pacman config if not already defined (Use /etc/pacman.conf)
+PACMAN_CONF="${PACMAN_CONF:-/etc/pacman.conf}"
+
+# set pacman args for pacman.conf
+PACMAN_OPTS+=("--config" "${PACMAN_CONF}")
# check if messages are to be printed using color
if [[ -t 2 && $USE_COLOR != "n" ]] && check_buildenv "color" "y"; then
--
2.31.0
Offline
What is the purpose of setting pacman.conf in makepkg?
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
I would assume for either the -s or -i options.
Offline
Why is this *valuable*?
The fact that you *can* override the pacman.conf, does not mean you typically should. It has its uses -- bootstrapping a new root using pacstrap, for example. Or introspecting another pacman-using distro without installing it. But where does makepkg fit in here?
And if it did fit in -- you can create a wrapper /usr/local/bin/pacman-with-fooconfig and define it as the $PACMAN variable -- makepkg will use this instead of /usr/bin/pacman
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Don't even need a wrapper I think...
$ PACMAN="pacman --config=/path/to/config" makepkg
Offline
PACMAN_PATH=$(type -P pacman --config=/path/to/config)
--> will not work
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Oh! Shame that override does not work...
Offline