This is a fix for 0533edac277080e1bd130c14df0cbac61ba01a0c.

If the externalsrc directory is a git repository without submodules
  git config --file .gitmodules --get-regexp path
exits with 1. This leads to a subprocess.CalledProcessError exception:

bb.data_smart.ExpansionError: Failure expanding variable 
do_compile[file-checksums],
  expression was ${@srctree_hash_files(d)} which triggered exception
  CalledProcessError: Command '['git', 'config', '--file', '.gitmodules',
  '--get-regexp', 'path']' returned non-zero exit status 1.
The variable dependency chain for the failure is: do_compile[file-checksums]

Signed-off-by: Adrian Freihofer <[email protected]>
---
 meta/classes/externalsrc.bbclass | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 75fb91bcb0..2f2e00aab4 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -231,15 +231,18 @@ def srctree_hash_files(d, srcdir=None):
             subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, 
env=env)
             git_sha1 = subprocess.check_output(['git', 'write-tree'], 
cwd=s_dir, env=env).decode("utf-8")
             if os.path.exists(".gitmodules"):
-                submodule_helper = subprocess.check_output(["git", "config", 
"--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, 
env=env).decode("utf-8")
-                for line in submodule_helper.splitlines():
-                    module_dir = os.path.join(s_dir, 
line.rsplit(maxsplit=1)[1])
-                    if os.path.isdir(module_dir):
-                        proc = subprocess.Popen(['git', 'add', '-A', '.'], 
cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-                        proc.communicate()
-                        proc = subprocess.Popen(['git', 'write-tree'], 
cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
-                        stdout, _ = proc.communicate()
-                        git_sha1 += stdout.decode("utf-8")
+                try:
+                    submodule_helper = subprocess.check_output(["git", 
"config", "--file", ".gitmodules", "--get-regexp", "path"], cwd=s_dir, 
env=env).decode("utf-8")
+                    for line in submodule_helper.splitlines():
+                        module_dir = os.path.join(s_dir, 
line.rsplit(maxsplit=1)[1])
+                        if os.path.isdir(module_dir):
+                            proc = subprocess.Popen(['git', 'add', '-A', '.'], 
cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+                            proc.communicate()
+                            proc = subprocess.Popen(['git', 'write-tree'], 
cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
+                            stdout, _ = proc.communicate()
+                            git_sha1 += stdout.decode("utf-8")
+                except subprocess.CalledProcessError:
+                    pass
             sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
         with open(oe_hash_file, 'w') as fobj:
             fobj.write(sha1)
-- 
2.38.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173449): 
https://lists.openembedded.org/g/openembedded-core/message/173449
Mute This Topic: https://lists.openembedded.org/mt/95100113/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to