public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/
Date: Wed, 14 Dec 2022 09:24:08 +0000 (UTC)	[thread overview]
Message-ID: <1671009844.d2b36d9abfaed58360bdc0f92d214beb25a94518.sam@gentoo> (raw)

commit:     d2b36d9abfaed58360bdc0f92d214beb25a94518
Author:     Krzesimir Nowak <knowak <AT> microsoft <DOT> com>
AuthorDate: Thu Dec  8 15:25:39 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Dec 14 09:24:04 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=d2b36d9a

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 <AT> microsoft.com>
Closes: https://github.com/gentoo/gentoolkit/pull/24
Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/profile.py | 15 ++++++++++-----
 1 file 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 = {}
 


             reply	other threads:[~2022-12-14  9:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14  9:24 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-05-03  5:55 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/ Sam James
2024-03-07 18:49 Sam James
2024-03-07 15:08 Sam James
2024-02-17  0:01 Sam James
2024-02-16 20:39 Sam James
2024-02-16 20:39 Sam James
2024-02-16 20:39 Sam James
2022-07-10  7:53 Brian Dolbec
2022-07-10  7:53 Brian Dolbec
2021-09-21 21:01 Matt Turner
2020-10-13 14:14 Brian Dolbec
2020-10-09  6:29 Georgy Yakovlev
2020-04-24  8:06 Michał Górny
2019-07-29  0:51 Zac Medico
2019-05-11 22:43 Virgil Dupras
2018-09-17 23:32 Virgil Dupras
2017-09-06 18:33 Paul Varner
2016-09-15 16:02 Brian Dolbec
2016-08-16 16:05 Paul Varner
2016-07-25 18:04 Paul Varner
2016-07-08 15:37 Brian Dolbec
2015-10-22 16:13 Paul Varner

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=1671009844.d2b36d9abfaed58360bdc0f92d214beb25a94518.sam@gentoo \
    --to=sam@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