Commit 870d4c8f authored by Eli Schwartz's avatar Eli Schwartz Committed by Allan McRae
Browse files

libmakepkg/lint_pkgbuild: permit versioned optdepends



pacman accepts these, and there is no good reason to be more restrictive
ourselves; we should follow the example of "depends" here.

Update the documentation to actually state that this is supported.

Signed-off-by: Eli Schwartz's avatarEli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent c37a06fe
......@@ -212,8 +212,9 @@ underscore and the architecture name e.g., 'checkdepends_x86_64=()'.
An array of packages (and accompanying reasons) that are not essential for
base functionality, but may be necessary to make full use of the contents
of this package. optdepends are currently for informational purposes only
and are not utilized by pacman during dependency resolution. The format
for specifying optdepends is:
and are not utilized by pacman during dependency resolution. Packages in
this list follow the same format as depends, with an optional description
appended. The format for specifying optdepends descriptions is:
optdepends=('python: for library bindings')
+
......
......@@ -31,15 +31,23 @@ lint_pkgbuild_functions+=('lint_optdepends')
lint_optdepends() {
local a list name optdepends_list ret=0
local optdepends_list optdepend name ret=0
local optdepends_list optdepend name ver ret=0
get_pkgbuild_all_split_attributes optdepends optdepends_list
for optdepend in "${optdepends_list[@]}"; do
name=${optdepend%%:[[:space:]]*}
# this function requires extglob - save current status to restore later
local shellopts=$(shopt -p extglob)
shopt -s extglob
for optdepend in "${optdepends_list[@]%%:[[:space:]]*}"; do
name=${optdepend%%@(<|>|=|>=|<=)*}
# remove optional epoch in version specifier
ver=${optdepend##$name@(<|>|=|>=|<=)?(+([0-9]):)}
lint_one_pkgname optdepends "$name" || ret=1
if [[ $ver != $optdepend ]]; then
# remove optional pkgrel in version specifier
check_pkgver "${ver%-+([0-9])?(.+([0-9]))}" optdepends || ret=1
fi
done
return $ret
......
Supports Markdown
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