Skip to contentSkip to conversation

externalsrc: fix host git >=2.38.1

PATCH Freihofer, Adrian 1 participant 2 messages Nov 29, 2022 – Dec 1, 2022 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi

As of today, Fedora 36 is considered a stable host distribution. However, without this patch externalsrc or devtool modify is unusable on Fedora 36, at least for me and one of my colleagues.
So I thought, will ask about the status of this patch.

Tnank you and regards,
Adrian

Quoted 83 lines · Adrian Freihofer via lists.openembedded.org

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]

---
 meta/classes/externalsrc.bbclass | 21 ++++++++++++---------

 1 file changed, 12 insertions(+), 9 deletions(-)
meta/classes/externalsrc.bbclass +0 -0
index 75fb91bcb0..2f2e00aab4 100644
@@ -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)

-=-=-=-=-=-=-=-=-=-=-=-
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/4454582
Group Owner: [email protected] Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub [
[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Please ignore this patch. The fix sent by Peter
https://lists.openembedded.org/g/openembedded-core/topic/95382667#174061
is better.

Quoted 103 lines · Adrian Freihofer

Hi

As of today, Fedora 36 is considered a stable host distribution. However, without this patch externalsrc or devtool modify is unusable on Fedora 36, at least for me and one of my colleagues.
So I thought, will ask about the status of this patch.

Tnank you and regards,
Adrian

Quoted 67 lines · Adrian Freihofer via lists.openembedded.org

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]

---
 meta/classes/externalsrc.bbclass | 21 ++++++++++++---------

 1 file changed, 12 insertions(+), 9 deletions(-)
meta/classes/externalsrc.bbclass +0 -0
index 75fb91bcb0..2f2e00aab4 100644
@@ -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)

Quoted 11 lines

+                            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)

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