diff --git a/config/edk2-base.yaml b/config/edk2-base.yaml index daf779a8d4e84d999034e2a3f0d1c747d89e8df2..c2603fd3864551f01b188f9e14d553e8100db60c 100644 --- a/config/edk2-base.yaml +++ b/config/edk2-base.yaml @@ -38,7 +38,7 @@ build: build: - make -j${param:jobs} -C acpica - - source edk2/edksetup.sh + - source edk2/edksetup.sh --reconfig - make -j${param:jobs} -C edk2/BaseTools - build -n ${param:jobs} -D EDK2_OUT_DIR=${param:builddir} ${param:join_space} diff --git a/shrinkwrap/commands/build.py b/shrinkwrap/commands/build.py index 22f3bd2256e1a5f3aea64687b9a34987e65a6d67..ce8d1d153655187847a49097a5393b68e71e3667 100644 --- a/shrinkwrap/commands/build.py +++ b/shrinkwrap/commands/build.py @@ -48,11 +48,13 @@ def add_parser(parser, formatter): config store are built.""") cmdp.add_argument('-o', '--overlay', - metavar='cfgfile', required=False, + metavar='cfgfile', required=False, default=[], + action='append', help="""Optional config file overlay to override run-time and build-time settings. Only entries within the "build" and "run" sections are used. Applied to all configs being - built.""") + built. Can be specified multiple times; left-most overlay + is the first overlay applied.""") cmdp.add_argument('-t', '--tasks', required=False, default=dflt_jobs(), metavar='count', type=int, diff --git a/shrinkwrap/commands/clean.py b/shrinkwrap/commands/clean.py index 8225328608b5a4fc09153610d380dc51ff25426c..6dd217212ff44532c0b96f300e3e160007e08aee 100644 --- a/shrinkwrap/commands/clean.py +++ b/shrinkwrap/commands/clean.py @@ -36,11 +36,13 @@ def add_parser(parser, formatter): config store are cleaned.""") cmdp.add_argument('-o', '--overlay', - metavar='cfgfile', required=False, + metavar='cfgfile', required=False, default=[], + action='append', help="""Optional config file overlay to override run-time and build-time settings. Only entries within the "build" and "run" sections are used. Applied to all configs being - built.""") + built. Can be specified multiple times; left-most overlay + is the first overlay applied.""") cmdp.add_argument('-t', '--tasks', required=False, default=dflt_jobs(), metavar='count', type=int, diff --git a/shrinkwrap/commands/process.py b/shrinkwrap/commands/process.py index 0f14e77060b75f1005386eba82a049ac93c545f7..58631e7bc62882cc1dba04fc38403476ead9639c 100644 --- a/shrinkwrap/commands/process.py +++ b/shrinkwrap/commands/process.py @@ -41,10 +41,12 @@ def add_parser(parser, formatter): within the build-time resolved config).""") cmdp.add_argument('-o', '--overlay', - metavar='cfgfile', required=False, + metavar='cfgfile', required=False, default=[], + action='append', help="""Optional config file overlay to override run-time and build-time settings. Only entries within the "build" and - "run" sections are used.""") + "run" sections are used. Can be specified multiple times; + left-most overlay is the first overlay applied.""") cmdp.add_argument('-r', '--rtvar', metavar='key=value', required=False, default=[], @@ -64,14 +66,15 @@ def dispatch(args): execute the subcommand, with the arguments the user passed on the command line. The arguments comply with those requested in add_parser(). """ - overlay = None - if args.overlay: - overlay = config.filename(args.overlay) + overlays = [] + for overlayname in args.overlay: + overlay = config.filename(overlayname) overlay = config.load(overlay) overlay = {'build': overlay['build'], 'run': overlay['run']} + overlays.append(overlay) filename = config.filename(args.config) - merged = config.load(filename, overlay) + merged = config.load(filename, overlays) if args.action == 'merge': print(config.dumps(merged)) diff --git a/shrinkwrap/commands/run.py b/shrinkwrap/commands/run.py index 92f4e71cf09e1dffb2d9bad16443cedba82f7357..d81307b95d04f6c1e96fa8ba492fc4c20fa831b6 100644 --- a/shrinkwrap/commands/run.py +++ b/shrinkwrap/commands/run.py @@ -35,11 +35,13 @@ def add_parser(parser, formatter): .""") cmdp.add_argument('-o', '--overlay', - metavar='cfgfile', required=False, + metavar='cfgfile', required=False, default=[], + action='append', help="""Optional config file overlay to override run-time settings. Only entries within the "run" section are used. - This is in addition to any overlay passed at - build-time.""") + This is in addition to any overlay passed at build-time. + Can be specified multiple times; left-most overlay is the + first overlay applied.""") cmdp.add_argument('-r', '--rtvar', metavar='key=value', required=False, default=[], @@ -68,14 +70,15 @@ def dispatch(args): execute the subcommand, with the arguments the user passed on the command line. The arguments comply with those requested in add_parser(). """ - overlay = None - if args.overlay: - overlay = config.filename(args.overlay) + overlays = [] + for overlayname in args.overlay: + overlay = config.filename(overlayname) overlay = config.load(overlay) overlay = {'run': overlay['run']} + overlays.append(overlay) filename = os.path.join(workspace.package, args.config) - resolveb = config.load(filename, overlay) + resolveb = config.load(filename, overlays) rtvars_dict = rtvars.parse(args.rtvar) resolver = config.resolver(resolveb, rtvars_dict) cmds = _pretty_print_sh(resolver['run']) diff --git a/shrinkwrap/utils/config.py b/shrinkwrap/utils/config.py index 6a67a8ec3e2f5ba50e03d72fb9d59c2d3c993fec..943138f1fb3eaabbff8975706b46be4485b04c74 100644 --- a/shrinkwrap/utils/config.py +++ b/shrinkwrap/utils/config.py @@ -350,7 +350,7 @@ def filename(name, rel=os.getcwd()): return fpath -def load(file_name, overlay=None, friendly=None): +def load(file_name, overlays=[], friendly=None): """ Load a config from disk and return it as a dictionary. The config is fully normalized, validated and merged. @@ -375,7 +375,7 @@ def load(file_name, overlay=None, friendly=None): config = _config_load(file_name) - if overlay: + for overlay in overlays: config = _config_merge(config, overlay) # Now that the config is fully merged, we don't need the layers @@ -622,7 +622,7 @@ def resolver(config, rtvars={}, clivars={}): return _config_sort(config) -def load_resolveb_all(names, overlayname=None, clivars={}): +def load_resolveb_all(names, overlaynames=[], clivars={}): """ Takes a list of config names and returns a corresponding list of resolved configs. If the input list is None or empty, all standard @@ -639,16 +639,17 @@ def load_resolveb_all(names, overlayname=None, clivars={}): os.path.join(root, f), p) for f in files] - overlay = None - if overlayname: + overlays = [] + for overlayname in overlaynames: overlay = filename(overlayname) overlay = load(overlay) overlay = {'build': overlay['build'], 'run': overlay['run']} + overlays.append(overlay) for name in names: try: file = filename(name) - merged = load(file, overlay, name) + merged = load(file, overlays, name) resolved = resolveb(merged, clivars) configs.append(resolved) except Exception: