[pacman-dev] Comments with `)' are either broken or disallowed

lolilolicon lolilolicon at gmail.com
Tue May 13 01:18:33 EDT 2014

On Tue, May 13, 2014 at 1:43 AM, Dave Reisner <d at falconindy.com> wrote:
> On Mon, May 12, 2014 at 01:06:20PM +0800, lolilolicon wrote:
>> These are in the check_sanity function, by the time which is run we
>> already source'd the BUILDFILE, correct? Why don't we use the existing
>> variable arrays then?
> You're forgetting about package-level overrides, which aren't available
> in the environment.

Alright, we're cursed, aren't we? Gone are dreams of grace and order,
now we must indulge in patch and scratch.

Anyway, maybe we can ask bash to pre-formalize the PKGBUILD a little
bit so be can parse it more confidently com, by using abination of
`set -x` and `typeset`. For example, consider the following
troublesome PKGBUILD:

foo=(a \
  b # )
  'c: )'

package_one() {
  'e: 4 #1')

package_two() {

We can append to the end of it:

typeset -f package_one package_two

And then if you execute it with: PS4='' bash -x ./PKGBUILD, the output
is formalized, with comments stripped too:

foo=(a b 'c: )')
typeset -f package_one package_two
package_one ()
    foo=(d 'e: 4 #1')
package_two ()

What do you think?

More information about the pacman-dev mailing list