[pacman-dev] makepkg: package_...() can export variables to each other

Allan McRae allan at archlinux.org
Fri Jun 5 07:59:24 UTC 2020


On 5/6/20 5:39 pm, Erich Eckner wrote:
> Hi,
> 
> I stumbled upon the fact, that variables set in one package_...()
> function of a split package are accessible by following package_...()
> functions. Is this by design or may I try to provide a patch to restore
> env after the call to package_...()?
> Note: packaging-relevant variables (e.g. depends_x86_64) are cleaned
> across function calls.
> 
> Simple example:
> 
> ------8<------8<------8<------
> arch=(any)
> pkgbase=test
> pkgname=(ta tb)
> pkgver=0
> pkgrel=1
> 
> package_ta() {
>   _test='hi, there!'
> }
> 
> package_tb() {
>   echo "$_test"
> }
> ------>8------>8------>8------
> 

PKGBUILDs are bash.  Bash scope rules apply.

Allan


More information about the pacman-dev mailing list