From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/
Date: Thu, 28 Dec 2023 05:27:26 +0000 (UTC) [thread overview]
Message-ID: <1703741233.c82a051e9031149eb51a947c951c145b3c60eab7.arthurzam@gentoo> (raw)
commit: c82a051e9031149eb51a947c951c145b3c60eab7
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Wed Dec 27 18:35:17 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 28 05:27:13 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=c82a051e
fix: tweak CPV parsing rules to match PMS.
Bug #421 captures this; pkgcore was allowing version components
as the package name if it was suffixed by a revision; the fix
for that incorrectly limited a package name that has a trailing
revision, but *no version syntax* in the name.
This commit just refactors the revision check to also force a check
for a leading version if revision-like is found.
Resolves: https://github.com/pkgcore/pkgcore/issues/421
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/422
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcore/ebuild/cpv.py | 7 ++++++-
tests/ebuild/test_cpv.py | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/pkgcore/ebuild/cpv.py b/src/pkgcore/ebuild/cpv.py
index b7149fc1e..39a0339ed 100644
--- a/src/pkgcore/ebuild/cpv.py
+++ b/src/pkgcore/ebuild/cpv.py
@@ -42,7 +42,12 @@ def isvalid_pkg_name(chunks):
# chunk, i.e. at least one hyphen
if len(chunks) == 1:
return True
- return not (isvalid_version_re.match(chunks[-1]) or isvalid_rev(chunks[-1]))
+ if isvalid_version_re.match(chunks[-1]):
+ return False
+ if len(chunks) >= 3 and isvalid_rev(chunks[-1]):
+ # if the last chunk is a revision, the proceeding *must not* be version like.
+ return not isvalid_version_re.match(chunks[-2])
+ return True
def isvalid_rev(s: str):
diff --git a/tests/ebuild/test_cpv.py b/tests/ebuild/test_cpv.py
index 1a778a936..ae7d80260 100644
--- a/tests/ebuild/test_cpv.py
+++ b/tests/ebuild/test_cpv.py
@@ -64,6 +64,7 @@ class TestCPV:
"bah/f-100dpi",
"dev-util/diffball-blah-monkeys",
"virtual/7z",
+ "x11-drivers/xf86-video-r128",
)
good_vers = ("1", "2.3.4", "2.3.4a", "02.3", "2.03", "3d", "3D")
next reply other threads:[~2023-12-28 5:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-28 5:27 Arthur Zamarin [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-10-23 17:35 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/ Arthur Zamarin
2023-08-29 17:37 Arthur Zamarin
2023-02-02 19:58 Arthur Zamarin
2023-01-17 20:50 Arthur Zamarin
2023-01-02 20:03 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1703741233.c82a051e9031149eb51a947c951c145b3c60eab7.arthurzam@gentoo \
--to=arthurzam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox