commit:     8b40fded4ca1ecc94ed1391acb3a7e16218d4779
Author:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 16 16:03:21 2016 +0000
Commit:     Paul Varner <fuzzyray <AT> gentoo <DOT> org>
CommitDate: Tue Aug 16 16:03:21 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=8b40fded

gentoolkit: Fix to allow a package name to end with a hyphen

>From PMS: "3.1.2 Package Names
A package name may contain any of the characters [A-Za-z0-9+_-]. It must
not begin with a hyphen or a plus sign, and must not end in a hyphen
followed by anything matching the version syntax described in section
3.2."

This fixes the validation in cpv.py to allow a package name to end with
a hyphen as long as what follows does not match a version.

X-Gentoo-bug: 586986
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=586986

 pym/gentoolkit/cpv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py
index f1e3241..6e272f1 100644
--- a/pym/gentoolkit/cpv.py
+++ b/pym/gentoolkit/cpv.py
@@ -243,7 +243,7 @@ def isvalid_pkg_name(chunks):
        mf = _pkg_re.match
        if not all(not s or mf(s) for s in chunks):
                return False
-       if not chunks[-1] or (len(chunks) > 1 and chunks[-1].isdigit()):
+       if len(chunks) > 1 and chunks[-1].isdigit():
                # not allowed.
                return False
        return True

Reply via email to