Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / bin / update / create_full_mar.py
blob39cb23f1f20e765ab788adef2592782724191e29
1 #!/usr/bin/env python3
3 import sys
4 import os
5 import subprocess
6 import json
7 import argparse
9 from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name
10 from config import parse_config
11 from signing import sign_mar_file
12 from path import UpdaterPath, convert_to_unix, convert_to_native
14 current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__)))
17 def main():
18 parser = argparse.ArgumentParser()
19 parser.add_argument('product_name')
20 parser.add_argument('workdir')
21 parser.add_argument('filename_prefix')
22 parser.add_argument('update_config')
23 args = parser.parse_args()
25 update_config = args.update_config
26 filename_prefix = args.filename_prefix
27 workdir = args.workdir
28 product_name = args.update_config
30 if len(update_config) == 0:
31 print("missing update config")
32 sys.exit(1)
34 update_path = UpdaterPath(workdir)
35 update_path.ensure_dir_exist()
37 target_dir = update_path.get_update_dir()
38 temp_dir = update_path.get_current_build_dir()
40 config = parse_config(update_config)
42 tar_dir = os.path.join(update_path.get_workdir(), "installation", product_name, "archive", "install", "en-US")
43 tar_file = os.path.join(tar_dir, os.listdir(tar_dir)[0])
45 uncompress_dir = uncompress_file_to_dir(tar_file, temp_dir)
47 mar_file = make_complete_mar_name(target_dir, filename_prefix)
48 path = os.path.join(current_dir_path, 'make_full_update.sh')
49 subprocess.call([path, convert_to_native(mar_file), convert_to_native(uncompress_dir)])
51 sign_mar_file(target_dir, config, mar_file, filename_prefix)
53 file_info = {'complete': get_file_info(mar_file, config.base_url)}
55 with open(os.path.join(target_dir, 'complete_info.json'), "w") as complete_info_file:
56 json.dump(file_info, complete_info_file, indent=4)
59 if __name__ == '__main__':
60 main()