[Libreoffice-commits] .: Branch 'libreoffice-4-0' - 2 commits - desktop/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Dec 5 03:07:12 PST 2012


 desktop/source/app/app.cxx                                    |  108 +++-------
 desktop/source/deployment/registry/component/dp_component.cxx |    7 
 2 files changed, 41 insertions(+), 74 deletions(-)

New commits:
commit 70f7e60db6deaa5ce2bd73c052b2c0b18829dcf0
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Dec 5 11:46:45 2012 +0100

    Move flag file extensions/bundled/buildid -> extensions/buildid
    
    ...it does not only control bundled extensions.
    
    Change-Id: Idc4c9d3c6788fc77e90aa2478d50f2b0151a1238
    (cherry picked from commit 40d413ee4c88d4c2b68e0c373c6657f000705285)

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index ecfd32e..7177e49 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -206,9 +206,9 @@ void removeTree(OUString const & url) {
 // com.sun.star.comp.deployment.component.PackageRegistryBackend/*.rdb files
 // contained data nevertheless.
 //
-// When a LO upgrade is detected (i.e., no user/extensions/bundled/buildid or
-// one containing an old build ID), then user/extensions/bundled,
-// user/extensions/shared, and user/uno_packages/cache/registry/
+// When a LO upgrade is detected (i.e., no user/extensions/buildid or one
+// containing an old build ID), then user/extensions and
+// user/uno_packages/cache/registry/
 // com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc are
 // removed.  That should prevent any problems starting the service manager due
 // to old junk.  Later on in Desktop::SynchronizeExtensionRepositories, the
@@ -228,8 +228,7 @@ bool cleanExtensionCache() {
         "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("bootstrap")
         ":UserInstallation}/user/extensions");
     rtl::Bootstrap::expandMacros(extDir); //TODO: detect failure
-    OUString bundledDir = extDir + "/bundled";
-    OUString buildIdFile(bundledDir + "/buildid");
+    OUString buildIdFile(extDir + "/buildid");
     osl::File fr(buildIdFile);
     osl::FileBase::RC rc = fr.open(osl_File_OpenFlag_Read);
     switch (rc) {
@@ -274,10 +273,10 @@ bool cleanExtensionCache() {
     SAL_WARN_IF(
         rc != osl::FileBase::E_None && rc != osl::FileBase::E_NOENT, "desktop",
         "cannot remove file " << userRcFile << ": " << +rc);
-    rc = osl::Directory::createPath(bundledDir);
+    rc = osl::Directory::createPath(extDir);
     SAL_WARN_IF(
         rc != osl::FileBase::E_None && rc != osl::FileBase::E_EXIST, "desktop",
-        "cannot create path " << bundledDir << ": " << +rc);
+        "cannot create path " << extDir << ": " << +rc);
     osl::File fw(buildIdFile);
     rc = fw.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
     if (rc != osl::FileBase::E_None) {
commit f09bfb309a9add55da9be4a0cbc4c46160450da1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed Dec 5 11:27:47 2012 +0100

    Remove hack for LO 3.6.x downgrading to preregistered bundled extensions again
    
    With LO 4 using its own user profile, the problem of sharing a user profile
    between LO versions that do and do not use preregistration of bundled extensions
    can no longer happen, and so e9631f40ee49a244b6c6816e5cfb36814b9bafba
    "fdo#53006: And detect LO downgrading scenarios..." can be reverted again.
    
    Change-Id: I515077340823b8b277ffb6758b0d6a3cf8bfd0d5
    (cherry picked from commit 0b4ba827060757ee0ce23030bc8e25b5ddb9581f)

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0f06929..ecfd32e 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -214,19 +214,6 @@ void removeTree(OUString const & url) {
 // to old junk.  Later on in Desktop::SynchronizeExtensionRepositories, the
 // removed cache data is recreated.
 //
-// As a special case, if you create a UserInstallation with LO >= 3.6.1, then
-// run an old LO <= 3.5.x using share/prereg/bundled on the same
-// UserInstallation (so that it partially overwrites user/extensions/bundled,
-// potentially duplicating component information, but not touching
-// user/extensions/bundled/buildid), and then run the new LO >= 3.6.1 on the
-// same UserInstallation again, it can fail to start (due to the duplicated
-// component information).  Even though such downgrading scenarios at best work
-// by luck in general, the special token LIBO_NON_PREREG_BUNDLED_EXTENSIONS=TRUE
-// is used to detect and fix that problem:  The assumption is that if an old LO
-// <= 3.5.x messed with user/extensions/bundled in the meantime, then it would
-// have rewritten the unorc (dropping the token), and LO >= 3.6.1 can detect
-// that.
-//
 // Multiple instances of soffice.bin can execute this code in parallel for a
 // single UserInstallation, as it is called before OfficeIPCThread is set up.
 // Therefore, any errors here only lead to SAL_WARNs.
@@ -243,59 +230,47 @@ bool cleanExtensionCache() {
     rtl::Bootstrap::expandMacros(extDir); //TODO: detect failure
     OUString bundledDir = extDir + "/bundled";
     OUString buildIdFile(bundledDir + "/buildid");
-    OUString bundledRcFile(
-        "$BUNDLED_EXTENSIONS_USER/registry/"
-        "com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");
-    rtl::Bootstrap::expandMacros(bundledRcFile); //TODO: detect failure
-    rtl::Bootstrap bundledRc(bundledRcFile);
-    OUString nonPrereg;
-    if (bundledRc.getHandle() == 0
-        || (bundledRc.getFrom("LIBO_NON_PREREG_BUNDLED_EXTENSIONS", nonPrereg)
-            && nonPrereg == "TRUE"))
-    {
-        osl::File f(buildIdFile);
-        osl::FileBase::RC rc = f.open(osl_File_OpenFlag_Read);
-        switch (rc) {
-        case osl::FileBase::E_None:
-            {
-                rtl::ByteSequence s1;
-                rc = f.readLine(s1);
-                osl::FileBase::RC rc2 = f.close();
-                SAL_WARN_IF(
-                    rc2 != osl::FileBase::E_None, "desktop",
-                    "cannot close " << buildIdFile << " after reading: "
-                        << +rc2);
-                if (rc != osl::FileBase::E_None) {
-                    SAL_WARN(
-                        "desktop",
-                        "cannot read from " << buildIdFile << ": " << +rc);
-                    break;
-                }
-                OUString s2(
-                    reinterpret_cast< char const * >(s1.getConstArray()),
-                    s1.getLength(), RTL_TEXTENCODING_ISO_8859_1);
-                    // using ISO 8859-1 avoids any and all conversion errors;
-                    // the content should only be a subset of ASCII, anyway
-                if (s2 == buildId) {
-                    return false;
-                }
+    osl::File fr(buildIdFile);
+    osl::FileBase::RC rc = fr.open(osl_File_OpenFlag_Read);
+    switch (rc) {
+    case osl::FileBase::E_None:
+        {
+            rtl::ByteSequence s1;
+            rc = fr.readLine(s1);
+            osl::FileBase::RC rc2 = fr.close();
+            SAL_WARN_IF(
+                rc2 != osl::FileBase::E_None, "desktop",
+                "cannot close " << buildIdFile << " after reading: " << +rc2);
+            if (rc != osl::FileBase::E_None) {
+                SAL_WARN(
+                    "desktop",
+                    "cannot read from " << buildIdFile << ": " << +rc);
                 break;
             }
-        case osl::FileBase::E_NOENT:
-            break;
-        default:
-            SAL_WARN(
-                "desktop",
-                "cannot open " << buildIdFile << " for reading: " << +rc);
+            OUString s2(
+                reinterpret_cast< char const * >(s1.getConstArray()),
+                s1.getLength(), RTL_TEXTENCODING_ISO_8859_1);
+                // using ISO 8859-1 avoids any and all conversion errors; the
+                // content should only be a subset of ASCII, anyway
+            if (s2 == buildId) {
+                return false;
+            }
             break;
         }
+    case osl::FileBase::E_NOENT:
+        break;
+    default:
+        SAL_WARN(
+            "desktop",
+            "cannot open " << buildIdFile << " for reading: " << +rc);
+        break;
     }
     removeTree(extDir);
     OUString userRcFile(
         "$UNO_USER_PACKAGES_CACHE/registry/"
         "com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc");
     rtl::Bootstrap::expandMacros(userRcFile); //TODO: detect failure
-    osl::FileBase::RC rc = osl::File::remove(userRcFile);
+    rc = osl::File::remove(userRcFile);
     SAL_WARN_IF(
         rc != osl::FileBase::E_None && rc != osl::FileBase::E_NOENT, "desktop",
         "cannot remove file " << userRcFile << ": " << +rc);
@@ -303,8 +278,8 @@ bool cleanExtensionCache() {
     SAL_WARN_IF(
         rc != osl::FileBase::E_None && rc != osl::FileBase::E_EXIST, "desktop",
         "cannot create path " << bundledDir << ": " << +rc);
-    osl::File f(buildIdFile);
-    rc = f.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
+    osl::File fw(buildIdFile);
+    rc = fw.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create);
     if (rc != osl::FileBase::E_None) {
         SAL_WARN(
             "desktop",
@@ -316,13 +291,13 @@ bool cleanExtensionCache() {
         // containing single surrogate halves should never happen, anyway); the
         // content should only be a subset of ASCII, anyway
     sal_uInt64 n = 0;
-    rc = f.write(buf.getStr(), buf.getLength(), n);
+    rc = fw.write(buf.getStr(), buf.getLength(), n);
     SAL_WARN_IF(
         (rc != osl::FileBase::E_None
          || n != static_cast< sal_uInt32 >(buf.getLength())),
         "desktop",
         "cannot write to " << buildIdFile << ": " << +rc << ", " << n);
-    rc = f.close();
+    rc = fw.close();
     SAL_WARN_IF(
         rc != osl::FileBase::E_None, "desktop",
         "cannot close " << buildIdFile << " after writing: " << +rc);
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 7205a17..e974034 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -1009,13 +1009,6 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
         buf.append(LF);
     }
 
-    // See refreshBundledExtensionsDir (desktop/source/app/app.cxx):
-    if (m_eContext == CONTEXT_BUNDLED)
-    {
-        buf.append("LIBO_NON_PREREG_BUNDLED_EXTENSIONS=TRUE");
-        buf.append(LF);
-    }
-
     // write unorc:
     const Reference<io::XInputStream> xData(
         ::xmlscript::createInputStream(


More information about the Libreoffice-commits mailing list