Use bb.fatal() and bb.warn() to report errors and warnings. This makes for a nicer experience for the user, and allows the warnings to be silenced using the --quiet option.
Signed-off-by: Peter Kjellerstedt <[email protected]> --- meta/lib/bbconfigbuild/configfragments.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/meta/lib/bbconfigbuild/configfragments.py b/meta/lib/bbconfigbuild/configfragments.py index 15142ec9f9..8365a15a32 100644 --- a/meta/lib/bbconfigbuild/configfragments.py +++ b/meta/lib/bbconfigbuild/configfragments.py @@ -28,10 +28,10 @@ class ConfigFragmentsPlugin(LayerPlugin): summary = d.getVar('BB_CONF_FRAGMENT_SUMMARY') description = d.getVar('BB_CONF_FRAGMENT_DESCRIPTION') if not summary: - raise Exception('Please add a one-line summary as BB_CONF_FRAGMENT_SUMMARY = \"...\" variable at the beginning of {}'.format(path)) + bb.fatal('Please add a one-line summary as BB_CONF_FRAGMENT_SUMMARY = "..." variable at the beginning of {}'.format(path)) if not description: - raise Exception('Please add a description as BB_CONF_FRAGMENT_DESCRIPTION = \"...\" variable at the beginning of {}'.format(path)) + bb.fatal('Please add a description as BB_CONF_FRAGMENT_DESCRIPTION = "..." variable at the beginning of {}'.format(path)) return summary, description @@ -131,7 +131,7 @@ class ConfigFragmentsPlugin(LayerPlugin): enabled_fragments = origvalue.split() for f in args.fragmentname: if f in enabled_fragments: - print("Fragment {} already included in {}".format(f, args.confpath)) + bb.warn("Fragment {} already included in {}".format(f, args.confpath)) else: # first filter out all built-in fragments with the same prefix as the one that is being enabled enabled_fragments = [fragment for fragment in enabled_fragments if not(self.builtin_fragment_exists(fragment) and self.fragment_prefix(fragment) == self.fragment_prefix(f))] @@ -141,7 +141,7 @@ class ConfigFragmentsPlugin(LayerPlugin): fragments = self.discover_fragments() for f in args.fragmentname: if not self.get_fragment(f, fragments) and not self.builtin_fragment_exists(f): - raise Exception("Fragment {} does not exist; use 'list-fragments' to see the full list.".format(f)) + bb.fatal("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) @@ -160,7 +160,7 @@ class ConfigFragmentsPlugin(LayerPlugin): if f in enabled_fragments: enabled_fragments.remove(f) else: - print("Fragment {} not currently enabled in {}".format(f, args.confpath)) + bb.warn("Fragment {} not currently enabled in {}".format(f, args.confpath)) return " ".join(enabled_fragments), None, 0, True self.create_conf(args.confpath)
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#226644): https://lists.openembedded.org/g/openembedded-core/message/226644 Mute This Topic: https://lists.openembedded.org/mt/116400971/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
