public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, catalyst/, etc/
  2020-05-21 20:25 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/ Matt Turner
@ 2020-05-20  1:52 ` Matt Turner
  2020-05-20  3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
  1 sibling, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-05-20  1:52 UTC (permalink / raw
  To: gentoo-commits

commit:     66e78a8d55d0ab99b48c7fe7a327aab9b05b2586
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 03:18:21 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed May 20 01:49:37 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=66e78a8d

catalyst: Convert catalyst.conf to TOML

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py |  4 +--
 catalyst/main.py           | 47 +++++++------------------
 etc/catalyst.conf          | 88 +++++++++++++++++++++++++++-------------------
 3 files changed, 67 insertions(+), 72 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index febaf969..9410f151 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -857,8 +857,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 if 'var_tmpfs_portage' not in self.settings:
                     continue
 
-                mount += ['-t', 'tmpfs', '-o', 'size=' +
-                          self.settings['var_tmpfs_portage'] + 'G']
+                mount += ['-t', 'tmpfs', '-o',
+                          f"size={self.settings['var_tmpfs_portage']}G"]
             elif source == 'tmpfs':
                 mount += ['-t', 'tmpfs']
             elif source == 'shm':

diff --git a/catalyst/main.py b/catalyst/main.py
index be06ccd7..159fe454 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,
@@ -17,8 +19,7 @@ from catalyst.defaults import confdefaults, option_messages, DEFAULT_CONFIG_FILE
 from catalyst.support import CatalystError
 from catalyst.version import get_version
 
-
-conf_values = {}
+conf_values = confdefaults
 
 
 def version():
@@ -30,42 +31,20 @@ def version():
 
 
 def parse_config(config_files):
-    # search a couple of different areas for the main config file
-    myconf = {}
-
-    # 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())
+            conf_values.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']:
         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 "envscript" in myconf:
+    if "envscript" in conf_values:
         log.info('Envscript support enabled.')
 
     # take care of any variable substitutions that may be left
@@ -297,17 +276,17 @@ def _main(parser, opts):
     conf_values['DEBUG'] = opts.debug
     conf_values['VERBOSE'] = opts.debug or opts.verbose
 
-    options = set()
+    options = []
     if opts.fetchonly:
-        options.add('fetch')
+        options.append('fetch')
     if opts.purge:
-        options.add('purge')
+        options.append('purge')
     if opts.purgeonly:
-        options.add('purgeonly')
+        options.append('purgeonly')
     if opts.purgetmponly:
-        options.add('purgetmponly')
+        options.append('purgetmponly')
     if opts.clear_autoresume:
-        options.add('clear-autoresume')
+        options.append('clear-autoresume')
 
     # Make sure we have some work before moving further.
     if not myspecfile and not mycmdline:
@@ -318,7 +297,7 @@ def _main(parser, opts):
     # import configuration file and import our main module using those settings
     parse_config(myconfigs)
 
-    conf_values["options"].update(options)
+    conf_values["options"].extend(options)
     log.notice('conf_values[options] = %s', conf_values['options'])
 
     # initialize our contents generator
@@ -335,7 +314,7 @@ def _main(parser, opts):
 
     if "digests" in conf_values:
         valid_digests = hashlib.algorithms_available
-        digests = set(conf_values['digests'].split())
+        digests = set(conf_values['digests'])
         conf_values['digests'] = digests
 
         # First validate all the requested digests are valid keys.

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 together)
-options="autoresume bindist kerncache pkgcache seedcache"
+envscript = "/etc/catalyst/catalystrc"
+
+# options set different build-time options for catalyst.
+options = [
+	# 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
+	"autoresume",
+
+	# 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)
+	"bindist",
+
+	# Enable FEATURES=ccache
+	# "ccache",
+
+	# Enable FEATURES=distcc. You have to set distcc_hosts in your spec
+	# file.
+	# "distcc",
+
+	# Enable FEATURES=icecream
+	# "icecream",
+
+	# Prevents the removal of the working chroot path and any autoresume
+	# files or points.
+	# "keepwork",
+
+	# keeps a tbz2 of your built kernel and modules (useful if your
+	# build stops in livecd-stage2)
+	"kerncache",
+
+	# Build and use binary packages
+	"pkgcache",
+
+	# Use the build output of a previous target if it exists rather than
+	# the tarball
+	"seedcache",
+
+	# 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.
+	# "sticky-config",
+]
 
 # port_logdir is where all build logs will be kept. 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.
-# port_logdir="/var/tmp/catalyst/tmp"
+# port_logdir = "/var/tmp/catalyst/tmp"
 
 # var_tmpfs_portage will mount a tmpfs for /var/tmp/portage so building takes place in RAM
 # this feature requires a pretty large tmpfs ({open,libre}office needs ~8GB to build)
 # WARNING: If you use too much RAM everything will fail horribly and it is not our fault.
 # set size of /var/tmp/portage tmpfs in gigabytes
-# var_tmpfs_portage=16
+# var_tmpfs_portage = 16


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

* [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/base/, catalyst/, etc/
  2020-05-21 20:25 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/ Matt Turner
  2020-05-20  1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, catalyst/, etc/ Matt Turner
@ 2020-05-20  3:39 ` Matt Turner
  1 sibling, 0 replies; 4+ messages in thread
