]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
buildcfg: get_metadata_git_*: catch also bb.process.NotFoundError
authorMartin Jansa <martin.jansa@gmail.com>
Tue, 15 Apr 2025 19:47:26 +0000 (21:47 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 24 Apr 2025 10:25:00 +0000 (11:25 +0100)
* 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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/buildcfg.py

index 4b22f18f3659dce8cb6f4af0b67ed37481029397..85b903fab05fdbc0dc37edc3840e7824d49c4e62 100644 (file)
@@ -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()