Commit 01a02a9a authored by Tristan Van Berkom's avatar Tristan Van Berkom Use file mtime for workspace cache keys instead of checksumming

The rationale for this is basically:

  o A workspace is completely local

  o A cache key for a workspace is used to determine if the
    workspace has changed or not

  o Within reason, one should not expect buildstream to detect
    a change without a file's mtime having been modified

On my machine, it takes about 1 minute to checksum 11GB of WebKit checkout,
that is annoyingly a long time. With this change, it takes only 5 seconds.

Not perfect, but it's a start.

This is related to issues #294, #295 and #392
parent 3d9491dd
Pipeline #21862519 passed with stages
in 19 minutes and 15 seconds
......@@ -173,17 +173,14 @@ class Workspace():
def get_key(self, recalculate=False):
def unique_key(filename):
if os.path.isdir(filename):
return "0"
elif os.path.islink(filename):
return "1"
return utils.sha256sum(filename)
except FileNotFoundError as e:
stat = os.lstat(filename)
except OSError as e:
raise LoadError(LoadErrorReason.MISSING_FILE,
"Failed loading workspace. Did you remove the "
"workspace directory? {}".format(e))
"Failed to stat file in workspace: {}".format(e))
# Use the mtime of any file with sub second precision
return stat.st_mtime_ns
if recalculate or self._key is None:
fullpath = self.get_absolute_path()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment