diff options
authorQuentin Schulz <quentin.schulz@streamunlimited.com>2019-09-19 16:55:14 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-19 16:50:47 +0100
commit1b727dd7295a7a7fe17800f8038242efbf7fe2b7 (patch)
parent53d6cd98216e3b73c0c90e42223efd1a2b649358 (diff)
externalsrc: stop rebuilds of 2+ externalsrc recipes sharing the same git repo
externalsrc do_configure task watches oe-devtool-tree-sha1 file and its checksum. That file basically contains the result of `git add -A ${EXTERNALSRC} && git write-tree` which is the hash of temporary "commit" of the non committed changes. This file is stored in the .git directory of the git repo of the externalsrc recipe. do_configure then depends on the checksum of oe-devtool-tree-sha1 file. If 2+ recipes with different externalsrc paths but same git repo (e.g. one recipe at /some/path and the other at /some/path/subdir) are parsed, this oe-devtool-tree-sha1 will be overwritten by those recipes at parsing time since .git is shared between those recipes. If there is one non committed git change in /some/path but not in /some/path/subdir, the oe-devtool-tree-sha1 of both recipes will be different. What will happen is that recipe1 will watch over the oe-devtool-tree-sha1 with a specific checksum, fill in file-checksums for do_configure correctly, then recipe2 will watch over the identically named file with different content also fill in the file-checksums varflag. When do_configure of recipe1 will be evaluated for re-execution, oe-devtool-tree-sha1 will be of the value of what is watched over by recipe2, thus triggering a rebuild of recipe1. This behavior is not always reproducible which I'm guessing is due to a small window between recipe1 putting info into oe-devtool-tree-sha1 and calculating the checksum of that file and recipe2 putting its content into oe-devtool-tree-sha1. By appending the name of the recipe to oe-devtool-tree-sha1, we make sure that a recipe won't have its oe-devtool-tree-sha1 overwritten by another recipe sharing the same externalsrc git repo. Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
index 3618b99a863..ea59d02ed93 100644
--- a/meta/classes/externalsrc.bbclass
+++ b/meta/classes/externalsrc.bbclass
@@ -203,7 +203,7 @@ def srctree_hash_files(d, srcdir=None):
ret = " "
if git_dir is not None:
- oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
+ oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1-%s' % d.getVar('PN'))
with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
# Clone index
shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)