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

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Aug 2 05:33:35 UTC 2017


 desktop/source/app/app.cxx     |    8 +----
 desktop/source/app/updater.cxx |   62 ++---------------------------------------
 desktop/source/app/updater.hxx |    2 -
 3 files changed, 7 insertions(+), 65 deletions(-)

New commits:
commit c74fbd43362254bfaa1dd31069e40d23ceef9fa0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Aug 2 03:34:47 2017 +0200

    updater: switch to an one-step update
    
    Change-Id: I72af514ed0b3f83c8cc1fdfb8009ad523fc1a5a8
    Reviewed-on: https://gerrit.libreoffice.org/40655
    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 e0dd2a13b682..a8d066cd032f 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1424,13 +1424,11 @@ int Desktop::Main()
                 Updater::removeUpdateFiles();
             }
 
-            osl::DirectoryItem aPatchInfo;
-            osl::DirectoryItem::get(Updater::getUpdateInfoURL(), aPatchInfo);
-            osl::DirectoryItem aDirectoryItem;
-            osl::DirectoryItem::get(Updater::getUpdateDirURL(), aDirectoryItem);
+            osl::DirectoryItem aUpdateFile;
+            osl::DirectoryItem::get(Updater::getUpdateFileURL(), aUpdateFile);
 
             const char* pUpdaterTestUpdate = std::getenv("LIBO_UPDATER_TEST_UPDATE");
-            if (pUpdaterTestUpdate || (aPatchInfo.is() && aDirectoryItem.is()))
+            if (pUpdaterTestUpdate || aUpdateFile.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 5e596fc352fe..ef4dcd29d122 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -136,8 +136,7 @@ void createStr(const OUString& rStr, char** pArgs, size_t i)
 
 char** createCommandLine()
 {
-    OUString aInstallDir( "$BRAND_BASE_DIR/" );
-    rtl::Bootstrap::expandMacros(aInstallDir);
+    OUString aInstallDir = Updater::getInstallationPath();
 
     size_t nCommandLineArgs = rtl_getAppCommandArgCount();
     size_t nArgs = 8 + nCommandLineArgs;
@@ -161,13 +160,11 @@ char** createCommandLine()
     }
     {
         // the temporary updated build
-        OUString aUpdateDirURL = Updater::getUpdateDirURL();
-        OUString aWorkingDir = getPathFromURL(aUpdateDirURL);
-        Updater::log("Working Dir: " + aWorkingDir);
-        createStr(aWorkingDir, pArgs, 3);
+        Updater::log("Working Dir: " + aInstallDir);
+        createStr(aInstallDir, pArgs, 3);
     }
     {
-        const char* pPID = "/replace";
+        const char* pPID = "0";
         createStr(pPID, pArgs, 4);
     }
     {
@@ -289,39 +286,6 @@ void update()
     delete[] pArgs;
 }
 
-void CreateValidUpdateDir(const update_info& update_info)
-{
-    Updater::log(OString("Create Update Dir"));
-    OUString aInstallDir("$BRAND_BASE_DIR");
-    rtl::Bootstrap::expandMacros(aInstallDir);
-    OUString aInstallPath = getPathFromURL(aInstallDir);
-    OUString aWorkdirPath = getPathFromURL(Updater::getUpdateDirURL());
-
-    OUString aPatchDir = getPathFromURL(Updater::getPatchDirURL());
-
-    OUString aUpdaterPath = getPathFromURL(Updater::getExecutableDirURL() + OUString::fromUtf8(pUpdaterName));
-
-    OUString aCommand = aUpdaterPath + " " + aPatchDir + " " + aInstallPath + " " + aWorkdirPath + " -1";
-
-    OString aOCommand = OUStringToOString(aCommand, RTL_TEXTENCODING_UTF8);
-
-    int nResult = std::system(aOCommand.getStr());
-    if (nResult)
-    {
-        // TODO: remove the update directory
-        SAL_WARN("desktop.updater", "failed to update");
-        Updater::log(OUString("failed to create update dir"));
-    }
-    else
-    {
-        OUString aUpdateInfoURL(Updater::getPatchDirURL() + "/update.info");
-        OUString aUpdateInfoPath = getPathFromURL(aUpdateInfoURL);
-        SvFileStream aUpdateInfoFile(aUpdateInfoPath, StreamMode::WRITE | StreamMode::TRUNC);
-        aUpdateInfoFile.WriteCharPtr("[UpdateInfo]\nOldBuildId=");
-        aUpdateInfoFile.WriteByteStringLine(update_info.aFromBuildID, RTL_TEXTENCODING_UTF8);
-    }
-}
-
 namespace {
 
 // Callback to get the response data from server.
@@ -712,7 +676,6 @@ void update_checker()
                         download_file(lang_update.aUpdateFile.aURL, lang_update.aUpdateFile.nSize, lang_update.aUpdateFile.aHash, aFileName);
                     }
                 }
-                CreateValidUpdateDir(aUpdateInfo);
                 OUString aSeeAlsoURL = aUpdateInfo.aSeeAlsoURL;
                 std::shared_ptr< comphelper::ConfigurationChanges > batch(
                         comphelper::ConfigurationChanges::create());
@@ -748,14 +711,6 @@ void update_checker()
     }
 }
 
-OUString Updater::getUpdateInfoURL()
-{
-    OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/update.info");
-    rtl::Bootstrap::expandMacros(aUpdateInfoURL);
-
-    return aUpdateInfoURL;
-}
-
 OUString Updater::getUpdateInfoLog()
 {
     OUString aUpdateInfoURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/patch/updating.log");
@@ -772,15 +727,6 @@ OUString Updater::getPatchDirURL()
     return aPatchDirURL;
 }
 
-OUString Updater::getUpdateDirURL()
-{
-    OUString aUpdateDirURL("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/update_dir/");
-    rtl::Bootstrap::expandMacros(aUpdateDirURL);
-
-    return aUpdateDirURL;
-}
-
-
 OUString Updater::getUpdateFileURL()
 {
     return getPatchDirURL() + "update.mar";
diff --git a/desktop/source/app/updater.hxx b/desktop/source/app/updater.hxx
index 5d3d0c2cd98d..4c01129f9697 100644
--- a/desktop/source/app/updater.hxx
+++ b/desktop/source/app/updater.hxx
@@ -22,10 +22,8 @@ private:
 
 public:
 
-    static OUString getUpdateInfoURL();
     static OUString getUpdateInfoLog();
     static OUString getPatchDirURL();
-    static OUString getUpdateDirURL();
     static OUString getUpdateFileURL();
     static OUString getExecutableDirURL();
     static OUString getInstallationPath();


More information about the Libreoffice-commits mailing list