[pacman-dev] [PATCH] makepkg: allow versioned optdepends with epoch

Allan McRae allan at archlinux.org
Sat Sep 24 01:01:43 EDT 2011

Allow the specification of versioned optdepends with an epoch.
This also (partially) enforces a whitespace between ":" and the
description which is required for the future optdepends parsing

Signed-off-by: Allan McRae <allan at archlinux.org>

There are only four packages in the Arch repos that do not use a ":"
followed by some whitespace before the description in their optdepends.
This catches 3/4 of them, with the following is incorrectly seen as valid:


It is probably possible to separate a single word description from a version
with epoch with a much more complicated regex...

 scripts/makepkg.sh.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 6304a25..a0b0375 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1529,8 +1529,8 @@ check_sanity() {
 	eval $(awk '/^[[:space:]]*optdepends=\(/,/\)[[:space:]]*(#.*)?$/' "$BUILDFILE" | \
 		sed -e "s/optdepends=/optdepends_list+=/" -e "s/#.*//" -e 's/\\$//')
 	for i in "${optdepends_list[@]}"; do
-		local pkg=${i%%:*}
-		if [[ $pkg != +([[:alnum:]><=.+_-]) ]]; then
+		local pkg=${i%%:[[:space:]]*}
+		if [[ $pkg != +([[:alnum:]><=.+_-:]) ]]; then
 			error "$(gettext "Invalid syntax for %s : '%s'")" "optdepend" "$i"

More information about the pacman-dev mailing list