On Wed, 2024-10-02 at 03:32 +0000, Duane Ellis via lists.yoctoproject.org wrote:
> It’s been reported before:
>  
>      
> https://lists.yoctoproject.org/g/yocto/topic/warning_image_fstypes_remove/103013050
>  
> The gripe I have is this:
>  
> It occurs – but bitbake does *NOT* tell or give you a hint to *WHICH * 
> bitbake file is causing this.
> Error and warning messages like this should include the recipe name or 
> directory or something that
>  
> This simple change would be very helpful to victims of this madness
>  
> diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
> index 9e0a0f5c98..8e700b1043 100644
> --- a/bitbake/lib/bb/parse/ast.py
> +++ b/bitbake/lib/bb/parse/ast.py
> @@ -132,7 +132,7 @@ class DataNode(AstNode):
>          if ":append" in key or ":remove" in key or ":prepend" in key:
>              if op in ["append", "prepend", "postdot", "predot", "ques"]:
> -                bb.warn(key + " " + groupd[op] + " is not a recommended 
> operator combination, please replace it.")
> +                bb.warn(self.filename + ":%d: " % self.lineno + key + " " + 
> groupd[op] + " is not a recommended operator combination, please replace it.")
>          flag = None
>          if 'flag' in groupd and groupd['flag'] is not None:

I don't know why I didn't do that in the patch which added this code.

Changing the warning to include the filename/lineno seems like a good
idea and such a patch would probably get merged.

>  BETTER – change the bb.warn() to *NOT* print WARNING: at the start of the 
> line. But *AFTER* the ‘%d:’
>  
> Reason:  
>  
> BB does not use the well-known standard error reporting format used
> by just about every UNIX tool out there.
> Examples include: GCC, GREP (with the -n option) to name a few well-
> known examples.
>  
> Why? Many tools, Eclipse (error parser), VSCODE, Emacs and VIM can
> parse the tool output in this form and turn the item into a clickable
> error in your IDE or EDITOR of your choice. But if the tool does not
> output this format it makes it harder to resolve errors

This is a bit harder as bitbake can mix debug, normal output and
warnings onto its console output. A prefix is used at the start of
lines to make it much clearer in streams of logs where there are such
messages.

When running in larger builds, the messages can also be prefixed with
the name of the recipe generating the message as in a multi-task
environment, it has been found to be problematic not to know where the
message was coming from.

Given those reasons, I'm not sure we can easily change this. I do agree
line/file info is sensible though.

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63925): https://lists.yoctoproject.org/g/yocto/message/63925
Mute This Topic: https://lists.yoctoproject.org/mt/108773605/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to