summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Varner <fuzzyray@gentoo.org>2015-10-22 11:09:30 -0500
committerPaul Varner <fuzzyray@gentoo.org>2015-10-22 11:09:30 -0500
commit1537ab55fffda2348753ce26d6d7c11de49d9032 (patch)
tree7286f11c1e74a4315994b6e0d0d778c8f392e5f7 /pym/gentoolkit
parenteclean: Fix traceback error caused by adding -i option (diff)
downloadgentoolkit-1537ab55fffda2348753ce26d6d7c11de49d9032.tar.gz
gentoolkit-1537ab55fffda2348753ce26d6d7c11de49d9032.tar.bz2
gentoolkit-1537ab55fffda2348753ce26d6d7c11de49d9032.zip
gentoolkit: Fix to allow package names of all digits. Bug 562952
According to PMS, "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". This specification means that a package name can be composed of all digits. This fixes cpv.py and query.py to allow package names of all digits.
Diffstat (limited to 'pym/gentoolkit')
-rw-r--r--pym/gentoolkit/cpv.py2
-rw-r--r--pym/gentoolkit/query.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/pym/gentoolkit/cpv.py b/pym/gentoolkit/cpv.py
index 473ae60..f1e3241 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 chunks[-1].isdigit() or not chunks[-1]:
+ if not chunks[-1] or (len(chunks) > 1 and chunks[-1].isdigit()):
# not allowed.
return False
return True
diff --git a/pym/gentoolkit/query.py b/pym/gentoolkit/query.py
index df6e2fd..9d1a313 100644
--- a/pym/gentoolkit/query.py
+++ b/pym/gentoolkit/query.py
@@ -19,7 +19,7 @@ __all__ = (
import fnmatch
import re
from functools import partial
-from string import ascii_letters
+from string import ascii_letters, digits
import portage
@@ -47,7 +47,7 @@ class Query(CPV):
"""
# We need at least one of these chars for a valid query
- needed_chars = ascii_letters + '*'
+ needed_chars = ascii_letters + digits + '*'
if not set(query).intersection(needed_chars):
raise errors.GentoolkitInvalidPackage(query)