summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-08-01 16:31:38 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-08-15 15:33:05 +0100
commitef8525c2af4fd2ad70111cfea47db7f1dce67182 (patch)
treeae0d49b8dadc9a72f33f3cd9e76ecf02d72ef083
parent70f35b6c5db9a2b961b58813989fdf80773c02c0 (diff)
downloadbuildstream-ef8525c2af4fd2ad70111cfea47db7f1dce67182.tar.gz
Directory API: add mark_changed
-rw-r--r--buildstream/sandbox/_sandboxbwrap.py1
-rw-r--r--buildstream/sandbox/_sandboxchroot.py1
-rw-r--r--buildstream/storage/_filebaseddirectory.py4
-rw-r--r--buildstream/storage/directory.py10
4 files changed, 16 insertions, 0 deletions
diff --git a/buildstream/sandbox/_sandboxbwrap.py b/buildstream/sandbox/_sandboxbwrap.py
index efec3748d..ea7254c1b 100644
--- a/buildstream/sandbox/_sandboxbwrap.py
+++ b/buildstream/sandbox/_sandboxbwrap.py
@@ -248,6 +248,7 @@ class SandboxBwrap(Sandbox):
# a bug, bwrap mounted a tempfs here and when it exits, that better be empty.
pass
+ self._vdir._mark_changed()
return exit_code
def run_bwrap(self, argv, stdin, stdout, stderr, interactive):
diff --git a/buildstream/sandbox/_sandboxchroot.py b/buildstream/sandbox/_sandboxchroot.py
index de4eb46e2..a902f22ad 100644
--- a/buildstream/sandbox/_sandboxchroot.py
+++ b/buildstream/sandbox/_sandboxchroot.py
@@ -106,6 +106,7 @@ class SandboxChroot(Sandbox):
status = self.chroot(rootfs, command, stdin, stdout,
stderr, cwd, env, flags)
+ self._vdir._mark_changed()
return status
# chroot()
diff --git a/buildstream/storage/_filebaseddirectory.py b/buildstream/storage/_filebaseddirectory.py
index 17144bc5f..8956d303a 100644
--- a/buildstream/storage/_filebaseddirectory.py
+++ b/buildstream/storage/_filebaseddirectory.py
@@ -121,8 +121,12 @@ class FileBasedDirectory(Directory):
for f in import_result.files_written:
os.utime(os.path.join(self.external_directory, f), times=(cur_time, cur_time))
+ self._mark_changed()
return import_result
+ def _mark_changed(self):
+ self._directory_read = False
+
def set_deterministic_mtime(self):
_set_deterministic_mtime(self.external_directory)
diff --git a/buildstream/storage/directory.py b/buildstream/storage/directory.py
index 984a7f0dd..838741231 100644
--- a/buildstream/storage/directory.py
+++ b/buildstream/storage/directory.py
@@ -166,3 +166,13 @@ class Directory():
"""
raise NotImplementedError()
+
+ def _mark_changed(self):
+ """Internal function to mark this directory as having been changed
+ outside this API. This normally can only happen by calling the
+ Sandbox's `run` method. This does *not* mark everything as modified
+ (i.e. list_modified_paths will not necessarily return the same results
+ as list_relative_paths after calling this.)
+
+ """
+ raise NotImplementedError()