Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   Add a function prepare() to PKGBUILD (http://www.linux-archive.org/archlinux-pacman-development/688329-add-function-prepare-pkgbuild.html)

Enjolras 07-28-2012 09:20 AM

Add a function prepare() to PKGBUILD
 
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

Allan McRae 07-29-2012 06:53 AM

Add a function prepare() to PKGBUILD
 
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
>


All times are GMT. The time now is 12:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.