diff options
Diffstat (limited to 'meta/lib/bbconfigbuild/configfragments.py')
| -rw-r--r-- | meta/lib/bbconfigbuild/configfragments.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py index 21baedc9a4..6fdac33a5d 100644 --- a/meta/lib/bbconfigbuild/configfragments.py +++ b/meta/lib/bbconfigbuild/configfragments.py | |||
| @@ -97,12 +97,12 @@ class ConfigFragmentsPlugin(LayerPlugin): | |||
| 97 | print_fragment(f, args.verbose, is_enabled=False) | 97 | print_fragment(f, args.verbose, is_enabled=False) |
| 98 | print('') | 98 | print('') |
| 99 | 99 | ||
| 100 | def fragment_exists(self, fragmentname): | 100 | def get_fragment(self, fragmentname, fragments): |
| 101 | for layername, layerdata in self.discover_fragments().items(): | 101 | for layername, layerdata in fragments.items(): |
| 102 | for f in layerdata['fragments']: | 102 | for f in layerdata['fragments']: |
| 103 | if f['name'] == fragmentname: | 103 | if f['name'] == fragmentname: |
| 104 | return True | 104 | return f |
| 105 | return False | 105 | return None |
| 106 | 106 | ||
| 107 | def fragment_prefix(self, fragmentname): | 107 | def fragment_prefix(self, fragmentname): |
| 108 | return fragmentname.split("/",1)[0] | 108 | return fragmentname.split("/",1)[0] |
| @@ -136,14 +136,19 @@ class ConfigFragmentsPlugin(LayerPlugin): | |||
| 136 | enabled_fragments.append(f) | 136 | enabled_fragments.append(f) |
| 137 | return " ".join(enabled_fragments), None, 0, True | 137 | return " ".join(enabled_fragments), None, 0, True |
| 138 | 138 | ||
| 139 | fragments = self.discover_fragments() | ||
| 139 | for f in args.fragmentname: | 140 | for f in args.fragmentname: |
| 140 | if not self.fragment_exists(f) and not self.builtin_fragment_exists(f): | 141 | if not self.get_fragment(f, fragments) and not self.builtin_fragment_exists(f): |
| 141 | raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(f)) | 142 | raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(f)) |
| 142 | 143 | ||
| 143 | self.create_conf(args.confpath) | 144 | self.create_conf(args.confpath) |
| 144 | modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], enable_helper) | 145 | modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], enable_helper) |
| 145 | if modified: | 146 | if modified: |
| 146 | print("Fragment {} added to {}.".format(", ".join(args.fragmentname), args.confpath)) | 147 | for f in args.fragmentname: |
| 148 | print("Fragment {} added to {}.".format(f, args.confpath)) | ||
| 149 | f_info = self.get_fragment(f, fragments) | ||
| 150 | if f_info and not args.quiet: | ||
| 151 | print('\nFragment summary: {}\n\nFragment description:\n{}\n'.format(f_info['summary'],f_info['description'])) | ||
| 147 | 152 | ||
| 148 | def do_disable_fragment(self, args): | 153 | def do_disable_fragment(self, args): |
| 149 | """ Disable a fragment in the local build configuration """ | 154 | """ Disable a fragment in the local build configuration """ |
| @@ -192,6 +197,7 @@ class ConfigFragmentsPlugin(LayerPlugin): | |||
| 192 | 197 | ||
| 193 | parser_enable_fragment = self.add_command(sp, 'enable-fragment', self.do_enable_fragment, parserecipes=False) | 198 | parser_enable_fragment = self.add_command(sp, 'enable-fragment', self.do_enable_fragment, parserecipes=False) |
| 194 | parser_enable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) | 199 | parser_enable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) |
| 200 | parser_list_fragments.add_argument('--quiet', '-q', action='store_true', help='Do not print descriptions of the newly enabled fragments') | ||
| 195 | parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)', nargs='+') | 201 | parser_enable_fragment.add_argument('fragmentname', help='The name of the fragment (use list-fragments to see them)', nargs='+') |
| 196 | 202 | ||
| 197 | parser_disable_fragment = self.add_command(sp, 'disable-fragment', self.do_disable_fragment, parserecipes=False) | 203 | parser_disable_fragment = self.add_command(sp, 'disable-fragment', self.do_disable_fragment, parserecipes=False) |
