Look into replacing parsepkgbuild.sh with .SRCINFO
Parsing a PKGBUILD with bash might make sense, but for our repositories we have .SRCINFO available and python-srcinfo
as library to read those files. Not running subprocess and doing extra legwork to make sense of a PKGBUILD would make namcap's code a lot simpler. (and maybe faster?).
There is only one rule which relies on extravars
which we can not support in when using .SRCINFO, as we don't source the PKGBUILD and export the exported vars. In theory this could be replaced with pkginfo.pkgbuild
and trying to smartly parse the PKGBUILD. (strip all whitespace at the start of the line and check if it a variable declaration foo=
which starts with an underscore with regex).
There are some other rules which use pkginfo.pkgbuild
and these just scan the whole PKGBUILD file. We can keep reading the PKGBUILD file, we just don't want to parse it with a bash script.