[pacman-dev] [PATCH] makepkg: Force buildscripts to be in startdir

Allan McRae allan at archlinux.org
Sat May 24 23:56:54 EDT 2014


We expect all source file to lie in $startdir. However, using
"makepkg -p <buildscript>" can currently allows people to specify buildscripts
in other directories. This results in confusion about where other sources
should lie (in startdir or in the directory that the buildscript is in).
Explicitly disable using -p for files in other directories to avoid this issue.

Fixes FS#40293.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 doc/makepkg.8.txt     | 3 ++-
 scripts/makepkg.sh.in | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 9547bc8..0277f54 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -116,7 +116,8 @@ Options
 
 *-p* <buildscript>::
 	Read the package script `buildscript` instead of the `PKGBUILD` default;
-	see linkman:PKGBUILD[5].
+	see linkman:PKGBUILD[5]. The `buildscript` must be located in the directory
+	makepkg is called from.
 
 *-r, \--rmdeps*::
 	Upon successful build, remove any dependencies installed by makepkg
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 96e5349..de92e93 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2906,6 +2906,11 @@ else
 		exit 1
 	fi
 
+	if [[ ${BUILDFILE##*/} != "${BUILDFILE}" && ${BUILDFILE} != "${startdir}/${BUILDFILE##*/}" ]]; then
+		error "$(gettext "%s must be in the build directory.")" "$BUILDFILE"
+		exit 1
+	fi
+
 	if [[ ${BUILDFILE:0:1} != "/" ]]; then
 		BUILDFILE="$startdir/$BUILDFILE"
 	fi
-- 
1.9.3



More information about the pacman-dev mailing list