summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
authorDouglas Royds <douglas.royds@taitradio.com>2021-03-18 12:37:55 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-28 22:31:47 +0100
commit97d92eb0e87b0cca026335b8ae74f1c1dc469d8b (patch)
tree7620d02f69fb90a3407961668991d2864e91a54c /meta/classes/externalsrc.bbclass
parentc553ad2073bae4c7d72a98cd17e70c1d0c59267e (diff)
downloadpoky-97d92eb0e87b0cca026335b8ae74f1c1dc469d8b.tar.gz
externalsrc: Detect code changes in submodules
Further to 50ff9afb39, only detect code changes in submodules that are subdirectories of the EXTERNALSRC directory. git submodule status returns a path relative to the cwd for each submodule. We don't add submodules that are not within our source subtree. (From OE-Core rev: d1f6fd5817e43e5f002a9430563d6d1b69d77317) Signed-off-by: Douglas Royds <douglas.royds@taitradio.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 4525310d49d115a37705f04ac5c03d639e5e8f8c) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass16
1 files changed, 9 insertions, 7 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 1d7300d65b..d1ca11303d 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -216,14 +216,16 @@ def srctree_hash_files(d, srcdir=None):
216 env['GIT_INDEX_FILE'] = tmp_index.name 216 env['GIT_INDEX_FILE'] = tmp_index.name
217 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env) 217 subprocess.check_output(['git', 'add', '-A', '.'], cwd=s_dir, env=env)
218 git_sha1 = subprocess.check_output(['git', 'write-tree'], cwd=s_dir, env=env).decode("utf-8") 218 git_sha1 = subprocess.check_output(['git', 'write-tree'], 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") 219 submodule_helper = subprocess.check_output(['git', 'submodule', 'status'], 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_relpath = line.split()[1]
222 proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) 222 if not module_relpath.split('/')[0] == '..':
223 proc.communicate() 223 module_dir = os.path.join(s_dir, module_relpath)
224 proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) 224 proc = subprocess.Popen(['git', 'add', '-A', '.'], cwd=module_dir, env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
225 stdout, _ = proc.communicate() 225 proc.communicate()
226 git_sha1 += stdout.decode("utf-8") 226 proc = subprocess.Popen(['git', 'write-tree'], cwd=module_dir, env=env, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
227 stdout, _ = proc.communicate()
228 git_sha1 += stdout.decode("utf-8")
227 sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest() 229 sha1 = hashlib.sha1(git_sha1.encode("utf-8")).hexdigest()
228 with open(oe_hash_file, 'w') as fobj: 230 with open(oe_hash_file, 'w') as fobj:
229 fobj.write(sha1) 231 fobj.write(sha1)