[pacman-dev] [PATCH] makepkg: reduce strictness of pkgver in depends linting

Eli Schwartz eschwartz at archlinux.org
Thu Jul 19 06:12:48 UTC 2018

This change was introduced to prevent entries like depends=('foo>').
However, it had the unintended side effect of causing a number of
working PKGBUILDs to fail to build. This happened when a PKGBUILD
defined one variable through calling a "complex" statement within the
PKGBUILD's package function (e.g. a function or evaluating in a
subshell), then used it to define the package metadata variable.

extract_function_variable() cannot execute the package function in order
to retrieve this information, so it performs a simple grep + eval instead
and in the process misses the contextual awareness of running within the
package function.

While not catching these "issues" can result in incorrect SRCINFO, the
resulting packages are fine. Stop aborting on the common case where the
pkgver of a dependency is dynamically set during the package function
until the large number of broken PKGBUILDs are fixed, and the
restrictions of the PKGBUILD format are documented.

"Fixes" FS#58776

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>

Less extreme alternative to https://lists.archlinux.org/pipermail/pacman-dev/2018-July/022717.html

I would like to at least check for and correctly reject the case where
the depends contains a non-empty pkgver without utilizing indirection,
but is incorrect.

 scripts/libmakepkg/lint_pkgbuild/depends.sh.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/libmakepkg/lint_pkgbuild/depends.sh.in b/scripts/libmakepkg/lint_pkgbuild/depends.sh.in
index 40cdc65a..e363a039 100644
--- a/scripts/libmakepkg/lint_pkgbuild/depends.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/depends.sh.in
@@ -46,7 +46,8 @@ lint_depends() {
 		# remove optional epoch in version specifier
 		lint_one_pkgname depends "$name" || ret=1
-		if [[ $ver != $depend ]]; then
+		# Don't validate empty version because of https://bugs.archlinux.org/task/58776
+		if [[ $ver != $depend && -n $ver ]]; then
 			# remove optional pkgrel in version specifier
 			check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" depends || ret=1

More information about the pacman-dev mailing list