[pacman-dev] [PATCH] Fix program name transformation options for configure script

Wouter Wijsman wwijsman at live.nl
Mon May 4 18:47:35 UTC 2020


The configure script which is generated when running autotools has the
following options for modifying the name of the executables build:

1. --program-prefix
2. --program-suffix
3. --program-transform-name

Using any of these options gives autotools the program_transform_name
variable, but it wasn't being used for the makepkg script, which made
these options cause issues with starting makepkg. This commit addresses
this.

Signed-off-by: Wouter Wijsman <wwijsman at live.nl>
---
 scripts/Makefile.am   | 8 +++++++-
 scripts/makepkg.sh.in | 6 ++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 47455ed2..113ad86c 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -164,6 +164,10 @@ else
 REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
 endif
 
+# Real executable names using program_transform_name
+PACMAN_INSTALL_NAME := $(shell echo pacman|sed '$(program_transform_name)')
+PACMAN_CONF_INSTALL_NAME := $(shell echo pacman-conf|sed '$(program_transform_name)')
+
 #### Taken from the autoconf scripts Makefile.am ####
 edit = sed \
 	-e 's|@rootdir[@]|$(ROOTDIR)|g' \
@@ -182,7 +186,9 @@ edit = sed \
 	-e 's|@DEBUGSUFFIX[@]|$(DEBUGSUFFIX)|g' \
 	-e "s|@INODECMD[@]|$(INODECMD)|g" \
 	-e "s|@FILECMD[@]|$(FILECMD)|g" \
-	-e 's|@SCRIPTNAME[@]|$@|g'
+	-e 's|@SCRIPTNAME[@]|$@|g' \
+	-e 's|@PACMAN_INSTALL_NAME[@]|$(PACMAN_INSTALL_NAME)|g' \
+	-e 's|@PACMAN_CONF_INSTALL_NAME[@]|$(PACMAN_CONF_INSTALL_NAME)|g'
 
 ## All the scripts depend on Makefile so that they are rebuilt when the
 ## prefix etc. changes. Use chmod -w to prevent people from editing the
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index d1416d15..38b6eda9 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -43,6 +43,8 @@ unset GREP_OPTIONS
 declare -r makepkg_version='@PACKAGE_VERSION@'
 declare -r confdir='@sysconfdir@'
 declare -r BUILDSCRIPT='@BUILDSCRIPT@'
+declare -r PACMAN_INSTALL_NAME='@PACMAN_INSTALL_NAME@'
+declare -r PACMAN_CONF_INSTALL_NAME='@PACMAN_CONF_INSTALL_NAME@'
 declare -r startdir="$(pwd -P)"
 
 LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
@@ -235,7 +237,7 @@ run_pacman() {
 		else
 			cmd=(su root -c "$(printf '%q ' "${cmd[@]}")")
 		fi
-		local lockfile="$(pacman-conf DBPath)/db.lck"
+		local lockfile="$(${PACMAN_CONF_INSTALL_NAME} DBPath)/db.lck"
 		while [[ -f $lockfile ]]; do
 			local timer=0
 			msg "$(gettext "Pacman is currently in use, please wait...")"
@@ -1123,7 +1125,7 @@ unset var
 PACKAGER=${PACKAGER:-"Unknown Packager"}
 
 # set pacman command if not already defined
-PACMAN=${PACMAN:-pacman}
+PACMAN=${PACMAN:-${PACMAN_INSTALL_NAME}}
 # save full path to command as PATH may change when sourcing /etc/profile
 PACMAN_PATH=$(type -P $PACMAN)
 
-- 
2.20.1


More information about the pacman-dev mailing list