summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-11 08:52:22 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-11 13:01:50 +0100
commit416b2ee59fe8209470d5cdcc2332682e22fbc719 (patch)
tree50c22e78955b5caaae67bf326fd24ee7c714eff6 /bin
parentfb443c6d4d210d73795bdb3b7cb392765726f3a1 (diff)
Make create-update-info handle conditional content
That make target operates on an archive, but generates data to be applied to an msi installation, so suffers from any mismatch between archive and msi install sets. Two such mismatches, at least on Windows, are: 1 Files that msi will install outside the LibreOffice installation itself (but which for an archive install set are included under LibreOffice/). This covers (at least) .Net assemblies and associated files that are installed in the GAC (scp2 styles ASSEMBLY and ASSIGNCOMPONENT) and fonts (scp2 style FONT). 2 Files that msi will only install conditionally. This covers optional components (many of which in scp2 are assigned to gid_Module_Optional_... modules) and user interface languages (which in scp2 are assigned to gid_Module_Langpack_... modules). The approach taken here is to create a workdir/installation/LibreOffice/archive/install/metadata file while building an archive install set, and to record any files matching 1 (as "skip" lines) or 2 (as "cond" lines). Then, the create-update-info target uses that metadata file to act accordingly on those files: 1 Files from "skip" lines are simply removed for now from the extracted archive that is passed to Mozilla's make_full_update.sh script. (TODO: That means that changes to such files will not be updated with the MAR update mechanism. This would apparently need some extra processing during the MAR update.) 2 Files from "cond" lines shall be recorded as add-if in the mar file manifest. Mozilla's make_full_update.sh script already has support for emitting add-if vs. plain add, but only for files under distribution/extensions/, which doesn't match our needs. So we generate from the metadata file an ifs file that we pass into the make_full_update.sh script, and patch that script to also take that ifs file into account. (Each line in the ifs file is of the form "testfile" "file" which works as long as none of the pathnames contains double quote characters. The Mozilla script code appears to be confused about the arguments to make_add_instruction(), where this ifs file will be needed: There are calls to make_add_instruction() with two or three arguments across make_full_update.sh and make_incremental_update.sh, but make_add_instruction() checks $1, $2, and $4 (but not $3), so leave that mess alone and pass the ifs file as a global IFSFILE variable instead.) The mar file manifest `add-if "testfile" "file"` adds "file" only if "testfile" is already present, and those two can be different files. TODO: However, for simplicity, for now I always use "file" also as the "testfile" (so that an add-if file only gets updated if it was already present). That avoids having to identify a specific "key file" for each optional component and for each user interface language, where that key file would be used as the add-if testfile. But on the other hand, it means that if an optional component or a user interface language will bring along a completely new file in the future, we will not install that file during a MAR update. What obviously remains to be done is to properly assign each add-if file to a specific key file. (And the current way of identifying add-if files by gid_Module_... names appears to be too simplistic too. For example, there are some gid_Module_Optional_... that are installed unconditionally for msi; but it should be harmless that those files are recorded as add-if rather than as plain add.) Change-Id: I2fdeed92604f3a2d8a0b500b9e3fa421cfb6a9cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161917 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/update/create_full_mar.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/bin/update/create_full_mar.py b/bin/update/create_full_mar.py
index fb0f90491d92..1c2b249db3b5 100755
--- a/bin/update/create_full_mar.py
+++ b/bin/update/create_full_mar.py
@@ -2,6 +2,7 @@
import glob
import os
+import re
import subprocess
import json
import argparse
@@ -44,12 +45,27 @@ def main():
uncompress_dir = uncompress_file_to_dir(tar_file, temp_dir)
+ metadatafile = os.path.join(
+ update_path.get_workdir(), 'installation', product_name, 'archive', 'install', 'metadata')
+ ifsfile = os.path.join(update_path.get_mar_dir(), 'ifs')
+ with open(metadatafile) as meta, open(ifsfile, 'w') as ifs:
+ for l in meta:
+ m = re.fullmatch('(skip|cond) (.*)', l.rstrip())
+ if m and m.group(2).startswith(f'{product_name}/'):
+ path = m.group(2)[len(f'{product_name}/'):]
+ if m.group(1) == 'skip':
+ os.remove(os.path.join(uncompress_dir, path))
+ else:
+ ifs.write(f'"{path}" "{path}"\n')
+
mar_file = make_complete_mar_name(target_dir, filename_prefix)
path = os.path.join(
workdir, 'UnpackedTarball/onlineupdate/tools/update-packaging/make_full_update.sh')
os.putenv('MOZ_PRODUCT_VERSION', version)
os.putenv('MAR_CHANNEL_ID', 'LOOnlineUpdater')
- subprocess.call([path, convert_to_native(mar_file), convert_to_native(uncompress_dir)])
+ subprocess.call([
+ path, convert_to_native(mar_file), convert_to_native(uncompress_dir),
+ convert_to_native(ifsfile)])
sign_mar_file(target_dir, certificate_path, certificate_name, mar_file, filename_prefix)