diff options
author | James Le Cuirot <chewi@gentoo.org> | 2024-06-27 17:08:08 +0100 |
---|---|---|
committer | James Le Cuirot <chewi@gentoo.org> | 2024-06-28 14:26:45 +0100 |
commit | daa4b94f6ef54ac9325de6d9e0a30415400e9ed9 (patch) | |
tree | ba2ba72c1a3877a07154710bb69dacc3771d72df /catalyst | |
parent | stagebase: tweak bindist comment emitted into make.conf (diff) | |
download | catalyst-daa4b94f6ef54ac9325de6d9e0a30415400e9ed9.tar.gz catalyst-daa4b94f6ef54ac9325de6d9e0a30415400e9ed9.tar.bz2 catalyst-daa4b94f6ef54ac9325de6d9e0a30415400e9ed9.zip |
Add keep_repos spec option to keep config for specified repos4.0-rc2
All repo configuration is currently removed unconditionally. Gentoo
itself doesn't really need this, but derivatives probably do.
Closes: https://github.com/gentoo/catalyst/pull/16
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'catalyst')
-rw-r--r-- | catalyst/base/stagebase.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 34e1b6d1..2dcf6d71 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -75,6 +75,7 @@ class StageBase(TargetBase, ClearBase, GenBase): "hostuse", "install_mask", "interpreter", + "keep_repos", "kerncache_path", "ldflags", "pkgcache_path", @@ -205,6 +206,7 @@ class StageBase(TargetBase, ClearBase, GenBase): self.set_busybox_config() self.set_overlay() self.set_repos() + self.set_keep_repos() self.set_root_overlay() # This next line checks to make sure that the specified variables exist on disk. @@ -661,6 +663,22 @@ class StageBase(TargetBase, ClearBase, GenBase): get_info = lambda repo: (repo, get_repo_name(repo), None) self.repos.extend(map(get_info, self.settings['repos'])) + def set_keep_repos(self): + setting = self.settings.get('keep_repos', '') + + if isinstance(setting, str): + self.settings['keep_repos'] = set(setting.split()) + + log.info('keeping repo configuration for: %s', + ' '.join(self.settings['keep_repos'])) + + for keep_repo in self.settings['keep_repos']: + for _, name, _ in self.repos: + if name == keep_repo: + break + else: + log.warning('keep_repos references unknown repo: %s', keep_repo) + def set_overlay(self): if self.settings["spec_prefix"] + "/overlay" in self.settings: if isinstance(self.settings[self.settings['spec_prefix'] + '/overlay'], str): @@ -1286,6 +1304,8 @@ class StageBase(TargetBase, ClearBase, GenBase): # Remove repo data for _, name, _ in self.repos: + if name in self.settings['keep_repos']: + continue # Remove repos.conf entry repo_conf = self.get_repo_conf_path(name) |