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

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Jun 17 11:15:52 UTC 2017


 desktop/source/app/updater.cxx                  |   38 ++++++++++++++++++++++++
 onlineupdate/qa/lang_packs/update_en_signed.mar |binary
 onlineupdate/qa/lang_packs/update_signed.mar    |binary
 onlineupdate/qa/replace_request/Makefile        |   11 ++++--
 onlineupdate/qa/replace_request/updater.zip     |binary
 5 files changed, 45 insertions(+), 4 deletions(-)

New commits:
commit 76ed00f8db34490d5e21c72d142e11da510ac605
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 17 11:48:15 2017 +0200

    updater: detect when user can not write to installation directory
    
    In this case we can not update right now.
    
    Change-Id: I19cda5ddef448ff81e1ca457774b2db036038c88

diff --git a/desktop/source/app/updater.cxx b/desktop/source/app/updater.cxx
index 949ec186d1fe..468c94b4e74c 100644
--- a/desktop/source/app/updater.cxx
+++ b/desktop/source/app/updater.cxx
@@ -211,6 +211,35 @@ struct update_info
     std::vector<language_file> aLanguageFiles;
 };
 
+bool isUserWritable(const OUString& rFileURL)
+{
+    osl::FileStatus aStatus(osl_FileStatus_Mask_Attributes);
+    osl::DirectoryItem aDirectoryItem;
+
+    osl::FileBase::RC eRes = osl::DirectoryItem::get(rFileURL, aDirectoryItem);
+    if (eRes != osl::FileBase::E_None)
+    {
+        Updater::log("Could not get the directory item for: " + rFileURL);
+        return false;
+    }
+
+    osl::FileBase::RC eResult = aDirectoryItem.getFileStatus(aStatus);
+    if (eResult != osl::FileBase::E_None)
+    {
+        Updater::log("Could not get the file status for: " + rFileURL);
+        return false;
+    }
+
+    bool bReadOnly = (aStatus.getAttributes() & static_cast<sal_uInt64>(osl_File_Attribute_ReadOnly)) != 0;
+    if (bReadOnly)
+    {
+        Updater::log("Update location as determined by: " + rFileURL + " is read-only.");
+        return false;
+    }
+
+    return true;
+}
+
 }
 
 void update()
@@ -602,6 +631,15 @@ void download_file(const OUString& rURL, size_t nFileSize, const OUString& rHash
 
 void update_checker()
 {
+    OUString aBrandBaseDir("${BRAND_BASE_DIR}");
+    rtl::Bootstrap::expandMacros(aBrandBaseDir);
+    bool bUserWritable = isUserWritable(aBrandBaseDir);
+    if (!bUserWritable)
+    {
+        Updater::log("Can't update as the update location is not user writable");
+        return;
+    }
+
     OUString aDownloadCheckBaseURL = officecfg::Office::Update::Update::URL::get();
     static const char* pDownloadCheckBaseURLEnv = std::getenv("LIBO_UPDATER_URL");
     if (pDownloadCheckBaseURLEnv)
commit 44f75d653b972a581bb888868a0cb9f08f625974
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Jun 17 10:49:08 2017 +0200

    updater: move the data location for the replacement test
    
    Change-Id: I6b3bbe9dda2461ed83ef8b4e15179ad345c08bd4

diff --git a/onlineupdate/qa/replace_request/Makefile b/onlineupdate/qa/replace_request/Makefile
index 5b240c356d01..476e93213cca 100644
--- a/onlineupdate/qa/replace_request/Makefile
+++ b/onlineupdate/qa/replace_request/Makefile
@@ -1,14 +1,17 @@
 gb_Side := host
 include ../../../config_host.mk
 
+UPDATER_DIR := $(WORKDIR)/updater/replace_request
+
 unpack:
 	@echo "Unpacking the updater test project"
-	@rm -r $(WORKDIR)/updater || true
-	@unzip updater.zip -d $(WORKDIR) > /dev/null
+	@rm -r $(UPDATER_DIR) || true
+	@mkdir -p $(WORKDIR)/updater
+	@unzip updater.zip -d $(WORKDIR)/updater > /dev/null
 
 call: unpack
 	@echo "Update the test project"
-	@$(INSTDIR)/program/updater $(WORKDIR)/updater/user/patch $(WORKDIR)/updater $(WORKDIR)/updater/user/update /replace
+	@$(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update /replace
 
 call-gdb: unpack
-	gdb --args $(INSTDIR)/program/updater $(WORKDIR)/updater/user/patch $(WORKDIR)/updater $(WORKDIR)/updater/user/update /replace
+	gdb --args $(INSTDIR)/program/updater $(UPDATER_DIR)/user/patch $(UPDATER_DIR) $(UPDATER_DIR)/user/update /replace
diff --git a/onlineupdate/qa/replace_request/updater.zip b/onlineupdate/qa/replace_request/updater.zip
index 79b8f8ec78ec..dc5e26b0f258 100644
Binary files a/onlineupdate/qa/replace_request/updater.zip and b/onlineupdate/qa/replace_request/updater.zip differ
commit 0a0e569d514af571ad5d12959ceda58fa0f194a0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jun 16 21:29:44 2017 +0200

    updater: respect version info for manual tests
    
    Change-Id: Id9df2e685b7a7ff420bb7289089dc1e5c5f5c074

diff --git a/onlineupdate/qa/lang_packs/update_en_signed.mar b/onlineupdate/qa/lang_packs/update_en_signed.mar
index 89ce8731f433..b72d1c5df637 100644
Binary files a/onlineupdate/qa/lang_packs/update_en_signed.mar and b/onlineupdate/qa/lang_packs/update_en_signed.mar differ
diff --git a/onlineupdate/qa/lang_packs/update_signed.mar b/onlineupdate/qa/lang_packs/update_signed.mar
index 70ddd1ef0cbd..a145d6325c65 100644
Binary files a/onlineupdate/qa/lang_packs/update_signed.mar and b/onlineupdate/qa/lang_packs/update_signed.mar differ


More information about the Libreoffice-commits mailing list