[pacman-dev] [PATCH] libmakepkg: check if PKGBUILD variables are arrays or not as appropriate
allan at archlinux.org
Fri Aug 7 03:50:00 UTC 2015
On 22/07/15 01:33, Dave Reisner wrote:
> On Mon, Jul 20, 2015 at 03:52:43PM +1000, Allan McRae wrote:
>> When extracting variables from PKGBUILD (e.g. for .SRCINFO creation) we make
>> assumptions about whether variables are arrays or not. This adds a check to
>> the PKGBUILD linter to ensure variables are arrays or not as appropriate.
>> Signed-off-by: Allan McRae <allan at archlinux.org>
>> scripts/Makefile.am | 1 +
>> scripts/libmakepkg/lint_pkgbuild/array.sh.in | 62 ++++++++++++++++++++++++++++
> Pedantic, but I'm not sure I like the name of the check. It isn't
> strictly about arrays. Maybe decls.sh ? structure.sh ?
It is checking if variables are arrays or not arrays. Anyway, variables.sh?
>> + if grep -q "$i=[^(]" $BUILDSCRIPT; then
> If you have some sort of logic which appends to an array, you'll get a
> false positive here. We allow this elsewhere.
I am confused by this comment. Can you give an example of what could
cause an issue?
> $BUILDSCRIPT must be quoted.
> You also want word boundaries on the regex such that we don't throw
> errors like "depends should be an array" given the fragment:
> depends=("bar" "baz")
Good point (I ran into this...)
More information about the pacman-dev