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

Allan McRae allan at archlinux.org
Sun Jul 29 02:53:54 EDT 2012


On 28/07/12 19:20, Enjolras wrote:
> 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

Whitespace issue here.   Fixed and pulled to my working branch.

>  fi
>  
>  if (( NOBUILD )); then
> 



More information about the pacman-dev mailing list