Commit 766fb58e authored by Kevin Daudt's avatar Kevin Daudt

apkbuild-lint: fix false negative with custom variables

When a non-standard variable has a prefix of a standard variable,
apkbuild-lint does not complain at the moment. For example:

```sh
depends_foo="abc"
```

is a non-standard variable, but because it starts with `depends`, which
is a standard variable, it is not caught.

Let's fix that by including an `=` in the negative lookahead, so no
longer functions as a prefix match. See [regexp101 example][0].

[0]:https://regex101.com/r/qhVwsP/1
parent 16de5ac6
Pipeline #2161 passed with stage
in 27 seconds
......@@ -95,7 +95,7 @@ empty_variable() {
custom_variable() {
[ "$SKIP_CUSTOM_VARIABLE" ] && return 0
[ "$SKIP_AL6" ] && return 0
scan '^(?!\s*^('"$variables"'))[^\s=-]+=' \
scan '^(?!\s*^('"$variables"')=)[^\s=-]+=' \
"prefix custom variable with _: \2" 'AL6' 'IC'
}
......
......@@ -191,7 +191,7 @@ is_travis() {
cat <<-"EOF" >$apkbuild
pkgname=a
pkgver=1
foo=example
depends_foo=example
EOF
run $cmd $apkbuild
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment