Update git submodules
[LibreOffice.git] / bin / update / create_full_mar.py
blobf3ccc972afce25b5cf319df66f13486f841cf377
1 #!/usr/bin/env python3
3 import os
4 import subprocess
5 import json
6 import argparse
8 from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name
9 from signing import sign_mar_file
10 from path import UpdaterPath, convert_to_unix, convert_to_native
12 current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__)))
15 def main():
16 parser = argparse.ArgumentParser()
17 parser.add_argument('product_name')
18 parser.add_argument('workdir')
19 parser.add_argument('filename_prefix')
20 parser.add_argument('certificate_path')
21 parser.add_argument('certificate_name')
22 parser.add_argument('base_url')
23 args = parser.parse_args()
25 certificate_path = args.certificate_path
26 certificate_name = args.certificate_name
27 base_url = args.base_url
28 filename_prefix = args.filename_prefix
29 workdir = args.workdir
30 product_name = args.product_name
32 update_path = UpdaterPath(workdir)
33 update_path.ensure_dir_exist()
35 target_dir = update_path.get_update_dir()
36 temp_dir = update_path.get_current_build_dir()
38 tar_dir = os.path.join(update_path.get_workdir(), "installation", product_name, "archive", "install", "en-US")
39 tar_file = os.path.join(tar_dir, os.listdir(tar_dir)[0])
41 uncompress_dir = uncompress_file_to_dir(tar_file, temp_dir)
43 mar_file = make_complete_mar_name(target_dir, filename_prefix)
44 path = os.path.join(current_dir_path, 'make_full_update.sh')
45 subprocess.call([path, convert_to_native(mar_file), convert_to_native(uncompress_dir)])
47 sign_mar_file(target_dir, certificate_path, certificate_name, mar_file, filename_prefix)
49 file_info = {'complete': get_file_info(mar_file, base_url)}
51 with open(os.path.join(target_dir, 'complete_info.json'), "w") as complete_info_file:
52 json.dump(file_info, complete_info_file, indent=4)
55 if __name__ == '__main__':
56 main()