[aur-dev] Safe and relatively reliable PKGBUILD parser.

Xyne xyne at archlinux.ca
Sat Jan 9 20:37:02 EST 2010


Loui Chang wrote:

> Wow this is quite clever. It definitely would make the job of parsing
> much easier. Thanks for the explanation.

:)

I intend to flesh out the parser as special cases pop up. As already
mentioned, there will be limits to what it can do depending on whether
the packager uses command output to set variables, but perhaps Arch
could eventually impose a de facto standard for PKGBUILDs using the
parser itself as the standard, i.e. if the PKGBUILD metadata gets
past the parser, the PKGBUILD itself would be considered invalid. In
that case, the parser would support tricks such as

[ "$ARCH" == "x86_64" ] && depends=('foo' 'bar')

I want to be very clear that I am NOT suggesting that my parser become
the standard, only that a parser based on this approach _could_ become
one.

Also note that this is really a method on its own that just happens to
be implemented in Perl in this case. If you look at the code, you will
see that it could very quickly be adapted to Python (and thus Django),
or PHP, or just about anything.


More information about the aur-dev mailing list