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

Message ID DB7PR10MB250867C4B5C2E28E1CCE8940D2A60@DB7PR10MB2508.EURPRD10.PROD.OUTLOOK.COM
State New
Headers show
Series
  • [pacman-dev] Fix program name transformation options for configure script
Related show

Commit Message

Wouter Wijsman May 4, 2020, 6:47 p.m. UTC
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@live.nl>
---
 scripts/Makefile.am   | 8 +++++++-
 scripts/makepkg.sh.in | 6 ++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

Patch

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)