[Libreoffice-commits] core.git: 4 commits - bin/gbuild-to-ideNS onlineupdate/qa onlineupdate/README onlineupdate/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Jun 11 01:58:53 UTC 2017


 bin/gbuild-to-ideNS                            |    2 -
 onlineupdate/README                            |   11 ++++++++
 onlineupdate/qa/updater/Makefile               |   14 ++++++++++
 onlineupdate/qa/updater/README                 |    1 
 onlineupdate/qa/updater/updater.zip            |binary
 onlineupdate/source/update/updater/updater.cxx |   32 ++++++++++++++-----------
 6 files changed, 46 insertions(+), 14 deletions(-)

New commits:
commit 62a8ad385fe5644583a465debcc42db917afed56
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jun 11 03:47:24 2017 +0200

    add a way to manually test the automatic updater with a simple test project
    
    This reduced my development iterations from around 15 minutes to a few seconds.
    
    Change-Id: I758a3e534862e8feca2544ee9e80f0330d06b992

diff --git a/onlineupdate/qa/updater/Makefile b/onlineupdate/qa/updater/Makefile
new file mode 100644
index 000000000000..5b240c356d01
--- /dev/null
+++ b/onlineupdate/qa/updater/Makefile
@@ -0,0 +1,14 @@
+gb_Side := host
+include ../../../config_host.mk
+
+unpack:
+	@echo "Unpacking the updater test project"
+	@rm -r $(WORKDIR)/updater || true
+	@unzip updater.zip -d $(WORKDIR) > /dev/null
+
+call: unpack
+	@echo "Update the test project"
+	@$(INSTDIR)/program/updater $(WORKDIR)/updater/user/patch $(WORKDIR)/updater $(WORKDIR)/updater/user/update /replace
+
+call-gdb: unpack
+	gdb --args $(INSTDIR)/program/updater $(WORKDIR)/updater/user/patch $(WORKDIR)/updater $(WORKDIR)/updater/user/update /replace
diff --git a/onlineupdate/qa/updater/README b/onlineupdate/qa/updater/README
new file mode 100644
index 000000000000..dab8d8a753db
--- /dev/null
+++ b/onlineupdate/qa/updater/README
@@ -0,0 +1 @@
+After calling 'make call' the content in workdir/updater/program/datei.txt should say "new".
diff --git a/onlineupdate/qa/updater/updater.zip b/onlineupdate/qa/updater/updater.zip
new file mode 100644
index 000000000000..79b8f8ec78ec
Binary files /dev/null and b/onlineupdate/qa/updater/updater.zip differ
commit bad96903a39ab37a1feee483e98ac16560b94d2b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jun 11 03:46:04 2017 +0200

    fix automatic updates with user profile in installation dir
    
    Change-Id: Ice8b73b1e80ce48e14be854b29b55c037b34f981

diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx
index f1800448087f..629e19e33c0c 100644
--- a/onlineupdate/source/update/updater/updater.cxx
+++ b/onlineupdate/source/update/updater/updater.cxx
@@ -2360,16 +2360,6 @@ ProcessReplaceRequest()
     NS_tsnprintf(tmpDir, sizeof(tmpDir)/sizeof(tmpDir[0]),
                  NS_T("%s.bak"), destDir);
 
-    NS_tchar newDir[MAXPATHLEN];
-    NS_tsnprintf(newDir, sizeof(newDir)/sizeof(newDir[0]),
-#ifdef MACOSX
-                 NS_T("%s/Contents"),
-                 gWorkingDirPath);
-#else
-                 NS_T("%s"),
-                 gWorkingDirPath);
-#endif
-
     // First try to remove the possibly existing temp directory, because if this
     // directory exists, we will fail to rename destDir.
     // No need to error check here because if this fails, we will fail in the
@@ -2378,6 +2368,7 @@ ProcessReplaceRequest()
 
     LOG(("Begin moving destDir (" LOG_S ") to tmpDir (" LOG_S ")",
          destDir, tmpDir));
+    LogFlush();
     int rv = rename_file(destDir, tmpDir, true);
 #ifdef _WIN32
     // On Windows, if Firefox is launched using the shortcut, it will hold a handle
@@ -2405,6 +2396,21 @@ ProcessReplaceRequest()
         return rv;
     }
 
