summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2025-04-15 21:47:26 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-04-20 10:11:18 +0100
commitd7cb9c2dafad53b7c795c72668604791ffd869ab (patch)
tree3c2dd600bf2a54dbbd819f5562f32dd53301b3fd
parent8b037c1da15265db3a848ecdbf59b197c3951612 (diff)
downloadpoky-d7cb9c2dafad53b7c795c72668604791ffd869ab.tar.gz
buildcfg: get_metadata_git_*: catch also bb.process.NotFoundError
* bb.process.NotFoundError is triggered when e.g. oe.buildcfg.get_metadata_git_branch is called on non-existent directory (From OE-Core rev: 35f2a243c8bf828c0c29d91515ccd8a983f3b76f) Signed-off-by: Martin Jansa <martin.jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oe/buildcfg.py12
1 files 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):
17def get_metadata_git_branch(path): 17def get_metadata_git_branch(path):
18 try: 18 try:
19 rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path) 19 rev, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', cwd=path)
20 except bb.process.ExecutionError: 20 except (bb.process.ExecutionError, bb.process.NotFoundError):
21 rev = '<unknown>' 21 rev = '<unknown>'
22 return rev.strip() 22 return rev.strip()
23 23
24def get_metadata_git_revision(path): 24def get_metadata_git_revision(path):
25 try: 25 try:
26 rev, _ = bb.process.run('git rev-parse HEAD', cwd=path) 26 rev, _ = bb.process.run('git rev-parse HEAD', cwd=path)
27 except bb.process.ExecutionError: 27 except (bb.process.ExecutionError, bb.process.NotFoundError):
28 rev = '<unknown>' 28 rev = '<unknown>'
29 return rev.strip() 29 return rev.strip()
30 30
31def get_metadata_git_toplevel(path): 31def get_metadata_git_toplevel(path):
32 try: 32 try:
33 toplevel, _ = bb.process.run('git rev-parse --show-toplevel', cwd=path) 33 toplevel, _ = bb.process.run('git rev-parse --show-toplevel', cwd=path)
34 except bb.process.ExecutionError: 34 except (bb.process.ExecutionError, bb.process.NotFoundError):
35 return "" 35 return ""
36 return toplevel.strip() 36 return toplevel.strip()
37 37
@@ -39,21 +39,21 @@ def get_metadata_git_remotes(path):
39 try: 39 try:
40 remotes_list, _ = bb.process.run('git remote', cwd=path) 40 remotes_list, _ = bb.process.run('git remote', cwd=path)
41 remotes = remotes_list.split() 41 remotes = remotes_list.split()
42 except bb.process.ExecutionError: 42 except (bb.process.ExecutionError, bb.process.NotFoundError):
43 remotes = [] 43 remotes = []
44 return remotes 44 return remotes
45 45
46def get_metadata_git_remote_url(path, remote): 46def get_metadata_git_remote_url(path, remote):
47 try: 47 try:
48 uri, _ = bb.process.run('git remote get-url {remote}'.format(remote=remote), cwd=path) 48 uri, _ = bb.process.run('git remote get-url {remote}'.format(remote=remote), cwd=path)
49 except bb.process.ExecutionError: 49 except (bb.process.ExecutionError, bb.process.NotFoundError):
50 return "" 50 return ""
51 return uri.strip() 51 return uri.strip()
52 52
53def get_metadata_git_describe(path): 53def get_metadata_git_describe(path):
54 try: 54 try:
55 describe, _ = bb.process.run('git describe --tags --dirty', cwd=path) 55 describe, _ = bb.process.run('git describe --tags --dirty', cwd=path)
56 except bb.process.ExecutionError: 56 except (bb.process.ExecutionError, bb.process.NotFoundError):
57 return "" 57 return ""
58 return describe.strip() 58 return describe.strip()
59 59