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
code.

Signed-off-by: Allan McRae <[email protected]>
---

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:

optdepends=('pyglet:plotting')

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"
                        ret=1
                fi
-- 
1.7.6.3


Reply via email to