Skip to contentSkip to conversation

externalsrc:git submodule--helper list unsupported

PATCH In review [email protected] 2 participants 3 messages Sep 15, 2022 – Sep 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 externalsrc:git submodule--helper list unsupported

From: John Edward Broadbent <[email protected]>

Git has removed support for "git submodule--helper list".
https://github.com/git/git/commit/31955475d1c283120d5d84247eb3fd55d9f5fdd9

This change provides an alternate method for gathering the submodules information.

Tested:
Build recipes with and without submodules

---
 meta/classes-recipe/externalsrc.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
meta/classes-recipe/externalsrc.bbclass +10 -9
index ce753fce76..06a9548a20 100644
@@ -230,15 +230,16 @@ def srctree_hash_files(d, srcdir=None):
             env['GIT_INDEX_FILE'] = tmp_index.name
             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")
-            submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], 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")
+            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")
             sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
         with open(oe_hash_file, 'w') as fobj:
             fobj.write(sha1)
Signature · 1 line
2.37.3.968.ga6b4b080e4-goog
#1 lore raw

Hi John,

Quoted 8 lines · John Broadbent via lists.yoctoproject.org

From: John Edward Broadbent <[email protected]>

Git has removed support for "git submodule--helper list".
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_git_git_commit_31955475d1c283120d5d84247eb3fd55d9f5fdd9&d=DwIBaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=dPWGp0K5l_YXiJ9CQ0xgD9h8jzFwJf2ZGppZSv2ZZUvg_DVFfKt3g2SwAJdk6ATE&s=rTfHjnsYf5vusiYA_lI3L24FBLE9jU_hmbGFPELpuAg&e=

This change provides an alternate method for gathering the submodules information.

Quoted 7 lines

Tested:
Build recipes with and without submodules

---
  meta/classes-recipe/externalsrc.bbclass | 19 ++++++++++---------

meta layer is part of openembedded-core, so please re-send to the correct mailing list following the docs here https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Quoted 19 lines
  1 file changed, 10 insertions(+), 9 deletions(-)
meta/classes-recipe/externalsrc.bbclass +0 -9
index ce753fce76..06a9548a20 100644
@@ -230,15 +230,16 @@ def srctree_hash_files(d, srcdir=None):
              env['GIT_INDEX_FILE'] = tmp_index.name
              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")
-            submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], 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")

meta/classes-recipe/externalsrc.bbclass def srctree_hash_files(d, srcdir=None): · line 242

Quoted 10 lines
meta/classes-recipe/externalsrc.bbclass +10 -0
+            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")

Are those git commands supported in 1.8.3.1 version of git? I'm asking because this is the minimal version of git we currently advertise as supported. If it is not, then we need to bump this requirement in the docs and check that all currently supported distributions have this new minimal version in their package feed or remove them from the list (which will also impact whether dunfell and kirkstone can receive this patch).

Cheers,
Quentin

#2 lore raw
Quoted 62 lines · Quentin Schulz

Hi John,

Quoted 8 lines · John Broadbent via lists.yoctoproject.org

From: John Edward Broadbent <[email protected]>

Git has removed support for "git submodule--helper list".
https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_git_git_commit_31955475d1c283120d5d84247eb3fd55d9f5fdd9&d=DwIBaQ&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=dPWGp0K5l_YXiJ9CQ0xgD9h8jzFwJf2ZGppZSv2ZZUvg_DVFfKt3g2SwAJdk6ATE&s=rTfHjnsYf5vusiYA_lI3L24FBLE9jU_hmbGFPELpuAg&e=

This change provides an alternate method for gathering the submodules information.

Quoted 7 lines

Tested:
Build recipes with and without submodules

---
  meta/classes-recipe/externalsrc.bbclass | 19 ++++++++++---------

meta layer is part of openembedded-core, so please re-send to the correct mailing list following the docs here
https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

Quoted 19 lines
  1 file changed, 10 insertions(+), 9 deletions(-)
meta/classes-recipe/externalsrc.bbclass +0 -9
index ce753fce76..06a9548a20 100644
@@ -230,15 +230,16 @@ def srctree_hash_files(d, srcdir=None):
              env['GIT_INDEX_FILE'] = tmp_index.name
              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")
-            submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], 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")

meta/classes-recipe/externalsrc.bbclass def srctree_hash_files(d, srcdir=None): · line 242

Quoted 10 lines
meta/classes-recipe/externalsrc.bbclass +10 -0
+            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")

Are those git commands supported in 1.8.3.1 version of git? I'm asking because this is the minimal version of git we currently advertise as supported. If it is not, then we need to bump this requirement in the docs and check that all currently supported distributions have this new minimal version in their package feed or remove them from the list (which will also impact whether dunfell and kirkstone can receive this patch).

Quoted 2 lines

Cheers,
Quentin

Thanks for looking over this change.

Quoted 1 line

Are those git commands supported in 1.8.3.1 version of git?

They appear to be:
config is defined here
https://github.com/git/git/blob/362de916c06521205276acb7f51c99f47db94727/git.c#L331
and get-regexp is also defined here
https://github.com/git/git/blob/36f8e7ed7d72d2ac73743c3c2226cceb29b32156/builtin/config.c#L789

I was not able to build and test the behavior of 1.8.3.1, without changing my openssl headers.

Thanks

Quoted 1 line

which will also impact whether dunfell and kirkstone can receive this patch