summaryrefslogtreecommitdiff
path: root/src/buildstream/storage/_filebaseddirectory.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildstream/storage/_filebaseddirectory.py')
-rw-r--r--src/buildstream/storage/_filebaseddirectory.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/buildstream/storage/_filebaseddirectory.py b/src/buildstream/storage/_filebaseddirectory.py
index 9a746f731..90911da86 100644
--- a/src/buildstream/storage/_filebaseddirectory.py
+++ b/src/buildstream/storage/_filebaseddirectory.py
@@ -28,6 +28,7 @@ See also: :ref:`sandboxing`.
"""
import os
+import shutil
import stat
import time
@@ -111,6 +112,15 @@ class FileBasedDirectory(Directory):
os.utime(os.path.join(self.external_directory, f), times=(cur_time, cur_time))
return import_result
+ def import_single_file(self, srcpath):
+ dstpath = os.path.join(self.external_directory, os.path.basename(srcpath))
+ result = FileListResult()
+ if os.path.exists(dstpath):
+ result.ignored.append(dstpath)
+ else:
+ shutil.copyfile(srcpath, dstpath, follow_symlinks=False)
+ return result
+
def _mark_changed(self):
pass