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 B1E60158009 for ; Thu, 29 Jun 2023 08:19:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 73E73E07EF; Thu, 29 Jun 2023 08:19:33 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 4F23AE07EF for ; Thu, 29 Jun 2023 08:19:33 +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 06421340DF6 for ; Thu, 29 Jun 2023 08:19:32 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 957F2A9B for ; Thu, 29 Jun 2023 08:19:30 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1688026767.5de6c63d0779eee0942a294b3a53ee1cce9d6d07.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/actions.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 5de6c63d0779eee0942a294b3a53ee1cce9d6d07 X-VCS-Branch: master Date: Thu, 29 Jun 2023 08:19:30 +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: 0a2b5b68-428f-4cd8-a014-4166b87c558e X-Archives-Hash: 5cb51646eb1b7fa39db6cbad2e08ab56 commit: 5de6c63d0779eee0942a294b3a53ee1cce9d6d07 Author: Berin Aniesh gmail com> AuthorDate: Sun Jun 18 03:41:12 2023 +0000 Commit: Sam James gentoo org> CommitDate: Thu Jun 29 08:19:27 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5de6c63d actions.py: refactor getportageversion() into smaller functions Signed-off-by: Berin Aniesh gmail.com> Signed-off-by: Sam James gentoo.org> lib/_emerge/actions.py | 51 ++++++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 60199dae6..dae6b6b7b 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2789,16 +2789,23 @@ def relative_profile_path(portdir, abs_profile): profilever = None return profilever +def get_libc_version(vardb): + libcver = [] + libclist = set() + for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): + if not atom.blocker: + libclist.update(vardb.match(atom)) + if libclist: + for cpv in sorted(libclist): + libc_split = portage.catpkgsplit(cpv)[1:] + if libc_split[-1] == "r0": + libc_split = libc_split[:-1] + libcver.append("-".join(libc_split)) + else: + libcver = ["unavailable"] + return libcver -def getportageversion(portdir, _unused, profile, chost, vardb): - pythonver = ( - "python" - f" {sys.version_info[0]}" - f".{sys.version_info[1]}" - f".{sys.version_info[2]}" - f"-{sys.version_info[3]}" - f"-{sys.version_info[4]}" - ) +def get_profile_version(portdir, profile, vardb): profilever = None repositories = vardb.settings.repositories if profile: @@ -2838,21 +2845,21 @@ def getportageversion(portdir, _unused, profile, chost, vardb): if profilever is None: profilever = "unavailable" + + return profilever - libcver = [] - libclist = set() - for atom in expand_new_virt(vardb, portage.const.LIBC_PACKAGE_ATOM): - if not atom.blocker: - libclist.update(vardb.match(atom)) - if libclist: - for cpv in sorted(libclist): - libc_split = portage.catpkgsplit(cpv)[1:] - if libc_split[-1] == "r0": - libc_split = libc_split[:-1] - libcver.append("-".join(libc_split)) - else: - libcver = ["unavailable"] +def getportageversion(portdir, _unused, profile, chost, vardb): + pythonver = ( + "python" + f" {sys.version_info[0]}" + f".{sys.version_info[1]}" + f".{sys.version_info[2]}" + f"-{sys.version_info[3]}" + f"-{sys.version_info[4]}" + ) + profilever = get_profile_version(portdir, profile, vardb) + libcver = get_libc_version(vardb) gccver = getgccversion(chost) unameout = platform.release() + " " + platform.machine()