From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id B4F09158015 for ; Tue, 26 Dec 2023 17:45:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7D1512BC022; Tue, 26 Dec 2023 17:45:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3C4FC2BC01D for ; Tue, 26 Dec 2023 17:45:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4AAEE335DCC for ; Tue, 26 Dec 2023 17:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DBA531492 for ; Tue, 26 Dec 2023 17:45:12 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1703612638.f9b39f8d7a18859450c6351ef77e72ef032621be.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/, tests/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/cpv.py tests/ebuild/test_cpv.py X-VCS-Directories: src/pkgcore/ebuild/ tests/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: f9b39f8d7a18859450c6351ef77e72ef032621be X-VCS-Branch: master Date: Tue, 26 Dec 2023 17:45:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e7247896-cfb9-48e5-bbe5-cace8881cf11 X-Archives-Hash: d1e2be0dc6389ee88fb87740336748f3 commit: f9b39f8d7a18859450c6351ef77e72ef032621be Author: Brian Harring gmail com> AuthorDate: Mon Dec 25 21:42:12 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Tue Dec 26 17:43:58 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=f9b39f8d Fix: parsing bug that allows a revision to be part of a package The previous logic was just checking for a trailing version component; it wasn't checking for a trailing revision. Relates to issue: #419 Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/cpv.py | 8 ++++---- tests/ebuild/test_cpv.py | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pkgcore/ebuild/cpv.py b/src/pkgcore/ebuild/cpv.py index 774051e07..b7149fc1e 100644 --- a/src/pkgcore/ebuild/cpv.py +++ b/src/pkgcore/ebuild/cpv.py @@ -38,11 +38,11 @@ def isvalid_pkg_name(chunks): if not all(not s or _pkg_re.match(s) for s in chunks): return False # the package name must not end with a hyphen followed by anything that - # looks like a version -- need to ensure that we've gotten more than one + # looks like a version or revision -- need to ensure that we've gotten more than one # chunk, i.e. at least one hyphen - if len(chunks) > 1 and isvalid_version_re.match(chunks[-1]): - return False - return True + if len(chunks) == 1: + return True + return not (isvalid_version_re.match(chunks[-1]) or isvalid_rev(chunks[-1])) def isvalid_rev(s: str): diff --git a/tests/ebuild/test_cpv.py b/tests/ebuild/test_cpv.py index e014d751d..1a778a936 100644 --- a/tests/ebuild/test_cpv.py +++ b/tests/ebuild/test_cpv.py @@ -52,6 +52,7 @@ class TestCPV: "+dfa", "timidity--9f", "ormaybe---13_beta", + "bar-11-r3", ) good_cp = (