From: Matt Turner @ 2020-05-20  3:39 UTC (permalink / raw
  To: gentoo-commits

commit:     66e78a8d55d0ab99b48c7fe7a327aab9b05b2586
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 03:18:21 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed May 20 01:49:37 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=66e78a8d

catalyst: Convert catalyst.conf to TOML

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py |  4 +--
 catalyst/main.py           | 47 +++++++------------------
 etc/catalyst.conf          | 88 +++++++++++++++++++++++++++-------------------
 3 files changed, 67 insertions(+), 72 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index febaf969..9410f151 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -857,8 +857,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 if 'var_tmpfs_portage' not in self.settings:
                     continue
 
-                mount += ['-t', 'tmpfs', '-o', 'size=' +
-                          self.settings['var_tmpfs_portage'] + 'G']
+                mount += ['-t', 'tmpfs', '-o',
+                          f"size={self.settings['var_tmpfs_portage']}G"]
             elif source == 'tmpfs':
                 mount += ['-t', 'tmpfs']
             elif source == 'shm':

diff --git a/catalyst/main.py b/catalyst/main.py
index be06ccd7..159fe454 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,
@@ -17,8 +19,7 @@ from catalyst.defaults import confdefaults, option_messages, DEFAULT_CONFIG_FILE
 from catalyst.support import CatalystError
 from catalyst.version import get_version
 
-
-conf_values = {}
+conf_values = confdefaults
 
 
 def version():
@@ -30,42 +31,20 @@ def version():
 
 
 def parse_config(config_files):
-    # search a couple of different areas for the main config file
-    myconf = {}
-
-    # 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())
+            conf_values.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']:
         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 "envscript" in myconf:
+    if "envscript" in conf_values:
         log.info('Envscript support enabled.')
 
     # take care of any variable substitutions that may be left
@@ -297,17 +276,17 @@ def _main(parser, opts):
     conf_values['DEBUG'] = opts.debug
     conf_values['VERBOSE'] = opts.debug or opts.verbose
 
-    options = set()
+    options = []
     if opts.fetchonly:
-        options.add('fetch')
+        options.append('fetch')
     if opts.purge:
-        options.add('purge')
+        options.append('purge')
     if opts.purgeonly:
-        options.add('purgeonly')
+        options.append('purgeonly')
     if opts.purgetmponly:
-        options.add('purgetmponly')
+        options.append('purgetmponly')
     if opts.clear_autoresume:
-        options.add('clear-autoresume')
+        options.append('clear-autoresume')
 
     # Make sure we have some work before moving further.
     if not myspecfile and not mycmdline:
@@ -318,7 +297,7 @@ def _main(parser, opts):
     # import configuration file and import our main module using those settings
     parse_config(myconfigs)
 
-    conf_values["options"].update(options)
+    conf_values["options"].extend(options)
     log.notice('conf_values[options] = %s', conf_values['options'])
 
     # initialize our contents generator
@@ -335,7 +314,7 @@ def _main(parser, opts):
 
     if "digests" in conf_values:
         valid_digests = hashlib.algorithms_available
-        digests = set(conf_values['digests'].split())
+        digests = set(conf_values['digests'])
         conf_values['digests'] = digests
 
         # First validate all the requested digests are valid keys.

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 together)
-options="autoresume bindist kerncache pkgcache seedcache"
+envscript = "/etc/catalyst/catalystrc"
+
+# options set different build-time options for catalyst.
+options = [
+	# 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
+	"autoresume",
+
+	# 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)
+	"bindist",
+
+	# Enable FEATURES=ccache
+	# "ccache",
+
+	# Enable FEATURES=distcc. You have to set distcc_hosts in your spec
+	# file.
+	# "distcc",
+
+	# Enable FEATURES=icecream
+	# "icecream",
+
+	# Prevents the removal of the working chroot path and any autoresume
+	# files or points.
+	# "keepwork",
+
+	# keeps a tbz2 of your built kernel and modules (useful if your
+	# build stops in livecd-stage2)
+	"kerncache",
+
+	# Build and use binary packages
+	"pkgcache",
+
+	# Use the build output of a previous target if it exists rather than
+	# the tarball
+	"seedcache",
+
+	# 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.
+	# "sticky-config",
+]
 
 # port_logdir is where all build logs will be kept. 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.
