Skip to contentSkip to conversation

Improve externalsrc task dependency tracking

PATCH Superseded Markus Lehtonen 1 participant 3 messages Jan 26, 2016

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Improve externalsrc task dependency tracking

This patchset improves task hashing of do_compile when externalsrc is enabled. Previously, it was simply a 'nostamp' task that was always being (re-)run. This patchset changes externalsrc to utilize the file-checksum dependency feature of tasks to really track changes in the source tree, and thus, aims in preventing unneeded (re-)compilations.

[YOCTO #8853]

The following changes since commit fc4209baa098caebf9c4cb75f9a6f2e85f43333c:

Revert "xz: Allow to work with ASSUME_PROVIDED xz-native" (2016-01-25 10:08:25 +0000)

are available in the git repository at:

git://git.openembedded.org/openembedded-core-contrib marquiz/devtool/fixes

Markus Lehtonen (2):
externalsrc.bbclas: remove nostamp from do_configure
devtool: create-workspace: define separate cache for task file
checksums

 meta/classes/externalsrc.bbclass | 3 +--
 scripts/devtool                  | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/2 externalsrc.bbclas: remove nostamp from do_configure

Be a bit more intelligent than mindlessly re-compiling every time. Instead of using 'nostamp' flag for do_compile add the whole source tree as 'file-checksums' flag. This way, do_compile is only re-run if something in the source tree content changes. Hidden files and directories in the source tree root are ignored by the glob currently used. This has the advantage of automatically ignoring .git directory, for example.

This does not work perfectly, though, as many packages are built under ${S} which effectively changes the source tree causing some unwanted re-compilations. However, if do_compile of the recipe does not produce new/different artefacts on every run (as commonly is and should be the case) the re-compilation loop stops. Thus, you should usually see only one re-compilation (if any) after which the source tree is "stabilized" and no more re-compilations happen.

During the first bitbake run preparing of the task runqueue may take much longer because all the files in the source tree are hashed. Subsequent builds are not significantly slower because (most) file hashes are found from the cache.

[YOCTO #8853]

---
 meta/classes/externalsrc.bbclass | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/classes/externalsrc.bbclass +1 -2
index f7ed66d..fe4963d 100644
@@ -83,8 +83,7 @@ python () {
 
         d.prependVarFlag('do_compile', 'prefuncs', "externalsrc_compile_prefunc ")
 
-        # Ensure compilation happens every time
-        d.setVarFlag('do_compile', 'nostamp', '1')
+        d.setVarFlag('do_compile', 'file-checksums', externalsrc + '/*:True')
 }
 
 python externalsrc_compile_prefunc() {
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/2 devtool: create-workspace: define separate cache for task file checksums

In reply to Markus Lehtonen

Define BB_HASH_CHECKSUM_CACHE_FILE variable in the workspace layer config so that a specific cache is used for storing the task file dependency checksums. The file checksum cache can grow quite large after hashing of all file in externalsrc trees was enabled. This patch prevents polluting/growing the fetcher local file checksum cache. Also, this new devtool-specific cache is not used after the workspace layer is disabled.

[YOCTO #8853]

---
 scripts/devtool | 1 +
 1 file changed, 1 insertion(+)
scripts/devtool +1 -0
index 2d57da0..e44b87e9 100755
@@ -152,6 +152,7 @@ def _create_workspace(workspacedir, config, basepath):
             f.write('BBFILE_PATTERN_workspacelayer = "^$' + '{LAYERDIR}/"\n')
             f.write('BBFILE_PATTERN_IGNORE_EMPTY_workspacelayer = "1"\n')
             f.write('BBFILE_PRIORITY_workspacelayer = "99"\n')
+            f.write('BB_HASH_CHECKSUM_CACHE_FILE = "filedep_checksum_cache.dat"\n')
         # Add a README file
         with open(os.path.join(workspacedir, 'README'), 'w') as f:
             f.write('This layer was created by the OpenEmbedded devtool utility in order to\n')
Signature · 1 line
2.1.4