diff options
author | Douglas Royds <douglas.royds@taitradio.com> | 2021-04-08 13:08:55 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-04-30 14:37:25 +0100 |
commit | c20e75d07dd93289e649b9cce656e3c99712fdde (patch) | |
tree | 77861b9e387a297853a46866024658d7e55021d2 /meta/classes/externalsrc.bbclass | |
parent | 6708092ea4b0b73bb706f5d735d77ea7a8aa1093 (diff) | |
download | poky-c20e75d07dd93289e649b9cce656e3c99712fdde.tar.gz |
externalsrc: Detect code changes in submodules
Further to 50ff9afb39, only detect code changes in submodules that are
subdirectories of the EXTERNALSRC directory.
The (undocumented) git submodule--helper returns a path
for each submodule relative to the top of the repo.
Don't add submodules that are not within our source subtree.
[YOCTO #14333]
(From OE-Core rev: d233735891872b73e66cb3ce9f73b9af4d32a186)
Signed-off-by: Douglas Royds <douglas.royds@taitradio.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 1c18225d3ef94a41fc073ae87c163b68e6d46571)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index c7b2bf2f49..3d6b80bee2 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -220,11 +220,12 @@ def srctree_hash_files(d, srcdir=None): | |||
220 | submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") | 220 | submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") |
221 | for line in submodule_helper.splitlines(): | 221 | for line in submodule_helper.splitlines(): |
222 | module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) | 222 | module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) |
223 | proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | 223 | if os.path.isdir(module_dir): |
224 | proc.communicate() | 224 | proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
225 | proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) | 225 | proc.communicate() |
226 | stdout, _ = proc.communicate() | 226 | proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) |
227 | git_sha1 += stdout.decode("utf-8") | 227 | stdout, _ = proc.communicate() |
228 | git_sha1 += stdout.decode("utf-8") | ||
228 | sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() | 229 | sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() |
229 | with open(oe_hash_file, 'w') as fobj: | 230 | with open(oe_hash_file, 'w') as fobj: |
230 | fobj.write(sha1) | 231 | fobj.write(sha1) |