diff mbox series

[3/6] bbconfigbuild/configfragments.py: print fragment descriptions when enabling them

Message ID 20251029120835.4075555-3-alex.kanavin@gmail.com
State New
Headers show
Series [1/6] bbconfigbuild/configfragments.py: run discover_fragments() only once when enabling them | expand

Commit Message

Alexander Kanavin Oct. 29, 2025, 12:08 p.m. UTC
From: Alexander Kanavin <alex@linutronix.de>

Such descriptions can contain useful or important information, and users may
not see that otherwise at all. To reduce clutter in CI outputs or similar
scenarios, -q option suppresses that printing.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/lib/bbconfigbuild/configfragments.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py
index 59e760f2909..6fdac33a5da 100644
--- a/meta/lib/bbconfigbuild/configfragments.py
+++ b/meta/lib/bbconfigbuild/configfragments.py
@@ -144,7 +144,11 @@  class ConfigFragmentsPlugin(LayerPlugin):
         self.create_conf(args.confpath)
         modified = bb.utils.edit_metadata_file(args.confpath, ["OE_FRAGMENTS"], enable_helper)
         if modified:
-            print("Fragment {} added to {}.".format(", ".join(args.fragmentname), args.confpath))
+            for f in args.fragmentname:
+                print("Fragment {} added to {}.".format(f, args.confpath))
+                f_info = self.get_fragment(f, fragments)
+                if f_info and not args.quiet:
+                    print('\nFragment summary: {}\n\nFragment description:\n{}\n'.format(f_info['summary'],f_info['description']))
 
     def do_disable_fragment(self, args):
         """ Disable a fragment in the local build configuration """
@@ -193,6 +197,7 @@  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_list_fragments.add_argument('--quiet', '-q', action='store_true', help='Do not print descriptions of the newly enabled fragments')
         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)