public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/, etc/
@ 2020-05-19 23:30 Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2020-05-19 23:30 UTC (permalink / raw
  To: gentoo-commits

commit:     d4afe2d2c1090ec462ae749653a570bd28489c10
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu May 14 02:37:11 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue May 19 23:30:23 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d4afe2d2

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 <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 12 +++++-------
 catalyst/defaults.py       |  2 ++
 doc/catalyst-config.5.txt  | 24 +++++++++++++++---------
 etc/catalystrc             |  3 ---
 4 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 537ab752..2e6b349a 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",
@@ -1308,12 +1307,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..4ea4690f 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,18 @@ written to the target's make.conf if it is not the default value of
 Other settings
 ~~~~~~~~~~~~~~
 
+*jobs*::
+Number of jobs to execute simultaneously.
+
+*load-average*::
+Load-average
+
+*port_logdir*::
+Location for build logs (example: `/var/tmp/catalyst/tmp`).  This dir
+will be automatically cleaned of all logs over 30 days old. If left
+undefined the logs will remain in the build directory as usual and get
+cleaned every time a stage build is restarted.
+
 *sharedir*::
 Catalyst runtime script location.  `/usr/share/catalyst` should work for
 most default installations.  If you are running catalyst from a Git
@@ -145,12 +157,6 @@ checkout, you should change this to point to your checkout directory.
 Location for built seeds, temporary files, and caches (example:
 `/var/tmp/catalyst`).
 
-*port_logdir*::
-Location for build logs (example: `/var/tmp/catalyst/tmp`).  This dir
-will be automatically cleaned of all logs over 30 days old. If left
-undefined the logs will remain in the build directory as usual and get
-cleaned every time a stage build is restarted.
-
 *var_tmpfs_portage*::
 Set the size of a `/var/tmp/portage` tmpfs in gigabytes (example:
 `16`).  If set, this mounts a tmpfs for `/var/tmp/portage` so building

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"


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/, etc/
@ 2020-05-19 23:45 Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2020-05-19 23:45 UTC (permalink / raw
  To: gentoo-commits

commit:     b5668f166f559fbf96e15e4e01fe926d358f6261
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu May 14 02:37:11 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue May 19 23:45:26 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=b5668f16

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 <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 12 +++++-------
 catalyst/defaults.py       |  2 ++
 doc/catalyst-config.5.txt  | 24 +++++++++++++++---------
 etc/catalystrc             |  3 ---
 4 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 5c82a46d..655fc9c7 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",
@@ -1308,12 +1307,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..4ea4690f 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,18 @@ written to the target's make.conf if it is not the default value of
 Other settings
 ~~~~~~~~~~~~~~
 
+*jobs*::
+Number of jobs to execute simultaneously.
+
+*load-average*::
+Load-average
+
+*port_logdir*::
+Location for build logs (example: `/var/tmp/catalyst/tmp`).  This dir
+will be automatically cleaned of all logs over 30 days old. If left
+undefined the logs will remain in the build directory as usual and get
+cleaned every time a stage build is restarted.
+
 *sharedir*::
 Catalyst runtime script location.  `/usr/share/catalyst` should work for
 most default installations.  If you are running catalyst from a Git
@@ -145,12 +157,6 @@ checkout, you should change this to point to your checkout directory.
 Location for built seeds, temporary files, and caches (example:
 `/var/tmp/catalyst`).
 
-*port_logdir*::
-Location for build logs (example: `/var/tmp/catalyst/tmp`).  This dir
-will be automatically cleaned of all logs over 30 days old. If left
-undefined the logs will remain in the build directory as usual and get
-cleaned every time a stage build is restarted.
-
 *var_tmpfs_portage*::
 Set the size of a `/var/tmp/portage` tmpfs in gigabytes (example:
 `16`).  If set, this mounts a tmpfs for `/var/tmp/portage` so building

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"


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-19 23:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-19 23:45 [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/, etc/ Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2020-05-19 23:30 Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox