diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-03-15 19:59:12 +0300 |
commit | 056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11 (patch) | |
tree | 4740980126f32e3af7937ba0ca5f83e59baa4ab0 /build/scripts/container.py | |
parent | 269126dcced1cc8b53eb4398b4a33e5142f10290 (diff) | |
download | ydb-056bb284ccf8dd6793ec3a54ffa36c4fb2b9ad11.tar.gz |
add library/cpp/actors, ymake build to ydb oss export
Diffstat (limited to 'build/scripts/container.py')
-rw-r--r-- | build/scripts/container.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/build/scripts/container.py b/build/scripts/container.py new file mode 100644 index 0000000000..27e6f921f3 --- /dev/null +++ b/build/scripts/container.py @@ -0,0 +1,30 @@ +import subprocess +import os +import shutil + + +class ContainerError(Exception): + pass + + +def join_layers(input_paths, output_path, squashfs_path): + + if len(input_paths) == 1: + shutil.copy2(input_paths[0], output_path) + + else: + # We cannot use appending here as it doesn't allow replacing files + for input_path in input_paths: + unpack_cmd = [ os.path.join(squashfs_path, 'unsquashfs') ] + unpack_cmd.extend([ '-f', input_path ]) + subprocess.run(unpack_cmd) + + pack_cmd = [ os.path.join(squashfs_path, 'mksquashfs') ] + pack_cmd.append(os.path.join(os.curdir, 'squashfs-root')) + pack_cmd.append(output_path) + pack_cmd.append('-all-root') + subprocess.run(pack_cmd) + + shutil.rmtree(os.path.join(os.curdir, 'squashfs-root')) + + return 0 |