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-18 11:37:25 +0100 |
| commit | a7c950d7b5afd53eea8eb7e9f1b2ce3723213712 (patch) | |
| tree | 37ed343b985543620af3a89784133c093cf42770 /meta/classes/externalsrc.bbclass | |
| parent | 52c1cb2a9d02981db1dddce799c0b542fe9f44ac (diff) | |
| download | poky-a7c950d7b5afd53eea8eb7e9f1b2ce3723213712.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: 1c18225d3ef94a41fc073ae87c163b68e6d46571)
Signed-off-by: Douglas Royds <douglas.royds@taitradio.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) |
