diff options
author | Michał Górny <mgorny@gentoo.org> | 2021-08-14 21:48:49 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2021-08-14 21:48:49 +0200 |
commit | b4787a98750a8472c710616bee6a6ae5ca83220d (patch) | |
tree | a89f61d24a58281529437d4dbe52dd474590c90d /tests/ebuild | |
parent | update news (diff) | |
download | pkgcore-b4787a98750a8472c710616bee6a6ae5ca83220d.tar.gz pkgcore-b4787a98750a8472c710616bee6a6ae5ca83220d.tar.bz2 pkgcore-b4787a98750a8472c710616bee6a6ae5ca83220d.zip |
pkgcore.ebuild.cpv: fix isvalid_pkg_name() logic
Fix the package name verification logic not to incorrectly reject
packages that resemble a version number or that contain a series
of hyphens. Document the algorithm better and add more tests for corner
cases.
Diffstat (limited to 'tests/ebuild')
-rw-r--r-- | tests/ebuild/test_cpv.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/ebuild/test_cpv.py b/tests/ebuild/test_cpv.py index 83282abe2..7bd1f67db 100644 --- a/tests/ebuild/test_cpv.py +++ b/tests/ebuild/test_cpv.py @@ -24,15 +24,18 @@ class TestCPV: good_cats = ( "dev-util", "dev+", "dev-util+", "DEV-UTIL", "aaa0", - "aaa-0", "multi/depth", "cross-dev_idiot.hacks-suck", "a") + "aaa-0", "multi/depth", "cross-dev_idiot.hacks-suck", "a", + "foo---", "multi--hyphen") bad_cats = (".util", "_dev", "", "dev-util ", "multi//depth") - good_pkgs = ("diffball", "a9", "a9+", "a-100dpi", "diff-mode-") - bad_pkgs = ("diffball ", "diffball-9", "a-3D", "ab--df", "-df", "+dfa") + good_pkgs = ("diffball", "a9", "a9+", "a-100dpi", "diff-mode-", + "multi--hyphen", "timidity--", "frob---", "diffball-9-") + bad_pkgs = ("diffball ", "diffball-9", "a-3D", "-df", "+dfa", + "timidity--9f", "ormaybe---13_beta") good_cp = ( "bbb-9/foon", "dev-util/diffball", "dev-util/diffball-a9", "dev-ut-asdf/emacs-cvs", "xfce-base/xfce4", "bah/f-100dpi", - "dev-util/diffball-blah-monkeys") + "dev-util/diffball-blah-monkeys", "virtual/7z") good_vers = ("1", "2.3.4", "2.3.4a", "02.3", "2.03", "3d", "3D") bad_vers = ("2.3a.4", "2.a.3", "2.3_", "2.3 ", "2.3.", "cvs.2") |