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:37 +0100 |
commit | ff15dd023efb9ae955b1625971cd7cb6616f564c (patch) | |
tree | 1e995bd5fc903b76de31bd4e3b8895630e0ca53c /meta/classes | |
parent | 229db6be9d4069d2dca7cd42c2a3c5a9689764fb (diff) | |
download | poky-ff15dd023efb9ae955b1625971cd7cb6616f564c.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: d621b7c0ce0a99035de7e503596a3e36dc44b76f)
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: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 1d7300d65b..c7fcdca6ef 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -219,11 +219,12 @@ def srctree_hash_files(d, srcdir=None): | |||
219 | submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") | 219 | submodule_helper = subprocess.check_output(['git', 'submodule--helper', 'list'], cwd=s_dir, env=env).decode("utf-8") |
220 | for line in submodule_helper.splitlines(): | 220 | for line in submodule_helper.splitlines(): |
221 | module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) | 221 | module_dir = os.path.join(s_dir, line.rsplit(maxsplit=1)[1]) |
222 | proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | 222 | if os.path.isdir(module_dir): |
223 | proc.communicate() | 223 | proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) |
224 | proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) | 224 | proc.communicate() |
225 | stdout, _ = proc.communicate() | 225 | proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) |
226 | git_sha1 += stdout.decode("utf-8") | 226 | stdout, _ = proc.communicate() |
227 | git_sha1 += stdout.decode("utf-8") | ||
227 | sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() | 228 | sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() |
228 | with open(oe_hash_file, 'w') as fobj: | 229 | with open(oe_hash_file, 'w') as fobj: |
229 | fobj.write(sha1) | 230 | fobj.write(sha1) |