diff options
author | Quentin Schulz <quentin.schulz@streamunlimited.com> | 2019-09-19 16:55:14 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-09-19 20:30:35 +0100 |
commit | 9daa97bea87a33f1a890378e1686bcec779cad80 (patch) | |
tree | d81431c70f19425e0f386f4e59f2d24560fb6e62 /meta/classes/externalsrc.bbclass | |
parent | db5f08c16eff01f3af0b99119c09f68628e2331d (diff) | |
download | poky-9daa97bea87a33f1a890378e1686bcec779cad80.tar.gz |
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.
(From OE-Core rev: 1b727dd7295a7a7fe17800f8038242efbf7fe2b7)
Signed-off-by: Quentin Schulz <quentin.schulz@streamunlimited.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r-- | meta/classes/externalsrc.bbclass | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 3618b99a86..ea59d02ed9 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -203,7 +203,7 @@ def srctree_hash_files(d, srcdir=None): | |||
203 | 203 | ||
204 | ret = " " | 204 | ret = " " |
205 | if git_dir is not None: | 205 | if git_dir is not None: |
206 | oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1') | 206 | oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1-%s' % d.getVar('PN')) |
207 | with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index: | 207 | with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index: |
208 | # Clone index | 208 | # Clone index |
209 | shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name) | 209 | shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name) |