1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-10 16:10:04 +00:00

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>
This commit is contained in:
Antonin Godard
2025-09-05 14:23:57 +02:00
committed by Richard Purdie
parent fa529b2498
commit 3b1a9693b6
+15
View File
@@ -156,6 +156,18 @@ class ConfigFragmentsPlugin(LayerPlugin):
if modified:
print("Fragment {} removed from {}.".format(", ".join(args.fragmentname), args.confpath))
def do_show_fragment(self, args):
""" Show the content of a fragment """
for layername, layerdata in self.discover_fragments().items():
fragments = layerdata['fragments']
for fragment in fragments:
if fragment['name'] == args.fragmentname:
print(f"{fragment['path']}:")
print()
with open(fragment['path']) as fd:
print(fd.read())
return
def do_disable_all_fragments(self, args):
""" Disable all fragments in the local build configuration """
def disable_all_helper(varname, origvalue, op, newlines):
@@ -181,5 +193,8 @@ class ConfigFragmentsPlugin(LayerPlugin):
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', nargs='+')
parser_show_fragment = self.add_command(sp, 'show-fragment', self.do_show_fragment, parserecipes=False)
parser_show_fragment.add_argument('fragmentname', help='The name of the fragment')
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))