diff --git a/matter/matter/builder.py b/matter/matter/builder.py index b51184348..5eec33e7b 100644 --- a/matter/matter/builder.py +++ b/matter/matter/builder.py @@ -62,10 +62,6 @@ class PackageBuilder(object): OVERLAYS_SYNC_CMD = shlex.split(os.getenv("MATTER_OVERLAYS_SYNC_CMD", DEFAULT_OVERLAYS_SYNC_CMD)) - DEFAULT_PORTAGE_BUILD_ARGS = "--verbose --nospinner" - PORTAGE_BUILD_ARGS = os.getenv("MATTER_PORTAGE_BUILD_ARGS", - DEFAULT_PORTAGE_BUILD_ARGS).split() - PORTAGE_BUILTIN_ARGS = ["--accept-properties=-interactive"] def __init__(self, emerge_config, packages, params, @@ -626,8 +622,8 @@ class PackageBuilder(object): # non interactive properties, this is not really required # accept-properties just sets os.environ... build_args = [] - build_args += PackageBuilder.PORTAGE_BUILD_ARGS build_args += PackageBuilder.PORTAGE_BUILTIN_ARGS + build_args += self._params['build-args'], build_args += ["=" + best_v for _x, best_v in packages] myaction, myopts, myfiles = parse_opts(build_args) @@ -754,7 +750,7 @@ class PackageBuilder(object): return retval @classmethod - def post_build(cls, emerge_config): + def post_build(cls, spec, emerge_config): """ Execute Portage post-build tasks. """ @@ -763,7 +759,7 @@ class PackageBuilder(object): print_info("executing post-build operations, please wait...") builtin_args = PackageBuilder.PORTAGE_BUILTIN_ARGS _action, opts, _files = parse_opts( - PackageBuilder.PORTAGE_BUILD_ARGS + builtin_args) + builtin_args + spec['build-args']) unmerge(emerge_trees[emerge_settings["ROOT"]]["root_config"], opts, "clean", [], mtimedb["ldpath"], autoclean=1) diff --git a/matter/matter/main.py b/matter/matter/main.py index c30ef2583..2887115a4 100644 --- a/matter/matter/main.py +++ b/matter/matter/main.py @@ -145,7 +145,7 @@ def matter_main(binary_pms, nsargs, cwd, specs): # call post-build cleanup operations, # run it unconditionally - PackageBuilder.post_build(emerge_config) + PackageBuilder.post_build(spec, emerge_config) completed.extend([x for x in local_completed \ if x not in completed]) @@ -245,8 +245,6 @@ Environment variables for Package Builder module: default: %s %s = alternative command used to sync Portage overlays default: %s -%s = custom emerge arguments - default: %s Environment variables passed to --post executables: %s = exit status from previous execution phases, useful for detecting @@ -266,8 +264,6 @@ Available Binary PMSs: darkgreen(PackageBuilder.DEFAULT_PORTAGE_SYNC_CMD), purple("MATTER_OVERLAYS_SYNC_CMD"), darkgreen(PackageBuilder.DEFAULT_OVERLAYS_SYNC_CMD), - purple("MATTER_PORTAGE_BUILD_ARGS"), - darkgreen(PackageBuilder.DEFAULT_PORTAGE_BUILD_ARGS), purple("MATTER_EXIT_STATUS"), darkgreen(MatterResourceLock.LOCK_FILE_PATH), matter_spec_params, diff --git a/matter/matter/spec.py b/matter/matter/spec.py index 6da733e45..45bbb525c 100644 --- a/matter/matter/spec.py +++ b/matter/matter/spec.py @@ -10,6 +10,7 @@ """ import os +import shlex from matter.utils import convert_to_unicode, get_stringtype @@ -60,6 +61,9 @@ class GenericSpecFunctions(object): def ve_integer_converter(self, x): return int(x) + def ve_string_shlex_splitter(self, x): + return list(shlex.split(x)) + def valid_ascii(self, x): try: x = str(x) @@ -126,6 +130,13 @@ class MatterSpec(GenericSpecFunctions): @rtype: dict """ return { + 'build-args': { + 'cb': self.ne_string, + 've': self.ve_string_shlex_splitter, + 'default': ["--verbose", "--nospinner"], + 'desc': "Portage build arguments (default is --verbose\n " + "--nospinner)", + }, 'dependencies': { 'cb': self.valid_yes_no, 've': self.ve_string_stripper, diff --git a/matter/matter_examples/entropy.particle b/matter/matter_examples/entropy.particle index 61a2f8872..0c5032a39 100644 --- a/matter/matter_examples/entropy.particle +++ b/matter/matter_examples/entropy.particle @@ -29,6 +29,10 @@ repository: community0 # Default is: inherit stable: inherit +# Provide custom build arguments to Portage. +# Default is: --verbose --nospinner +build-args: --verbose --nospinner + # Allow Source Package Manager (Portage) repository change? # Valid values are either "yes" or "no" # Default is: no diff --git a/matter/matter_examples/fail.particle b/matter/matter_examples/fail.particle index 0b0f8c970..28f7fd461 100644 --- a/matter/matter_examples/fail.particle +++ b/matter/matter_examples/fail.particle @@ -17,6 +17,10 @@ stable: inherit # Mandatory, cannot be empty repository: community0 +# Provide custom build arguments to Portage. +# Default is: --verbose --nospinner +build-args: --verbose --nospinner + # Allow Source Package Manager (Portage) repository change? # Valid values are either "yes" or "no" # Default is: no diff --git a/matter/matter_examples/misc.particle b/matter/matter_examples/misc.particle index f3ae01f8b..a855e960f 100644 --- a/matter/matter_examples/misc.particle +++ b/matter/matter_examples/misc.particle @@ -17,6 +17,10 @@ stable: inherit # Mandatory, cannot be empty repository: community0 +# Provide custom build arguments to Portage. +# Default is: --verbose --nospinner +build-args: --verbose --nospinner + # Allow Source Package Manager (Portage) repository change? # Valid values are either "yes" or "no" # Default is: no diff --git a/matter/matter_examples/zlib.particle b/matter/matter_examples/zlib.particle index fa88538fc..6f179db7d 100644 --- a/matter/matter_examples/zlib.particle +++ b/matter/matter_examples/zlib.particle @@ -17,6 +17,10 @@ stable: inherit # Mandatory, cannot be empty repository: community0 +# Provide custom build arguments to Portage. +# Default is: --verbose --nospinner +build-args: --verbose --nospinner + # Allow Source Package Manager (Portage) repository change? # Valid values are either "yes" or "no" # Default is: no