diff options
| author | Antonin Godard <antonin.godard@bootlin.com> | 2025-09-05 14:23:57 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-08 18:02:40 +0100 |
| commit | 3b1a9693b632a8340958727a8e6dc1677c9b69c8 (patch) | |
| tree | 0b954ff96da0e1022f47a4f8da3391b8fbf6509f | |
| parent | fa529b2498dec455c9dbe7aa63b624e29a52bbdf (diff) | |
| download | poky-3b1a9693b632a8340958727a8e6dc1677c9b69c8.tar.gz | |
lib/configfragments: add a show-fragments command
We can print information on fragments (name, location, description,
etc.), but not their content.
Add a show-fragment command to do that. It can be used as follows:
$ bitbake-config-build show-fragment core/yocto/sstate-mirror-cdn
And prints:
.../meta/conf/fragments/yocto/sstate-mirror-cdn.conf:
BB_CONF_FRAGMENT_SUMMARY = "Use prebuilt sstate artifacts for standard Yocto build configurations."
BB_CONF_FRAGMENT_DESCRIPTION = "The Yocto Project has prebuilt artefacts available for standard build configurations. \
...
(From OE-Core rev: 71cd1ae6a8367f2135855a2904e8b8d4967efd99)
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/lib/bbconfigbuild/configfragments.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py index 61c33ac316..fce3301bac 100644 --- a/meta/lib/bbconfigbuild/configfragments.py +++ b/meta/lib/bbconfigbuild/configfragments.py | |||
| @@ -156,6 +156,18 @@ class ConfigFragmentsPlugin(LayerPlugin): | |||
| 156 | if modified: | 156 | if modified: |
| 157 | print("Fragment {} removed from {}.".format(", ".join(args.fragmentname), args.confpath)) | 157 | print("Fragment {} removed from {}.".format(", ".join(args.fragmentname), args.confpath)) |
| 158 | 158 | ||
| 159 | def do_show_fragment(self, args): | ||
| 160 | """ Show the content of a fragment """ | ||
| 161 | for layername, layerdata in self.discover_fragments().items(): | ||
| 162 | fragments = layerdata['fragments'] | ||
| 163 | for fragment in fragments: | ||
| 164 | if fragment['name'] == args.fragmentname: | ||
| 165 | print(f"{fragment['path']}:") | ||
| 166 | print() | ||
| 167 | with open(fragment['path']) as fd: | ||
| 168 | print(fd.read()) | ||
| 169 | return | ||
| 170 | |||
| 159 | def do_disable_all_fragments(self, args): | 171 | def do_disable_all_fragments(self, args): |
| 160 | """ Disable all fragments in the local build configuration """ | 172 | """ Disable all fragments in the local build configuration """ |
| 161 | def disable_all_helper(varname, origvalue, op, newlines): | 173 | def disable_all_helper(varname, origvalue, op, newlines): |
| @@ -181,5 +193,8 @@ class ConfigFragmentsPlugin(LayerPlugin): | |||
| 181 | parser_disable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) | 193 | parser_disable_fragment.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) |
| 182 | parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment', nargs='+') | 194 | parser_disable_fragment.add_argument('fragmentname', help='The name of the fragment', nargs='+') |
| 183 | 195 | ||
| 196 | parser_show_fragment = self.add_command(sp, 'show-fragment', self.do_show_fragment, parserecipes=False) | ||
| 197 | parser_show_fragment.add_argument('fragmentname', help='The name of the fragment') | ||
| 198 | |||
| 184 | parser_disable_all = self.add_command(sp, 'disable-all-fragments', self.do_disable_all_fragments, parserecipes=False) | 199 | parser_disable_all = self.add_command(sp, 'disable-all-fragments', self.do_disable_all_fragments, parserecipes=False) |
| 185 | parser_disable_all.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) | 200 | parser_disable_all.add_argument("--confpath", default=default_confpath, help='Configuration file which contains a list of enabled fragments (default is {}).'.format(default_confpath)) |
