summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-04 12:00:27 +0100
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-01-05 16:56:06 +0100
commitb235e5e2f0933a013c6177f7e31ae82b45e9e048 (patch)
tree0351ac445e61a424d06cddc6c2cb4b61ee36acb9 /external
parentf28e0f30a47b3c8706d0247e1ee4f3e4084546cd (diff)
Fix `make create-update-info` (for Windows, at least)
* The shell scripts that had once been copied from Mozilla to bin/update/*.sh are now included in onlineupdate-c003be8b9727672e7d30972983b375f4c200233f-2.tar.xz (which is still generated from the same <https://github.com/mozilla/gecko-dev/commit/c003be8b9727672e7d30972983b375f4c200233f> that was used for the original tarball in 3a445cb49795fabe0d8caaf12bfc38eb9e12d5fc "Turn onlineupdate into external/onlineupdate"). * The additional modifications in external/onlineupdate/lo.patch are: ** Allowing to pass the list of files into the mar tool via -f instead of on the command line, to avoid "command line too long" errors on Windows, inspired by the modifications once made directly in our old downstream sources with 4165dd4e465a86ba6abe9afb3abfda5ef72493ea "add a way to create mar file from file", 8e4d49340bd235a7db8fde1d24dd1d63ddc4d571 "use the new file based approach for the mar creation", and fb13ed6955cd66017e5348b915af371a184ea633 "add the manifest file to the mar file". (To keep things simple for now, it still uses a hard-coded maximum of 10000 lines in the file, marked with a TODO.) ** Not failing when "precomplete file is missing!" (There is a comment // Applications aren't required to have a precomplete manifest. The mar // generation scripts enforce the presence of a precomplete manifest. in workdir/UnpackedTarball/onlineupdate/onlineupdate/source/update/updater/updater.cpp and it appears to be OK that we don't have such a precomplete manifest file and just skip that test.) * In the Makefile.gbuild create-update-info, the create_full_mar.py script needs to be called with a Unix pathname on Windows, or else the #!/usr/bin/env python3 shebang in that script would get confused. * The related Makefile.gbuild targets upload-update-info and create-partial-info have not been addressed yet. Change-Id: Iab4e083ddbe99e07d846e202f20c6031e2983e1b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161656 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> (cherry picked from commit c9973227dae088a5fb04cee12b2c99e0f62d6e28) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161649
Diffstat (limited to 'external')
-rwxr-xr-xexternal/onlineupdate/generate-sources.sh3
-rw-r--r--external/onlineupdate/lo.patch133
2 files changed, 136 insertions, 0 deletions
diff --git a/external/onlineupdate/generate-sources.sh b/external/onlineupdate/generate-sources.sh
index bc39603c156b..8f11faf5a65d 100755
--- a/external/onlineupdate/generate-sources.sh
+++ b/external/onlineupdate/generate-sources.sh
@@ -185,6 +185,9 @@ copyto toolkit/mozapps/update/common/updateutils_win.cpp toolkit/mozapps/update/
copyto toolkit/mozapps/update/common/updateutils_win.h toolkit/mozapps/update/common/updateutils_win.h
copyto toolkit/mozapps/update/updater/crctable.h toolkit/mozapps/update/updater/crctable.h
copyto toolkit/xre/nsWindowsRestart.cpp toolkit/xre/nsWindowsRestart.cpp
+copyto tools/update-packaging/common.sh tools/update-packaging/common.sh
+copyto tools/update-packaging/make_full_update.sh tools/update-packaging/make_full_update.sh
+copyto tools/update-packaging/make_incremental_update.sh tools/update-packaging/make_incremental_update.sh
copyto xpcom/base/nsAlgorithm.h xpcom/base/nsAlgorithm.h
copyto xpcom/base/nsAutoRef.h xpcom/base/nsAutoRef.h
copyto xpcom/base/nsWindowsHelpers.h xpcom/base/nsWindowsHelpers.h
diff --git a/external/onlineupdate/lo.patch b/external/onlineupdate/lo.patch
index a8b92830419c..0021c3a69fe7 100644
--- a/external/onlineupdate/lo.patch
+++ b/external/onlineupdate/lo.patch
@@ -1,3 +1,96 @@
+--- onlineupdate/source/libmar/tool/mar.c
++++ onlineupdate/source/libmar/tool/mar.c
+@@ -14,7 +14,9 @@
+ # include <windows.h>
+ # include <direct.h>
+ # define chdir _chdir
++# define PATH_MAX MAX_PATH
+ #else
++# include <limits.h>
+ # include <unistd.h>
+ #endif
+
+@@ -39,7 +41,7 @@
+ printf("Create a MAR file:\n");
+ printf(
+ " mar -H MARChannelID -V ProductVersion [-C workingDir] "
+- "-c archive.mar [files...]\n");
++ "-c archive.mar [files...|-f files]\n");
+
+ printf("Extract a MAR file:\n");
+ printf(" mar [-C workingDir] -x archive.mar\n");
+@@ -244,6 +246,8 @@
+
+ switch (argv[1][1]) {
+ case 'c': {
++ int numfiles;
++ char** files;
+ struct ProductInformationBlock infoBlock;
+ if (!productVersion) {
+ fprintf(stderr,
+@@ -256,9 +260,61 @@
+ "<mar-channel-id>`).\n");
+ return -1;
+ }
++ if (argc == 5 && !strcmp(argv[3], "-f")) {
++ FILE* in;
++ in = fopen(argv[4], "r");
++ if (!in) {
++ fprintf(stderr,
++ "ERROR: Cannot open file `%s` for reading.\n", argv[4]);
++ return -1;
++ }
++ numfiles = 0;
++ files = malloc(sizeof(char*) * 10000); /*TODO*/
++ if (!files) {
++ fprintf(stderr,
++ "ERROR: Cannot allocate memory");
++ return -1;
++ }
++ for (;;) {
++ char buf[PATH_MAX + 1];
++ size_t len;
++ if (!fgets(buf, PATH_MAX + 1, in)) {
++ if (feof(in)) {
++ break;
++ }
++ fprintf(stderr,
++ "ERROR: Cannot read from file `%s`.\n", argv[4]);
++ return -1;
++ }
++ len = strlen(buf);
++ if (len != 0 && buf[len - 1] == '\n') {
++ buf[len - 1] = '\0';
++ } else if (!feof(in)) {
++ fprintf(stderr,
++ "ERROR: Too long line in file `%s`.\n", argv[4]);
++ return -1;
++ }
++ if (numfiles == 10000) { /*TODO*/
++ fprintf(stderr,
++ "ERROR: Too many lines in file `%s`.\n", argv[4]);
++ return -1;
++ }
++ files[numfiles] = strdup(buf);
++ if (!files[numfiles]) {
++ fprintf(stderr,
++ "ERROR: Cannot allocate memory");
++ return -1;
++ }
++ ++numfiles;
++ }
++ fclose(in);
++ } else {
++ numfiles = argc - 3;
++ files = argv + 3;
++ }
+ infoBlock.MARChannelID = MARChannelID;
+ infoBlock.productVersion = productVersion;
+- return mar_create(argv[2], argc - 3, argv + 3, &infoBlock);
++ return mar_create(argv[2], numfiles, files, &infoBlock);
+ }
+ case 'i': {
+ if (!productVersion) {
--- onlineupdate/source/service/serviceinstall.cpp
+++ onlineupdate/source/service/serviceinstall.cpp
@@ -25,7 +25,7 @@
@@ -130,3 +223,43 @@
LOG_WARN(("Install directory updater could not be determined."));
result = FALSE;
}
+--- tools/update-packaging/make_full_update.sh
++++ tools/update-packaging/make_full_update.sh
+@@ -53,9 +53,10 @@
+ fi
+ workdir="$targetdir.work"
+ updatemanifestv3="$workdir/updatev3.manifest"
+-targetfiles="updatev3.manifest"
+
+ mkdir -p "$workdir"
++
++printf 'updatev3.manifest\n' >"$workdir/files.txt"
+
+ # Generate a list of all files in the target directory.
+ pushd "$targetdir"
+@@ -66,7 +67,6 @@
+ if [ ! -f "precomplete" ]; then
+ if [ ! -f "Contents/Resources/precomplete" ]; then
+ notice "precomplete file is missing!"
+- exit 1
+ fi
+ fi
+
+@@ -99,7 +99,7 @@
+ $XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force --stdout "$targetdir/$f" > "$workdir/$f"
+ copy_perm "$targetdir/$f" "$workdir/$f"
+
+- targetfiles="$targetfiles \"$f\""
++ printf '%s\n' "$f" >>"$workdir/files.txt"
+ done
+
+ # Append remove instructions for any dead files.
+@@ -110,7 +110,7 @@
+ $XZ $XZ_OPT --compress $BCJ_OPTIONS --lzma2 --format=xz --check=crc64 --force "$updatemanifestv3" && mv -f "$updatemanifestv3.xz" "$updatemanifestv3"
+
+ mar_command="$mar_command -C \"$workdir\" -c output.mar"
+-eval "$mar_command $targetfiles"
++eval "$mar_command -f $workdir/files.txt"
+ mv -f "$workdir/output.mar" "$archive"
+
+ # cleanup