diff options
author | Daniel Firth <dan.firth@codethink.co.uk> | 2016-12-09 14:27:39 +0000 |
---|---|---|
committer | GitLab <gitlab@gitlab.com> | 2016-12-13 18:10:27 +0000 |
commit | f3db0eafa212d9ac5165bdaaf63e59df09093d83 (patch) | |
tree | db56de4d200e680912889be84c01e7f2d24d8039 | |
parent | 7235275a79cc2679eddb8856bcfcdc8c777ca36e (diff) | |
download | ybd-f3db0eafa212d9ac5165bdaaf63e59df09093d83.tar.gz |
Replace copy_all_files with copy_fs
-rw-r--r-- | ybd/sandbox.py | 3 | ||||
-rw-r--r-- | ybd/utils.py | 16 |
2 files changed, 2 insertions, 17 deletions
diff --git a/ybd/sandbox.py b/ybd/sandbox.py index 4361b95..b1a7bb4 100644 --- a/ybd/sandbox.py +++ b/ybd/sandbox.py @@ -28,6 +28,7 @@ import app import cache import utils from repos import get_repo_url +from fs.copy import copy_fs # This must be set to a sandboxlib backend before the run_sandboxed() function @@ -81,7 +82,7 @@ def install(dn, component): app.log(dn, 'Unable to get cache for', component['name'], exit=True) unpackdir = cache.get_cache(component) + '.unpacked' if dn.get('kind') is 'system': - utils.copy_all_files(unpackdir, dn['sandbox']) + copy_fs(unpackdir, dn['sandbox']) else: utils.hardlink_all_files(unpackdir, dn['sandbox']) diff --git a/ybd/utils.py b/ybd/utils.py index 89648c8..e9344fb 100644 --- a/ybd/utils.py +++ b/ybd/utils.py @@ -108,22 +108,6 @@ def relative_symlink_target(root, symlink, target): return target -def copy_all_files(srcpath, destpath): - '''Copy every file in the source path to the destination. - - If an exception is raised, the staging-area is indeterminate. - - ''' - - def _copyfun(inpath, outpath): - with open(inpath, "r") as infh: - with open(outpath, "w") as outfh: - shutil.copyfileobj(infh, outfh, 1024*1024*4) - shutil.copystat(inpath, outpath) - - _process_tree(destpath, srcpath, destpath, _copyfun) - - def hardlink_all_files(srcpath, destpath): '''Hardlink every file in the path to the staging-area |