aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2024-06-27 17:08:08 +0100
committerJames Le Cuirot <chewi@gentoo.org>2024-06-28 14:26:45 +0100
commitdaa4b94f6ef54ac9325de6d9e0a30415400e9ed9 (patch)
treeba2ba72c1a3877a07154710bb69dacc3771d72df
parentstagebase: tweak bindist comment emitted into make.conf (diff)
downloadcatalyst-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>
-rw-r--r--catalyst/base/stagebase.py20
-rw-r--r--doc/catalyst-spec.5.txt5
-rw-r--r--examples/generic_stage_template.spec7
-rw-r--r--examples/livecd-stage1_template.spec7
-rw-r--r--examples/livecd-stage2_template.spec7
-rw-r--r--examples/stage4_template.spec7
6 files changed, 53 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)
diff --git a/doc/catalyst-spec.5.txt b/doc/catalyst-spec.5.txt
index 96f9f3bd..33d17c9e 100644
--- a/doc/catalyst-spec.5.txt
+++ b/doc/catalyst-spec.5.txt
@@ -85,6 +85,11 @@ This option specifies the location of the ebuild repositories that you would
like to have used when building this target. It takes a space-separated list
of directory names. (example: `/usr/local/portage`).
+*keep_repos*::
+This option specifies the names of ebuild repositories that you would like to
+leave configured in the resulting build. It takes a space-separated list of
+names. This only affects the configuration; the contents are never kept.
+
*pkgcache_path*::
This allows the optional directory containing the output packages for
catalyst (example: `/tmp/packages`). Mainly used as a way for
diff --git a/examples/generic_stage_template.spec b/examples/generic_stage_template.spec
index 9d91d07d..770cfdec 100644
--- a/examples/generic_stage_template.spec
+++ b/examples/generic_stage_template.spec
@@ -96,6 +96,13 @@ portage_confdir:
# repos: /usr/local/portage
repos:
+# This option specifies the names of ebuild repositories that you would like to
+# leave configured in the resulting build. It takes a space-separated list of
+# names. This only affects the configuration; the contents are never kept.
+# example:
+# keep_repos: kde qt
+keep_repos:
+
# This allows the optional directory containing the output packages for
# catalyst. Mainly used as a way for different spec files to access the same
# cache directory. Default behavior is for this location to be autogenerated
diff --git a/examples/livecd-stage1_template.spec b/examples/livecd-stage1_template.spec
index b9edb87d..f65ccb24 100644
--- a/examples/livecd-stage1_template.spec
+++ b/examples/livecd-stage1_template.spec
@@ -59,6 +59,13 @@ portage_confdir:
# repos: /usr/local/portage
repos:
+# This option specifies the names of ebuild repositories that you would like to
+# leave configured in the resulting build. It takes a space-separated list of
+# names. This only affects the configuration; the contents are never kept.
+# example:
+# keep_repos: kde qt
+keep_repos:
+
# This allows the optional directory containing the output packages for
# catalyst. Mainly used as a way for different spec files to access the same
# cache directory. Default behavior is for this location to be autogenerated
diff --git a/examples/livecd-stage2_template.spec b/examples/livecd-stage2_template.spec
index b0d2ecd6..1568053a 100644
--- a/examples/livecd-stage2_template.spec
+++ b/examples/livecd-stage2_template.spec
@@ -59,6 +59,13 @@ portage_confdir:
# repos: /usr/local/portage
repos:
+# This option specifies the names of ebuild repositories that you would like to
+# leave configured in the resulting build. It takes a space-separated list of
+# names. This only affects the configuration; the contents are never kept.
+# example:
+# keep_repos: kde qt
+keep_repos:
+
# This allows the optional directory containing the output packages for
# catalyst. Mainly used as a way for different spec files to access the same
# cache directory. Default behavior is for this location to be autogenerated
diff --git a/examples/stage4_template.spec b/examples/stage4_template.spec
index 02910c88..aae49029 100644
--- a/examples/stage4_template.spec
+++ b/examples/stage4_template.spec
@@ -59,6 +59,13 @@ portage_confdir:
# repos: /usr/local/portage
repos:
+# This option specifies the names of ebuild repositories that you would like to
+# leave configured in the resulting build. It takes a space-separated list of
+# names. This only affects the configuration; the contents are never kept.
+# example:
+# keep_repos: kde qt
+keep_repos:
+
# This allows the optional directory containing the output packages for
# catalyst. Mainly used as a way for different spec files to access the same
# cache directory. Default behavior is for this location to be autogenerated