diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-05-13 14:17:42 +0100 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2016-05-13 14:17:42 +0100 |
commit | b4e6cdd23dabe7802ca449d6ca61bfd4c312b983 (patch) | |
tree | d5237acbb5cee41c789b5bacf3db089b22d5fc1e | |
parent | 5c2c9a300f8cbf13f2e536057a6700d8683d4295 (diff) | |
download | ybd-ps-attempt-218-fix.tar.gz |
Attempt fix for #218ps-attempt-218-fix
-rw-r--r-- | ybd/splitting.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/ybd/splitting.py b/ybd/splitting.py index 9cf2b67..4dd0d26 100644 --- a/ybd/splitting.py +++ b/ybd/splitting.py @@ -23,7 +23,6 @@ import assembly import yaml import utils from collections import OrderedDict -from fs.osfs import OSFS def install_split_artifacts(defs, component, stratum, artifacts): @@ -198,25 +197,23 @@ def write_chunk_metafile(defs, chunk): rules, splits = compile_rules(defs, chunk) install_dir = chunk['install'] - fs = OSFS(install_dir) - files = fs.walkfiles('.', search='depth') - dirs = fs.walkdirs('.', search='depth') - - for path in files: - for artifact, rule in rules: - if rule.match(path): - splits[artifact].append(path) - break - - all_files = [a for x in splits.values() for a in x] - for path in dirs: - if not any(map(lambda y: y.startswith(path), - all_files)) and path != '': + for root, dirs, files in os.walk(install_dir, topdown=False): + + for path in files: for artifact, rule in rules: - if rule.match(path) or rule.match(path + '/'): + if rule.match(path): splits[artifact].append(path) break + all_files = [a for x in splits.values() for a in x] + for path in dirs: + if not any(map(lambda y: y.startswith(path), + all_files)) and path != '': + for artifact, rule in rules: + if rule.match(path) or rule.match(path + '/'): + splits[artifact].append(path) + break + write_metafile(rules, splits, chunk) |