[pacman-dev] FS#30582 : add a postextract() to PKGBUILD

Dan McGee dpmcgee at gmail.com
Fri Jul 27 18:53:44 EDT 2012


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 at 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
>
>


More information about the pacman-dev mailing list