[Libreoffice-commits] core.git: desktop/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Jun 24 09:00:05 UTC 2017


 desktop/source/app/app.cxx     |    5 +++--
 desktop/source/app/updater.cxx |   19 ++++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit a2636093643a57ddd5d235246a9736e3352f3bd3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jun 21 22:33:12 2017 +0200

    updater: add a way to manually test updater command line
    
    Without this hack it is not possible to debug the updater invocation easily.
    Each time this code will be called the updater would be executed and an update
    directory already present.
    
    Change-Id: I1159ee504b8f4ebf211e2a719369a48ae2e32345
    Reviewed-on: https://gerrit.libreoffice.org/39080
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index bbf8ccdd0e86..d50df34bc43c 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1465,7 +1465,8 @@ int Desktop::Main()
             return EXIT_FAILURE;
 
 #if HAVE_FEATURE_UPDATE_MAR
-        if (officecfg::Office::Update::Update::Enabled::get())
+        const char* pUpdaterTestReplace = std::getenv("LIBO_UPDATER_TEST_REPLACE");
+        if (pUpdaterTestReplace || officecfg::Office::Update::Update::Enabled::get())
         {
             // check if we just updated
             bool bUpdateRunning = officecfg::Office::Update::Update::UpdateRunning::get();
@@ -1507,7 +1508,7 @@ int Desktop::Main()
             osl::DirectoryItem aDirectoryItem;
             osl::DirectoryItem::get(Updater::getUpdateDirURL(), aDirectoryItem);
 
-            if (aPatchInfo.is() && aDirectoryItem.is())
+            if (pUpdaterTestReplace || (aPatchInfo.is() && aDirectoryItem.is()))
             {
                 OUString aBuildID("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("version") ":buildid}");
                 rtl::Bootstrap::expandMacros(aBuildID);
diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 9701691c1fb4..782bfef9079b 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -86,8 +86,6 @@ OUString normalizePath(const OUString& rPath)
         aPath = aTempPath.copy(0, i) + aPath.copy(nIndex + 3);
     }
 
-    SAL_DEBUG(aPath);
-
     return aPath;
 }
 
@@ -267,13 +265,24 @@ void update()
 
 
 #if UNX
-    if (execv(aPath.getStr(), pArgs))
+    const char* pUpdaterTestReplace = std::getenv("LIBO_UPDATER_TEST_REPLACE");
+    if (!pUpdaterTestReplace)
+    {
+        if (execv(aPath.getStr(), pArgs))
+        {
+            printf("execv failed with error %d %s\n",errno,strerror(errno));
+        }
+    }
+    else
     {
-        printf("execv failed with error %d %s\n",errno,strerror(errno));
+        for (size_t i = 0; i < 8 + rtl_getAppCommandArgCount(); ++i)
+        {
+            SAL_WARN("desktop.updater", pArgs[i]);
+        }
     }
 #endif
 
-    for (size_t i = 0; i < 8; ++i)
+    for (size_t i = 0; i < 8 + rtl_getAppCommandArgCount(); ++i)
     {
         delete[] pArgs[i];
     }


More information about the Libreoffice-commits mailing list