public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: martin.jansa@gmail.com
To: openembedded-core@lists.openembedded.org
Cc: Martin Jansa <martin.jansa@gmail.com>
Subject: [PATCH] buildcfg: get_metadata_git_*: catch also bb.process.NotFoundError
Date: Tue, 15 Apr 2025 21:47:26 +0200	[thread overview]
Message-ID: <20250415194727.157145-1-martin.jansa@gmail.com> (raw)

From: Martin Jansa <martin.jansa@gmail.com>

* bb.process.NotFoundError is triggered when e.g. oe.buildcfg.get_metadata_git_branch
  is called on non-existent directory

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
 meta/lib/oe/buildcfg.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/meta/lib/oe/buildcfg.py b/meta/lib/oe/buildcfg.py
index 4b22f18f36..85b903fab0 100644
--- a/meta/lib/oe/buildcfg.py
+++ b/meta/lib/oe/buildcfg.py
@@ -17,21 +17,21 @@ def get_scmbasepath(d):
 def get_metadata_git_branch(path):
     try:
         rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         rev = '<unknown>'
     return rev.strip()
 
 def get_metadata_git_revision(path):
     try:
         rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         rev = '<unknown>'
     return rev.strip()
 
 def get_metadata_git_toplevel(path):
     try:
         toplevel, _ = bb.process.run('git rev-parse --show-toplevel', cwd=path)
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         return ""
     return toplevel.strip()
 
@@ -39,21 +39,21 @@ def get_metadata_git_remotes(path):
     try:
         remotes_list, _ = bb.process.run('git remote', cwd=path)
         remotes = remotes_list.split()
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         remotes = []
     return remotes
 
 def get_metadata_git_remote_url(path, remote):
     try:
         uri, _ = bb.process.run('git remote get-url {remote}'.format(remote=remote), cwd=path)
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         return ""
     return uri.strip()
 
 def get_metadata_git_describe(path):
     try:
         describe, _ = bb.process.run('git describe --tags --dirty', cwd=path)
-    except bb.process.ExecutionError:
+    except (bb.process.ExecutionError, bb.process.NotFoundError):
         return ""
     return describe.strip()
 


                 reply	other threads:[~2025-04-15 19:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250415194727.157145-1-martin.jansa@gmail.com \
    --to=martin.jansa@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox