@@ -103,34 +103,37 @@ class ConfigFragmentsPlugin(LayerPlugin):
""" Enable a fragment in the local build configuration """
def enable_helper(varname, origvalue, op, newlines):
enabled_fragments = origvalue.split()
- if args.fragmentname in enabled_fragments:
- print("Fragment {} already included in {}".format(args.fragmentname, args.confpath))
- else:
- enabled_fragments.append(args.fragmentname)
+ for f in args.fragmentname:
+ if f in enabled_fragments:
+ print("Fragment {} already included in {}".format(f, args.confpath))
+ else:
+ enabled_fragments.append(f)
return " ".join(enabled_fragments), None, 0, True
- if not self.fragment_exists(args.fragmentname):
- raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(args.fragmentname))
+ for f in args.fragmentname:
+ if not self.fragment_exists(f):
+ raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(f))
self.create_conf(args.confpath)
modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], enable_helper)
if modified:
- print("Fragment {} added to {}.".format(args.fragmentname, args.confpath))
+ print("Fragment {} added to {}.".format(", ".join(args.fragmentname), args.confpath))
def do_disable_fragment(self, args):
""" Disable a fragment in the local build configuration """
def disable_helper(varname, origvalue, op, newlines):
enabled_fragments = origvalue.split()
- if args.fragmentname in enabled_fragments:
- enabled_fragments.remove(args.fragmentname)
- else:
- print("Fragment {} not currently enabled in {}".format(args.fragmentname, args.confpath))
+ for f in args.fragmentname:
+ if f in enabled_fragments:
+ enabled_fragments.remove(f)
+ else:
+ print("Fragment {} not currently enabled in {}".format(f, args.confpath))
return " ".join(enabled_fragments), None, 0, True
self.create_conf(args.confpath)
modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], disable_helper)
if modified:
- print("Fragment {} removed from {}.".format(args.fragmentname, args.confpath))
+ print("Fragment {} removed from {}.".format(", ".join(args.fragmentname), args.confpath))
def do_disable_all_fragments(self, args):
""" Disable all fragments in the local build configuration """
@@ -151,11 +154,11 @@ class ConfigFragmentsPlugin(LayerPlugin):
parser_enable_fragment = self.add_command(sp, 'enable-fragment', self.do_enable_fragment, parserecipes=False)
parser_enable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath))
- parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)')
+ parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)', nargs='+')
parser_disable_fragment = self.add_command(sp, 'disable-fragment', self.do_disable_fragment, parserecipes=False)
parser_disable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath))
- parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment')
+ parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment', nargs='+')
parser_disable_all = self.add_command(sp, 'disable-all-fragments', self.do_disable_all_fragments, parserecipes=False)
parser_disable_all.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath))
Extends the 'enable-fragment' and 'disable-fragment' commands so that they accept multiple fragments at once as a convenience for the user Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- meta/lib/bbconfigbuild/configfragments.py | 31 +++++++++++++---------- 1 file changed, 17 insertions(+), 14 deletions(-)