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-23 10:41:21 +0100 |
commit | 94a83886ed5329b508794a625509e1798cd00612 (patch) | |
tree | 2f47af5104d018ca0ff9134547b1abb416d7142d | |
parent | e302900997c826615344fb726b316055e16232c6 (diff) | |
download | poky-94a83886ed5329b508794a625509e1798cd00612.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: 8e6d103e17debc93e0627b96c2910aadd14aab7f)
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>
-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) |