diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-06-13 11:05:01 +0300 |
commit | bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0 (patch) | |
tree | 1d1df72c0541a59a81439842f46d95396d3e7189 /build/scripts/merge_coverage_data.py | |
parent | 8bfdfa9a9bd19bddbc58d888e180fbd1218681be (diff) | |
download | ydb-bf0f13dd39ee3e65092ba3572bb5b1fcd125dcd0.tar.gz |
add ymake export to ydb
Diffstat (limited to 'build/scripts/merge_coverage_data.py')
-rw-r--r-- | build/scripts/merge_coverage_data.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/build/scripts/merge_coverage_data.py b/build/scripts/merge_coverage_data.py new file mode 100644 index 0000000000..b7fa3c6a86 --- /dev/null +++ b/build/scripts/merge_coverage_data.py @@ -0,0 +1,32 @@ +import sys +import tarfile +import copy +import os +import uuid + + +def main(args): + output_file, args = args[0], args[1:] + # heretic@: Splits files on which could be merged( files ) and which should not be merged( expendables ) + # expendables will be in output_file in form {name}{ordinal number of archive in args[]}.{extension} + try: + split_i = args.index('-no-merge') + except ValueError: + split_i = len(args) + files, expendables = args[:split_i], args[split_i + 1:] + + with tarfile.open(output_file, 'w') as outf: + for x in files: + with tarfile.open(x) as tf: + for tarinfo in tf: + new_tarinfo = copy.deepcopy(tarinfo) + if new_tarinfo.name in expendables: + dirname, basename = os.path.split(new_tarinfo.name) + basename_parts = basename.split('.', 1) + new_basename = '.'.join([basename_parts[0] + str(uuid.uuid4())] + basename_parts[1:]) + new_tarinfo.name = os.path.join(dirname, new_basename) + outf.addfile(new_tarinfo, tf.extractfile(tarinfo)) + + +if __name__ == '__main__': + main(sys.argv[1:]) |