diff mbox series

[auh,V2,06/12] modules/utils/git.py: include repo_dir information in the raised exception

Message ID 20260311064813.619683-6-Qi.Chen@windriver.com
State New
Headers show
Series [auh,V2,01/12] upgrade-helper.py: remove unused self.poky_git settings | expand

Commit Message

Chen, Qi March 11, 2026, 6:48 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

This help people know where the git command is actually executed.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 modules/utils/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Kanavin March 11, 2026, 7:10 p.m. UTC | #1
On Wed, 11 Mar 2026 at 07:48, <Qi.Chen@windriver.com> wrote:
>              stdout, stderr = bb.process.run(cmd)
>          except bb.process.ExecutionError as e:
>              W("%s executed from %s returned:\n%s" % (cmd, self.repo_dir, e.__str__()))
> -            raise Error("The following git command failed: " + operation,
> +            raise Error("The following git command failed in %s: %s" % (self.repo_dir, operation),
>                          e.stdout, e.stderr)

Hello Chen,

can you combine patch 4 and 6 (this one) into a single patch that
removes the debug/warning print, and just puts all relevant
information into the exception?

The reason is that:
- auh works in such a way that having git fail is sometimes okay, and
the caller will handle the exception (e.g. see the 'nothing to commit'
handling in upgrade-helper.py)
- if git does fail, we don't want to flood the console with warnings
when it is not a real failure. Rather just handle the exception, or if
there's no handler, then it will be raised and print everything
relevant.

Alex
Chen, Qi March 12, 2026, 3:44 a.m. UTC | #2
Hi Alex,

Thanks for your review. I'll fix this and send out V3.

Regards,
Qi

-----Original Message-----
From: Alexander Kanavin <alex.kanavin@gmail.com> 
Sent: Thursday, March 12, 2026 3:10 AM
To: Chen, Qi <Qi.Chen@windriver.com>
Cc: yocto-patches@lists.yoctoproject.org; MacLeod, Randy <Randy.MacLeod@windriver.com>
Subject: Re: [auh][PATCH V2 06/12] modules/utils/git.py: include repo_dir information in the raised exception

On Wed, 11 Mar 2026 at 07:48, <Qi.Chen@windriver.com> wrote:
>              stdout, stderr = bb.process.run(cmd)
>          except bb.process.ExecutionError as e:
>              W("%s executed from %s returned:\n%s" % (cmd, self.repo_dir, e.__str__()))
> -            raise Error("The following git command failed: " + operation,
> +            raise Error("The following git command failed in %s: %s" 
> + % (self.repo_dir, operation),
>                          e.stdout, e.stderr)

Hello Chen,

can you combine patch 4 and 6 (this one) into a single patch that removes the debug/warning print, and just puts all relevant information into the exception?

The reason is that:
- auh works in such a way that having git fail is sometimes okay, and the caller will handle the exception (e.g. see the 'nothing to commit'
handling in upgrade-helper.py)
- if git does fail, we don't want to flood the console with warnings when it is not a real failure. Rather just handle the exception, or if there's no handler, then it will be raised and print everything relevant.

Alex
diff mbox series

Patch

diff --git a/modules/utils/git.py b/modules/utils/git.py
index b504ab0..38c6a72 100644
--- a/modules/utils/git.py
+++ b/modules/utils/git.py
@@ -41,7 +41,7 @@  class Git(object):
             stdout, stderr = bb.process.run(cmd)
         except bb.process.ExecutionError as e:
             W("%s executed from %s returned:\n%s" % (cmd, self.repo_dir, e.__str__()))
-            raise Error("The following git command failed: " + operation,
+            raise Error("The following git command failed in %s: %s" % (self.repo_dir, operation),
                         e.stdout, e.stderr)
 
         return stdout