-# port_logdir="/var/tmp/catalyst/tmp"
+# port_logdir = "/var/tmp/catalyst/tmp"
 
 # var_tmpfs_portage will mount a tmpfs for /var/tmp/portage so building takes place in RAM
 # this feature requires a pretty large tmpfs ({open,libre}office needs ~8GB to build)
 # WARNING: If you use too much RAM everything will fail horribly and it is not our fault.
 # set size of /var/tmp/portage tmpfs in gigabytes
-# var_tmpfs_portage=16
+# var_tmpfs_portage = 16


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

* [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/
@ 2020-05-21 20:25 Matt Turner
  2020-05-20  1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, catalyst/, etc/ Matt Turner
  2020-05-20  3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
  0 siblings, 2 replies; 4+ messages in thread
From: Matt Turner @ 2020-05-21 20:25 UTC (permalink / raw
  To: gentoo-commits

commit:     66e78a8d55d0ab99b48c7fe7a327aab9b05b2586
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sat May 16 03:18:21 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed May 20 01:49:37 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=66e78a8d

catalyst: Convert catalyst.conf to TOML

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py |  4 +--
 catalyst/main.py           | 47 +++++++------------------
 etc/catalyst.conf          | 88 +++++++++++++++++++++++++++-------------------
 3 files changed, 67 insertions(+), 72 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index febaf969..9410f151 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -857,8 +857,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
                 if 'var_tmpfs_portage' not in self.settings:
                     continue
 
-                mount += ['-t', 'tmpfs', '-o', 'size=' +
-                          self.settings['var_tmpfs_portage'] + 'G']
+                mount += ['-t', 'tmpfs', '-o',
+                          f"size={self.settings['var_tmpfs_portage']}G"]
             elif source == 'tmpfs':
                 mount += ['-t', 'tmpfs']
             elif source == 'shm':

diff --git a/catalyst/main.py b/catalyst/main.py
index be06ccd7..159fe454 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,
@@ -17,8 +19,7 @@ from catalyst.defaults import confdefaults, option_messages, DEFAULT_CONFIG_FILE
 from catalyst.support import CatalystError
 from catalyst.version import get_version
 
-
-conf_values = {}
+conf_values = confdefaults
 
 
 def version():
@@ -30,42 +31,20 @@ def version():
 
 
 def parse_config(config_files):
-    # search a couple of different areas for the main config file
-    myconf = {}
-
-    # 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())
+            conf_values.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']:
         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 "envscript" in myconf:
+    if "envscript" in conf_values:
         log.info('Envscript support enabled.')
 
     # take care of any variable substitutions that may be left
@@ -297,17 +276,17 @@ def _main(parser, opts):
     conf_values['DEBUG'] = opts.debug
     conf_values['VERBOSE'] = opts.debug or opts.verbose
 
-    options = set()
+    options = []
     if opts.fetchonly:
-        options.add('fetch')
+        options.append('fetch')
     if opts.purge:
-        options.add('purge')
+        options.append('purge')
     if opts.purgeonly:
-        options.add('purgeonly')
+        options.append('purgeonly')
     if opts.purgetmponly:
-        options.add('purgetmponly')
+        options.append('purgetmponly')
     if opts.clear_autoresume:
-        options.add('clear-autoresume')
+        options.append('clear-autoresume')
 
     # Make sure we have some work before moving further.
     if not myspecfile and not mycmdline:
@@ -318,7 +297,7 @@ def _main(parser, opts):
     # import configuration file and import our main module using those settings
     parse_config(myconfigs)
 
-    conf_values["options"].update(options)
+    conf_values["options"].extend(options)
     log.notice('conf_values[options] = %s', conf_values['options'])
 
     # initialize our contents generator
@@ -335,7 +314,7 @@ def _main(parser, opts):
 
     if "digests" in conf_values:
         valid_digests = hashlib.algorithms_available
-        digests = set(conf_values['digests'].split())
+        digests = set(conf_values['digests'])
         conf_values['digests'] = digests
 
         # First validate all the requested digests are valid keys.

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 together)
-options="autoresume bindist kerncache pkgcache seedcache"
+envscript = "/etc/catalyst/catalystrc"
+
+# options set different build-time options for catalyst.
+options = [
+	# 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
+	"autoresume",
+
+	# 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)
+	"bindist",
+
+	# Enable FEATURES=ccache
+	# "ccache",
+
+	# Enable FEATURES=distcc. You have to set distcc_hosts in your spec
+	# file.
+	# "distcc",
+
+	# Enable FEATURES=icecream
+	# "icecream",
+
+	# Prevents the removal of the working chroot path and any autoresume
+	# files or points.
+	# "keepwork",
+
+	# keeps a tbz2 of your built kernel and modules (useful if your
+	# build stops in livecd-stage2)
+	"kerncache",
+
+	# Build and use binary packages
+	"pkgcache",
+
+	# Use the build output of a previous target if it exists rather than
+	# the tarball
+	"seedcache",
+
+	# 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.
+	# "sticky-config",
+]
 
 # port_logdir is where all build logs will be kept. 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.
-# port_logdir="/var/tmp/catalyst/tmp"
+# port_logdir = "/var/tmp/catalyst/tmp"
 
 # var_tmpfs_portage will mount a tmpfs for /var/tmp/portage so building takes place in RAM
 # this feature requires a pretty large tmpfs ({open,libre}office needs ~8GB to build)
 # WARNING: If you use too much RAM everything will fail horribly and it is not our fault.
 # set size of /var/tmp/portage tmpfs in gigabytes
-# var_tmpfs_portage=16
+# var_tmpfs_portage = 16


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

* [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/
@ 2023-08-11 20:44 Andreas K. Hüttel
  0 siblings, 0 replies; 4+ messages in thread
From: Andreas K. Hüttel @ 2023-08-11 20:44 UTC (permalink / raw
  To: gentoo-commits

commit:     750947eed34fe51a9502b16585a59f34bd47b1a1
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  9 21:22:55 2023 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug 11 19:55:12 2023 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=750947ee

Add configuration options and code to write out binrepos.conf

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/base/stagebase.py | 32 ++++++++++++++++++++++++++++++++
 catalyst/defaults.py       |  3 +++
 etc/catalyst.conf          |  5 +++++
 3 files changed, 40 insertions(+)

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/"


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

end of thread, other threads:[~2023-08-11 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-21 20:25 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/ Matt Turner
2020-05-20  1:52 ` [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, catalyst/, etc/ Matt Turner
2020-05-20  3:39 ` [gentoo-commits] proj/catalyst:pending/mattst88 " Matt Turner
  -- strict thread matches above, loose matches on Subject: below --
2023-08-11 20:44 [gentoo-commits] proj/catalyst:master commit in: catalyst/base/, etc/, catalyst/ Andreas K. Hüttel

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