aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2023-08-09 23:22:55 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2023-08-11 21:55:12 +0200
commit750947eed34fe51a9502b16585a59f34bd47b1a1 (patch)
treebd8753f4df4b8da58d8a912d8ef70a0a3e3c8fd9
parentAdd m68k musl definition (diff)
downloadcatalyst-750947eed34fe51a9502b16585a59f34bd47b1a1.tar.gz
catalyst-750947eed34fe51a9502b16585a59f34bd47b1a1.tar.bz2
catalyst-750947eed34fe51a9502b16585a59f34bd47b1a1.zip
Add configuration options and code to write out binrepos.conf
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r--catalyst/base/stagebase.py32
-rw-r--r--catalyst/defaults.py3
-rw-r--r--etc/catalyst.conf5
3 files changed, 40 insertions, 0 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 74d197b5..a9147241 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -62,6 +62,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
])
self.valid_values |= self.required_values | frozenset([
"asflags",
+ "binrepo_path",
"catalyst_use",
"cbuild",
"cflags",
@@ -1074,6 +1075,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
if os.path.exists(hosts_file):
os.rename(hosts_file, hosts_file + '.catalyst')
shutil.copy('/etc/hosts', hosts_file)
+
# write out the make.conf
try:
self.write_make_conf(setup=True)
@@ -1081,6 +1083,16 @@ class StageBase(TargetBase, ClearBase, GenBase):
raise CatalystError('Could not write %s: %s' % (
normpath(self.settings["chroot_path"] +
self.settings["make_conf"]), e)) from e
+
+ # write out the binrepos.conf
+ # we do this here for later user convenience, but normally
+ # it should not affect stage builds (which only get --usepkg,
+ # but never --getbinpkg as emerge parameters).
+ try:
+ self.write_binrepos_conf()
+ except OSError as e:
+ raise CatalystError('Could not write binrepos.conf: %s' % ( e )) from e
+
self.resume.enable("chroot_setup")
def write_make_conf(self, setup=True):
@@ -1174,6 +1186,26 @@ class StageBase(TargetBase, ClearBase, GenBase):
'# Please keep this setting intact when reporting bugs.\n'
'LC_MESSAGES=C.utf8\n')
+ def write_binrepos_conf(self):
+ # only if catalyst.conf defines the host and the spec defines the path...
+ if self.settings["binhost"] != '' and "binrepo_path" in self.settings:
+
+ # Write out binrepos.conf (for the chroot)
+ binrpath = normpath(self.settings["chroot_path"] +
+ self.settings["binrepos_conf"])
+
+ with open(binrpath, "w") as myb:
+ log.notice("Writing the stage binrepos.conf to: %s" % binrpath)
+ myb.write("# These settings were set by the catalyst build script "
+ "that automatically\n# built this stage.\n")
+ myb.write("# Please consider using a local mirror.\n\n")
+ myb.write("[gentoobinhost]\n")
+ myb.write("priority = 1\n")
+ myb.write("sync-uri = " + self.settings["binhost"] + \
+ self.settings["binrepo_path"] + "\n")
+
+ return
+
def fsscript(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("fsscript"):
diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 39b71c34..f4d48fef 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -9,6 +9,7 @@ from DeComp.definitions import DECOMPRESSOR_PROGRAM_OPTIONS, LIST_XATTRS_OPTIONS
valid_config_file_values = frozenset([
+ "binhost",
"compression_mode",
"digests",
"digest_format",
@@ -31,6 +32,7 @@ valid_config_file_values = frozenset([
])
confdefaults = {
+ "binhost": '',
"comp_prog": COMPRESSOR_PROGRAM_OPTIONS['linux'],
"compression_mode": 'lbzip2',
"compressor_arch": None,
@@ -42,6 +44,7 @@ confdefaults = {
"icecream": "/var/cache/icecream",
'list_xattrs_opt': LIST_XATTRS_OPTIONS['linux'],
"port_conf": "/etc/portage",
+ "binrepos_conf": "%(port_conf)s/binrepos.conf",
"make_conf": "%(port_conf)s/make.conf",
"repos_conf": "%(port_conf)s/repos.conf",
"options": set(),
diff --git a/etc/catalyst.conf b/etc/catalyst.conf
index b0b284fa..8745d0b5 100644
--- a/etc/catalyst.conf
+++ b/etc/catalyst.conf
@@ -83,3 +83,8 @@ options = [
# Floating-point value passed to emerge as the parameter to --load-average and
# is used to define MAKEOPTS during the target build.
# load-average = 4.0
+
+# If you want catalyst to drop a binrepos.conf into /etc/portage, then
+# define the binhost here. This value is concatenated with the configuration
+# option binrepo_path in the spec file to obtain the src-uri.
+# binhost = "https://gentoo.osuosl.org/releases/"