[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, etc/, catalyst/base/, targets/support/, doc/
commit: 96cc906860f38bf015b0fa0ea3cd9d256e73b568 Author: Matt Turner gentoo org> AuthorDate: Thu May 14 02:37:11 2020 + Commit: Matt Turner gentoo org> CommitDate: Wed May 20 02:33:46 2020 + URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=96cc9068 catalyst: Set jobs/load-average via catalyst.conf We currently have two mechanisms of setting MAKEOPTS: in spec files and in catalystrc. Setting makeopts in spec files doesn't make sense. The spec should describe the thing that's being built and not contain options that are specific to the build system. Setting makeopts via catalystrc is better, but it only applies to the actual build system invocations, leaving emerge to run jobs serially or again requiring configuration specific to the build machine to be put into the spec file. For example: update_seed_command: ... --jobs 5 --load-average 5 With jobs and load-average specified in catalyst.conf, catalyst has the information required to configure both emerge and the build systems emerge executes. This removes the undocumented makeopts spec file option and replaces it with jobs and load-average settings in catalyst.conf. Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 12 +--- catalyst/defaults.py| 2 ++ doc/catalyst-config.5.txt | 15 --- etc/catalystrc | 3 --- targets/support/chroot-functions.sh | 8 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 9ea72b48..9506e6b3 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -56,7 +56,6 @@ class StageBase(TargetBase, ClearBase, GenBase): "hostuse", "kerncache_path", "ldflags", -"makeopts", "pkgcache_path", "portage_confdir", "portage_overlay", @@ -1305,12 +1304,11 @@ class StageBase(TargetBase, ClearBase, GenBase): else: self.env[varname] = "false" -if "makeopts" in self.settings: -if isinstance(self.settings["makeopts"], str): -self.env["MAKEOPTS"] = self.settings["makeopts"] -else: -# ensure makeopts is a string -self.env["MAKEOPTS"] = ' '.join(self.settings["makeopts"]) +makeopts = [] +for flag, setting in {'j': 'jobs', 'l': 'load-average'}.items(): +if setting in self.settings: +makeopts.append(f'-{flag}{self.settings[setting]}') +self.env['MAKEOPTS'] = ' '.join(makeopts) log.debug('setup_environment(); env = %r', self.env) diff --git a/catalyst/defaults.py b/catalyst/defaults.py index 14f671fe..b31d5b50 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -12,6 +12,8 @@ valid_config_file_values = frozenset([ "digests", "distdir", "envscript", +"jobs", +"load-average", "options", "port_logdir", "repo_basedir", diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt index 7ac9a2a3..cbef6092 100644 --- a/doc/catalyst-config.5.txt +++ b/doc/catalyst-config.5.txt @@ -48,9 +48,9 @@ $ python3 -c 'import hashlib; print(hashlib.algorithms_available)' *envscript*:: Environment script location, which allows users to set options such as -HTTP proxies, `MAKEOPTS`, `GENTOO_MIRRORS`, or any other environment -variables needed for building. The envscript file sets environment -variables using POSIX shell notation: +HTTP proxies, `GENTOO_MIRRORS`, or any other environment variables +needed for building. The envscript file sets environment variables +using POSIX shell notation: + - export FOO="bar" @@ -136,6 +136,15 @@ written to the target's make.conf if it is not the default value of Other settings ~~ +*jobs*:: +Integral value passed to *emerge(1)* as the parameter to --jobs and is +used to define *MAKEOPTS* during the target build. + +*load-average*:: +Floating-point value passed to *emerge(1)* as the parameter to +--load-average and is used to define *MAKEOPTS* during the target +build. + *sharedir*:: Catalyst runtime script location. `/usr/share/catalyst` should work for most default installations. If you are running catalyst from a Git diff --git a/etc/catalystrc b/etc/catalystrc index bcd729af..e7904128 100755 --- a/etc/catalystrc +++ b/etc/catalystrc @@ -1,5 +1,2 @@ #!/bin/bash # This is an example catalystrc. As such, it doesn't actually *do* anything. - -# Uncomment the following to increase the number of threads used to compile. -# export MAKEOPTS="-j16" diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh index 47239b96..d4c50983 100755 --- a/targets/support/chroot-functions.sh +++ b/targets/support/chroot-functions.sh @@ -130,6 +130,14 @@ setup_emerge_o
[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, etc/
commit: e8fe54bee45e5c6dc700ed1a9041c3b5ec194374 Author: Matt Turner gentoo org> AuthorDate: Sat May 16 03:18:21 2020 + Commit: Matt Turner gentoo org> CommitDate: Tue May 19 23:04:15 2020 + URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e8fe54be catalyst: Convert catalyst.conf to TOML Signed-off-by: Matt Turner gentoo.org> catalyst/main.py | 29 +- etc/catalyst.conf | 88 --- 2 files changed, 60 insertions(+), 57 deletions(-) diff --git a/catalyst/main.py b/catalyst/main.py index be06ccd7..4a55ebe2 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -5,6 +5,8 @@ import os import sys import textwrap +import toml + from snakeoil.process import namespaces from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, @@ -30,42 +32,27 @@ def version(): def parse_config(config_files): -# search a couple of different areas for the main config file -myconf = {} +config = confdefaults -# try and parse the config file "config_file" for config_file in config_files: log.notice('Loading configuration file: %s', config_file) try: -config = catalyst.config.ConfigParser(config_file) -myconf.update(config.get_values()) +config.update(toml.load(config_file)) except Exception as e: log.critical('Could not find parse configuration file: %s: %s', config_file, e) -# now, load up the values into conf_values so that we can use them -for x in list(confdefaults): -if x in myconf: -if x == 'options': -conf_values[x] = set(myconf[x].split()) -elif x in ["decompressor_search_order"]: -conf_values[x] = myconf[x].split() -else: -conf_values[x] = myconf[x] -else: -conf_values[x] = confdefaults[x] - # print out any options messages -for opt in conf_values['options']: +for opt in config['options']: if opt in option_messages: log.info(option_messages[opt]) for key in ["digests", "envscript", "var_tmpfs_portage", "port_logdir", "local_overlay", "repos"]: -if key in myconf: -conf_values[key] = myconf[key] +if key in config: +conf_values[key] = config[key] -if "envscript" in myconf: +if "envscript" in conf_values: log.info('Envscript support enabled.') # take care of any variable substitutions that may be left diff --git a/etc/catalyst.conf b/etc/catalyst.conf index d33be15f..2272cb86 100644 --- a/etc/catalyst.conf +++ b/etc/catalyst.conf @@ -10,53 +10,69 @@ # # $ python3 -c 'import hashlib; print(hashlib.algorithms_available)' # -digests="blake2b sha512" +digests = ["blake2b", "sha512"] # envscript allows users to set options such as http proxies, MAKEOPTS, # GENTOO_MIRRORS, or any other environment variables needed for building. # The envscript file sets environment variables like so: # export FOO="bar" -envscript="/etc/catalyst/catalystrc" - -# options set different build-time options for catalyst. Some examples are: -# autoresume = Attempt to resume a failed build, clear the autoresume flags with -# the -a option to the catalyst cmdline. -p will clear the autoresume flags -# as well as your pkgcache and kerncache -# ( This option is not fully tested, bug reports welcome ) -# bindist = enables the bindist USE flag, please see package specific definition, -# however, it is suggested to enable this if redistributing builds. -# This optional USE flag is normally cleaned from the make.conf file on -# completion of the stage. For a non-cleaned version, -# use sticky-config also (see below) -# ccache = enables build time ccache support -# distcc = enable distcc support for building. You have to set distcc_hosts in -# your spec file. -# icecream = enables icecream compiler cluster support for building -# keepwork = Prevents the removal of the working chroot path and any autoresume -# files or points. -# kerncache = keeps a tbz2 of your built kernel and modules (useful if your -# build stops in livecd-stage2) -# pkgcache = keeps a tbz2 of every built package (useful if your build stops -# prematurely) -# seedcache = use the build output of a previous target if it exists to speed up -# the copy -# sticky-config = enables the code that will keep any internal 'catalyst_use' flags -# added to the USE= for building the stage. These are usually added for legal -# or specific needs in building the the early stage. Mostly it is the -# 'bindist' USE flag option that is used for legal reasons, please see its -# specific definition. It will also keep any /etc/portage/package.* -# files or directories. -# -# (These options can be used to
[gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/, etc/, catalyst/base/, doc/
commit: 29134aec0e33188fd2a3decbdd1e8a53d6a5b122 Author: Matt Turner gentoo org> AuthorDate: Thu May 14 02:37:11 2020 + Commit: Matt Turner gentoo org> CommitDate: Sat May 16 06:51:52 2020 + URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=29134aec catalyst: Set makeopts via catalyst.conf We currently have two mechanisms of setting MAKEOPTS: in spec files and in catalystrc. Setting makeopts in spec files doesn't make sense. The spec should describe the thing that's being built and not contain options that are specific to the build system. Setting makeopts via catalystrc is better, but it only applies to the actual build system invocations, leaving emerge to run jobs serially or again requiring configuration specific to the build machine to be put into the spec file. For example: update_seed_command: ... --jobs 5 --load-average 5 With makeopts specified in catalyst.conf, catalyst has the information required to configure both emerge and the build systems emerge executes. This removes the undocumented makeopts spec file option and replaces it with a setting in catalyst.conf. Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 1 - catalyst/defaults.py | 1 + doc/catalyst-config.5.txt | 6 +++--- etc/catalystrc | 3 --- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 651bf4e4..8340517b 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -56,7 +56,6 @@ class StageBase(TargetBase, ClearBase, GenBase): "hostuse", "kerncache_path", "ldflags", -"makeopts", "pkgcache_path", "portage_confdir", "portage_overlay", diff --git a/catalyst/defaults.py b/catalyst/defaults.py index 404f4892..ae09aab6 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -61,6 +61,7 @@ confdefaults = { "local_overlay": "/var/db/repos/local", "port_conf": "/etc/portage", "make_conf": "%(port_conf)s/make.conf", +"makeopts": "", "options": set(), "pkgdir": "/var/cache/binpkgs", "port_tmpdir": "/var/tmp/portage", diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt index 7ac9a2a3..4045efb5 100644 --- a/doc/catalyst-config.5.txt +++ b/doc/catalyst-config.5.txt @@ -48,9 +48,9 @@ $ python3 -c 'import hashlib; print(hashlib.algorithms_available)' *envscript*:: Environment script location, which allows users to set options such as -HTTP proxies, `MAKEOPTS`, `GENTOO_MIRRORS`, or any other environment -variables needed for building. The envscript file sets environment -variables using POSIX shell notation: +HTTP proxies, `GENTOO_MIRRORS`, or any other environment variables +needed for building. The envscript file sets environment variables +using POSIX shell notation: + - export FOO="bar" diff --git a/etc/catalystrc b/etc/catalystrc index bcd729af..e7904128 100755 --- a/etc/catalystrc +++ b/etc/catalystrc @@ -1,5 +1,2 @@ #!/bin/bash # This is an example catalystrc. As such, it doesn't actually *do* anything. - -# Uncomment the following to increase the number of threads used to compile. -# export MAKEOPTS="-j16"