Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / bin / update / create_full_mar.py
blob48686be21e453a11fd10c2e99480e19505e6bb4c
1 #!/usr/bin/env python3
3 import sys
4 import os
5 import subprocess
6 import json
8 from tools import uncompress_file_to_dir, get_file_info, make_complete_mar_name
9 from config import parse_config
10 from signing import sign_mar_file
11 from path import UpdaterPath, convert_to_unix, convert_to_native
13 current_dir_path = os.path.dirname(os.path.realpath(convert_to_unix(__file__)))
15 def main():
16 if len(sys.argv) < 5:
17 print("Usage: create_full_mar_for_languages.py $PRODUCTNAME $WORKDIR $FILENAMEPREFIX $UPDATE_CONFIG")
18 sys.exit(1)
20 update_config = sys.argv[4]
21 filename_prefix = sys.argv[3]
22 workdir = sys.argv[2]
23 product_name = sys.argv[1]
25 if len(update_config) == 0:
26 print("missing update config")
27 sys.exit(1)
29 update_path = UpdaterPath(workdir)
30 update_path.ensure_dir_exist()
32 target_dir = update_path.get_update_dir()
33 temp_dir = update_path.get_current_build_dir()
35 config = parse_config(update_config)
37 tar_dir = os.path.join(update_path.get_workdir(), "installation", product_name, "archive", "install", "en-US")
38 tar_file = os.path.join(tar_dir, os.listdir(tar_dir)[0])
40 uncompress_dir = uncompress_file_to_dir(tar_file, temp_dir)
42 mar_file = make_complete_mar_name(target_dir, filename_prefix)
43 path = os.path.join(current_dir_path, 'make_full_update.sh')
44 subprocess.call([path, convert_to_native(mar_file), convert_to_native(uncompress_dir)])
46 sign_mar_file(target_dir, config, mar_file, filename_prefix)
48 file_info = { 'complete' : get_file_info(mar_file, config.base_url) }
50 with open(os.path.join(target_dir, 'complete_info.json'), "w") as complete_info_file:
51 json.dump(file_info, complete_info_file, indent = 4)
53 if __name__ == '__main__':
54 main()