+    NS_tchar newDir[MAXPATHLEN];
+    if (is_userprofile_in_instdir())
+    {
+        LOG(("user profile in instdir"));
+        NS_tstrcpy(newDir, tmpDir);
+        NS_tstrcat(newDir, gWorkingDirPath + NS_tstrlen(gInstallDirPath));
+        LOG((LOG_S, newDir));
+    }
+    else
+    {
+        NS_tsnprintf(newDir, sizeof(newDir)/sizeof(newDir[0]),
+                NS_T("%s"),
+                gWorkingDirPath);
+    }
+
     LOG(("Begin moving newDir (" LOG_S ") to destDir (" LOG_S ")",
          newDir, destDir));
     rv = rename_file(newDir, destDir, true);
@@ -2440,21 +2446,21 @@ ProcessReplaceRequest()
         NS_tchar userprofile[MAXPATHLEN];
 
         NS_tstrcpy(userprofile, gPatchDirPath);
-        NS_tchar *slash = (NS_tchar *) NS_tstrrchr(userprofile, NS_T('/'));
+        NS_tchar* slash = (NS_tchar *) NS_tstrrchr(userprofile, NS_T('/'));
         if (slash)
             *slash = NS_T('\0');
         NS_tstrcpy(backup_user_profile, tmpDir);
         size_t installdir_len = NS_tstrlen(destDir);
 
         NS_tstrcat(backup_user_profile, userprofile + installdir_len);
-        if (slash)
-            *slash = NS_T('/');
         LOG(("copy user profile back from " LOG_S " to " LOG_S, backup_user_profile, userprofile));
         int rv2 = rename_file(backup_user_profile, userprofile);
         if (rv2)
         {
             LOG(("failed to copy user profile back"));
         }
+        if (slash)
+            *slash = NS_T('/');
     }
 
 #if !defined(_WIN32) && !defined(MACOSX)
commit 38b3fb2a9354989db1fa8909bae163b282066f69
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jun 11 02:01:19 2017 +0200

    start adding my local documentation to the onlineupdate README
    
    This is still quite confusing as I'm still confused myself with the user profile in the installation directory.
    
    Change-Id: I77f56918d51069ec6c6967339e7e03de4f1a7e4a

diff --git a/onlineupdate/README b/onlineupdate/README
index e609bbbd6dd1..4009a3acb72b 100644
--- a/onlineupdate/README
+++ b/onlineupdate/README
@@ -10,3 +10,14 @@ The source/service directory contains the code for the silent windows updater th
 
 == NOTE ==
 The updater executable should not depend on any other dynamic library in the LibreOffice installation as we would need to copy that one also to a temporary directory during update. We can't update any library or executable that is currently in use. For the updater executable we solve this problem by copying the updater before using it to a temporary directory.
+
+== Update procedure ==
+
+The updater executable is run two times. In a first run, the current installation is copied to a "update" directory and the update is applied in this "update" directory. During the next run, a replacement request is executed. The replacement request removes the old installation directoy and replaces it with the content of the "update" directory.
+
+=== User profile in the installation directory ===
+
+The archive based installations have the user profile by default inside of the installation directory. During the update process this causes some problems that need special handling in the updater.
+
+* The "update" directory is inside of the user profile resulting in recursive copying.
+* During the replacement request the updater log is in the user profile, which changes location from the actual location to a backup location.
commit efa3ef666f1bc25602e5bee1d75ceb7d545dd5aa
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jun 11 00:15:37 2017 +0200

    support executables in vim-ide-integration
    
    Change-Id: Ib8827ff7ae00477269c7b47ec75ebdb41595d672

diff --git a/bin/gbuild-to-ideNS b/bin/gbuild-to-ideNS
index 703e539e61aa..128d5d5180ef 100755
--- a/bin/gbuild-to-ideNS
+++ b/bin/gbuild-to-ideNS
@@ -341,7 +341,7 @@ class VimIntegrationGenerator(IdeIntegrationGenerator):
 
     def emit(self):
         global_list = []
-        for lib in set(self.gbuildparser.libs) | set(self.gbuildparser.tests):
+        for lib in set(self.gbuildparser.libs) | set(self.gbuildparser.tests) | set(self.gbuildparser.exes):
             entries = []
             for file in lib.cxxobjects:
                 filePath = os.path.join(self.gbuildparser.srcdir, file) + ".cxx"


More information about the Libreoffice-commits mailing list