summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2016-12-10 10:46:29 +0000
committerDaniel Firth <dan.firth@codethink.co.uk>2016-12-10 10:46:29 +0000
commit0b31733f51a4e478eae621316b5924ea78c3ed3e (patch)
tree58bbed7b20fc88bb63323737670230f3450b2c4c
parent420276cfa11115357b10f1b532fcb41372de04f5 (diff)
parent42e15841820e3dda561a0f3cb4f69c89f7b44da6 (diff)
downloadybd-lc/staging/fixes-u.tar.gz
Merge branch 'lc/copy_fs_filter' into lc/staging/fixeslc/staging/fixes-u
-rw-r--r--ybd/splitting.py6
-rw-r--r--ybd/utils.py16
2 files changed, 4 insertions, 18 deletions
diff --git a/ybd/splitting.py b/ybd/splitting.py
index e6fe7b0..2f8603f 100644
--- a/ybd/splitting.py
+++ b/ybd/splitting.py
@@ -20,8 +20,9 @@ from cache import get_cache
import os
import re
import yaml
-from utils import copy_file_list
from fs import open_fs
+from fs.copy import copy_fs
+from fs.walk import Walker
import itertools
@@ -102,7 +103,8 @@ def move_required_files(dn, stratum, artifacts):
log(dn, 'Splits split_metadata is\n', split_metadata,
verbose=True)
log(dn, 'Splits filelist is\n', filelist, verbose=True)
- copy_file_list(dn['sandbox'], dn['install'], filelist)
+ copy_fs(dn['sandbox'], dn['install'],
+ walker=Walker(filter=filelist))
except:
import traceback
traceback.print_exc()
diff --git a/ybd/utils.py b/ybd/utils.py
index cef4606..113f062 100644
--- a/ybd/utils.py
+++ b/ybd/utils.py
@@ -186,22 +186,6 @@ def _process_tree(root, srcpath, destpath, actionfunc):
raise IOError('Cannot stage %s, unsupported type' % srcpath)
-def copy_file_list(srcpath, destpath, filelist):
- '''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_list(srcpath, destpath, filelist, _copyfun)
-
-
def hardlink_file_list(srcpath, destpath, filelist):
'''Hardlink every file in the path to the staging-area