coreos: Add a user patch for app-portage/gentoolkit

Fixes an issue I had when working on package updates automation.
This commit is contained in:
Krzesimir Nowak 2023-01-11 14:26:22 +01:00
parent c850639660
commit 545a0b0f36
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,53 @@
From e40cd8c76bee4f7c108c1066d60aaf5d8c3adede Mon Sep 17 00:00:00 2001
From: Krzesimir Nowak <knowak@microsoft.com>
Date: Thu, 8 Dec 2022 16:25:39 +0100
Subject: [PATCH] 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>
---
pym/gentoolkit/profile.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/pym/gentoolkit/profile.py b/pym/gentoolkit/profile.py
index dcd02cc..c880137 100644
--- a/pym/gentoolkit/profile.py
+++ b/pym/gentoolkit/profile.py
@@ -23,19 +23,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 = {}
--
2.25.1

View File

@ -0,0 +1 @@
Drop `0001-profile-Default-to-main-repo-name.patch` when we have gentoolkit 0.6.2 or greater.