Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   FS#30582 : add a postextract() to PKGBUILD (http://www.linux-archive.org/archlinux-pacman-development/688239-fs-30582-add-postextract-pkgbuild.html)

Enjolras 07-27-2012 09:45 PM

FS#30582 : add a postextract() to PKGBUILD
 
Hi

A lot of PKGBUILD calls patch in build(), causing errors when you run
makepkg --noextract. Patchs/sed and other non-idempotent operations on
the sources should be run in another function, which whould only been
called after extracting the sources, and not all the times build() is run.


Patch attached :

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index abfabdf..cf4b542 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -70,6 +70,7 @@ LOGGING=0
SOURCEONLY=0
IGNOREARCH=0
HOLDVER=0
+POSTEXTRACTFUNC=0
BUILDFUNC=0
CHECKFUNC=0
PKGFUNC=0
@@ -1004,6 +1005,10 @@ run_function() {
eval "$shellopts"
}

+run_postextract() {
+ run_function_safe "postextract"
+}
+
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 postextract >/dev/null; then
+ POSTEXTRACTFUNC=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 (( POSTEXTRACTFUNC )); then
+ run_postextract
+ fi
fi

if (( NOBUILD )); then

Dan McGee 07-27-2012 10:53 PM

FS#30582 : add a postextract() to PKGBUILD
 
http://www.archlinux.org/pacman/submitting-patches.html

Please use git format-patch and git send-email if at all possible to
submit your patch. Thanks!

-Dan

On Fri, Jul 27, 2012 at 4:45 PM, Enjolras <0enjolras0@laposte.net> wrote:
> Hi
>
> A lot of PKGBUILD calls patch in build(), causing errors when you run
> makepkg --noextract. Patchs/sed and other non-idempotent operations on the
> sources should be run in another function, which whould only been called
> after extracting the sources, and not all the times build() is run.
>
> Patch attached :
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index abfabdf..cf4b542 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -70,6 +70,7 @@ LOGGING=0
> SOURCEONLY=0
> IGNOREARCH=0
> HOLDVER=0
> +POSTEXTRACTFUNC=0
> BUILDFUNC=0
> CHECKFUNC=0
> PKGFUNC=0
> @@ -1004,6 +1005,10 @@ run_function() {
> eval "$shellopts"
> }
>
> +run_postextract() {
> + run_function_safe "postextract"
> +}
> +
> 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 postextract >/dev/null; then
> + POSTEXTRACTFUNC=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 (( POSTEXTRACTFUNC )); then
> + run_postextract
> + fi
> fi
>
> if (( NOBUILD )); then
>
>

Allan McRae 07-28-2012 07:55 AM

FS#30582 : add a postextract() to PKGBUILD
 
On 28/07/12 07:45, Enjolras wrote:
> Hi
>
> A lot of PKGBUILD calls patch in build(), causing errors when you run
> makepkg --noextract. Patchs/sed and other non-idempotent operations on
> the sources should be run in another function, which whould only been
> called after extracting the sources, and not all the times build() is run.

I would prefer it to be name "prepare()". A single function name fits
the style of the rest (build, check, package).

Also, documentation is needed - both PKGBUILD.5 and makepkg.8 (behaviour
of --noextract).

> Patch attached :
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index abfabdf..cf4b542 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -70,6 +70,7 @@ LOGGING=0
> SOURCEONLY=0
> IGNOREARCH=0
> HOLDVER=0
> +POSTEXTRACTFUNC=0
> BUILDFUNC=0
> CHECKFUNC=0
> PKGFUNC=0
> @@ -1004,6 +1005,10 @@ run_function() {
> eval "$shellopts"
> }
>
> +run_postextract() {
> + run_function_safe "postextract"
> +}
> +
> 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 postextract >/dev/null; then
> + POSTEXTRACTFUNC=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 (( POSTEXTRACTFUNC )); then
> + run_postextract
> + fi
> fi
>
> if (( NOBUILD )); then
>
>
>
>


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

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