summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrzesimir Nowak <knowak@microsoft.com>2022-12-08 16:25:39 +0100
committerSam James <sam@gentoo.org>2022-12-14 09:24:04 +0000
commitd2b36d9abfaed58360bdc0f92d214beb25a94518 (patch)
tree7f308f82bd2d6275239747ba8d9f00ac3097ee23
parent62d22ed69cecd3ae416b3b899062244865659d5b (diff)
downloadgentoolkit-d2b36d9abfaed58360bdc0f92d214beb25a94518.tar.gz
profile: Default to main repo name
In Flatcar we have a different repo marked as a default one (portage-stable), so "equery keywords" was crashing because it was trying to use gentoo repo anyways. Signed-off-by: Krzesimir Nowak <knowak@microsoft.com> Closes: https://github.com/gentoo/gentoolkit/pull/24 Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--pym/gentoolkit/profile.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py
index f6943be..7469138 100644
--- a/pym/gentoolkit/profile.py
+++ b/pym/gentoolkit/profile.py
@@ -21,21 +21,26 @@ def warning(msg):
print("warning: %s" % msg, file=sys.stderr)
-def load_profile_data(portdir=None, repo="gentoo"):
+def load_profile_data(portdir=None, repo=""):
"""Load the list of known arches from the tree
Args:
portdir: The repository to load all data from (and ignore |repo|)
- repo: Look up this repository by name to locate profile data
+ repo: Look up this repository by name to locate profile data (if empty, uses main repo name)
Returns:
A dict mapping the keyword to its preferred state:
{'x86': ('stable', 'arch'), 'mips': ('dev', '~arch'), ...}
"""
if portdir is None:
- portdir = (
- portage.db[portage.root]["vartree"].settings.repositories[repo].location
- )
+ repos = portage.db[portage.root]["vartree"].settings.repositories
+ if repo == "":
+ main_repo = repos.mainRepo()
+ if main_repo is None:
+ repo = "gentoo"
+ else:
+ repo = main_repo.name
+ portdir = repos[repo].location
arch_status = {}