[pacman-dev] [PATCH 1/2] Add a function prepare() to PKGBUILD

Enjolras 0enjolras0 at laposte.net
Sat Jul 28 05:20:10 EDT 2012


prepare is run after the source extraction, and is not run with
--noextract option.
---
 scripts/makepkg.sh.in | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index abfabdf..9940d1e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -70,6 +70,7 @@ LOGGING=0
 SOURCEONLY=0
 IGNOREARCH=0
 HOLDVER=0
+PREPAREFUNC=0
 BUILDFUNC=0
 CHECKFUNC=0
 PKGFUNC=0
@@ -1004,6 +1005,10 @@ run_function() {
 	eval "$shellopts"
 }
 
+run_prepare() {
+	run_function_safe "prepare"
+}
+
 run_build() {
 	# use distcc if it is requested (check buildenv and PKGBUILD opts)
 	if check_buildenv "distcc" "y" && ! check_option "distc" "n"; then
@@ -2280,6 +2285,9 @@ if (( ${#pkgname[@]} > 1 )); then
 fi
 
 # test for available PKGBUILD functions
+if declare -f prepare >/dev/null; then
+	PREPAREFUNC=1
+fi
 if declare -f build >/dev/null; then
 	BUILDFUNC=1
 fi
@@ -2491,6 +2499,9 @@ else
 	download_sources
 	check_source_integrity
 	extract_sources
+	if (( PREPAREFUNC )); then
+		run_prepare
+  fi
 fi
 
 if (( NOBUILD )); then
-- 
1.7.11.3



More information about the pacman-dev mailing list