All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] externalsrc: git submodule--helper list unsupported
@ 2022-10-06  8:20 Sven
  2022-10-06  8:24 ` Sven
  0 siblings, 1 reply; 4+ messages in thread
From: Sven @ 2022-10-06  8:20 UTC (permalink / raw)
  To: poky; +Cc: John Edward Broadbent, Carson Labrado, Richard Purdie

From: John Edward Broadbent <jebr@google.com>

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

(From OE-Core rev: 6d9364e5f3535954f65cbbc694ee7933ac1d664f)

Signed-off-by: Carson Labrado <clabrado@google.com>
Signed-off-by: John Edward Broadbent <jebr@google.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0533edac277080e1bd130c14df0cbac61ba01a0c)
---

Notes:
    With git 2.38.0 externalsrc does not work anymore. I hope, we can
    backport this fix to stable branches as well.

 meta/classes/externalsrc.bbclass | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 0e0a3ae89c..291fcf5653 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -225,15 +225,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)
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] externalsrc: git submodule--helper list unsupported
  2022-10-06  8:20 [PATCH] externalsrc: git submodule--helper list unsupported Sven
@ 2022-10-06  8:24 ` Sven
  2022-10-06  8:44   ` [poky] " Peter Kjellerstedt
  0 siblings, 1 reply; 4+ messages in thread
From: Sven @ 2022-10-06  8:24 UTC (permalink / raw)
  To: poky

I guess I didn't make it clear enough in the patch email: I am advocating for backporting this to dunfell and possibly other stable branches. This patch is cherry-picked from master. I wasn't sure what the procedure for backporting patches is.

Best regards,
Sven

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [poky] [PATCH] externalsrc: git submodule--helper list unsupported
  2022-10-06  8:24 ` Sven
@ 2022-10-06  8:44   ` Peter Kjellerstedt
  2022-10-06  9:25     ` Sven
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Kjellerstedt @ 2022-10-06  8:44 UTC (permalink / raw)
  To: sven, poky

> -----Original Message-----
> From: poky@lists.yoctoproject.org <poky@lists.yoctoproject.org> On Behalf
> Of Sven via lists.yoctoproject.org
> Sent: den 6 oktober 2022 10:25
> To: poky@lists.yoctoproject.org
> Subject: Re: [poky] [PATCH] externalsrc: git submodule--helper list
> unsupported
> 
> I guess I didn't make it clear enough in the patch email: I am advocating
> for backporting this to dunfell and possibly other stable branches. This
> patch is cherry-picked from master. I wasn't sure what the procedure for
> backporting patches is.
> 
> Best regards,
> Sven

Since externalsrc.bbclass is part of OE-Core, the patch should be sent to 
the openembedded-core@lists.openembedded.org mailing list. Also, if you 
send a patch for an older release, then be sure to include the name of 
the release, e.g., "[dunfell]", in the subject.

//Peter


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] externalsrc: git submodule--helper list unsupported
  2022-10-06  8:44   ` [poky] " Peter Kjellerstedt
@ 2022-10-06  9:25     ` Sven
  0 siblings, 0 replies; 4+ messages in thread
From: Sven @ 2022-10-06  9:25 UTC (permalink / raw)
  To: poky

Thanks, I'll give that a shot. This patch may be ignored.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-06  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-06  8:20 [PATCH] externalsrc: git submodule--helper list unsupported Sven
2022-10-06  8:24 ` Sven
2022-10-06  8:44   ` [poky] " Peter Kjellerstedt
2022-10-06  9:25     ` Sven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.