diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2024-05-27 14:16:29 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2024-06-06 16:00:43 +0200 |
commit | 7cea20d132f8f419bab28ed954635e29a16e5ae2 (patch) | |
tree | 7cdf3a114aa9a5481acfd1f3804204fb47557aca /bin/update | |
parent | e4b420dfb57dec361032cf1fb1fe47cc69b46358 (diff) |
mar: allow parallel creation of diff packages
also include the version number in the base-URL for the mar files in the
json-file
Change-Id: I613ac7c1cf3aeb1eff856c58f00a67151267606c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168100
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'bin/update')
-rwxr-xr-x | bin/update/create_partial_update.py | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/bin/update/create_partial_update.py b/bin/update/create_partial_update.py index 3d9f459f1fdf..8dfa370e5fa7 100755 --- a/bin/update/create_partial_update.py +++ b/bin/update/create_partial_update.py @@ -1,10 +1,10 @@ #!/usr/bin/env python3 -import glob import json import os import re import subprocess import sys +import time from path import UpdaterPath, convert_to_native from signing import sign_mar_file @@ -15,11 +15,23 @@ def generate_file_name(old_build_id, mar_name_prefix): name = "%s_from_%s_partial.mar" % (mar_name_prefix, old_build_id) return name +def waitforlock(lockfile): + while True: + try: + os.close(os.open(lockfile, os.O_CREAT | os.O_EXCL)) + break + except OSError: + print("waiting for lockfile/msiexec already running, sleeping 10s") + time.sleep(10) + +def releaselock(lockfile): + os.remove(lockfile) def main(): workdir = sys.argv[1] + lockfile = os.path.join(workdir,"msiexeclock") - updater_path = UpdaterPath(workdir) + updater_path = UpdaterPath(os.path.join(workdir,os.environ.get('ARCH','unknown'))) updater_path.ensure_dir_exist() mar_name_prefix = sys.argv[2] @@ -30,8 +42,12 @@ def main(): product_name = sys.argv[7] version = sys.argv[8] old_msi = sys.argv[9] + new_msi_file = sys.argv[10] + waitforlock(lockfile) old_uncompress_dir = uncompress_file_to_dir(old_msi, updater_path.get_previous_build_dir()) + new_uncompress_dir = uncompress_file_to_dir(new_msi_file, updater_path.get_current_build_dir()) + releaselock(lockfile) versionini = os.path.join(old_uncompress_dir, 'program', 'version.ini') #TODO: Linux, macOS old_build_id = None with open(versionini) as f: @@ -43,13 +59,6 @@ def main(): if old_build_id is None: raise Exception(f'Cannot find buildid in {versionini}') - new_msi_file_glob = os.path.join(updater_path.get_workdir(), "installation", product_name, "msi", "install", "*", f'{product_name}_*.msi') - new_msi_files = glob.glob(new_msi_file_glob) - if len(new_msi_files) != 1: - raise Exception(f'`{new_msi_file_glob}` does not match exactly one file') - new_msi_file = new_msi_files[0] - new_uncompress_dir = uncompress_file_to_dir(new_msi_file, updater_path.get_current_build_dir()) - update_dir = updater_path.get_update_dir() file_name = generate_file_name(old_build_id, mar_name_prefix) |