[Libreoffice-commits] .: 2 commits - configmgr/source sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_macros_test.mk scp2/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Mon Oct 31 08:53:24 PDT 2011


 configmgr/source/components.cxx     |  213 +++++++++++++++++++-----------------
 configmgr/source/components.hxx     |    7 -
 sc/CppunitTest_sc_filters_test.mk   |    3 
 sc/CppunitTest_sc_macros_test.mk    |    4 
 scp2/source/ooo/common_brand.scp    |   12 ++
 scp2/source/ooo/profileitem_ooo.scp |   61 ----------
 6 files changed, 135 insertions(+), 165 deletions(-)

New commits:
commit a334403eb22f3d812549b5ce9b390fecdee9be31
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 31 16:51:35 2011 +0100

    Cleaned up configmgr initialization.
    
    Added CONFIGURATION_LAYERS bootstrap variable.
    Removed OOO_CONFIG_REGISTRY[_EXTRA]_DIR bootstrap variables.

diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index 3724b16..456bdfc 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -304,12 +304,12 @@ bool Components::hasModifications() const
 
 void Components::writeModifications() {
 
-    if (!hasModifications())
+    if (!hasModifications() || modificationFileUrl_.isEmpty())
         return;
 
     if (!writeThread_.is()) {
         writeThread_ = new WriteThread(
-            &writeThread_, *this, getModificationFileUrl(), data_);
+            &writeThread_, *this, modificationFileUrl_, data_);
         writeThread_->create();
     }
 }
@@ -329,8 +329,9 @@ void Components::flushModifications() {
 void Components::insertExtensionXcsFile(
     bool shared, rtl::OUString const & fileUri)
 {
+    int layer = getExtensionLayer(shared);
     try {
-        parseXcsFile(fileUri, shared ? 9 : 13, data_, 0, 0, 0);
+        parseXcsFile(fileUri, layer, data_, 0, 0, 0);
     } catch (css::container::NoSuchElementException & e) {
         throw css::uno::RuntimeException(
             (rtl::OUString(
@@ -345,7 +346,7 @@ void Components::insertExtensionXcuFile(
     bool shared, rtl::OUString const & fileUri, Modifications * modifications)
 {
     OSL_ASSERT(modifications != 0);
-    int layer = shared ? 10 : 14;
+    int layer = getExtensionLayer(shared) + 1;
     Additions * adds = data_.addExtensionXcuAdditions(fileUri, layer);
     try {
         parseXcuFile(fileUri, layer, data_, 0, modifications, adds);
@@ -506,96 +507,108 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue(
 
 Components::Components(
     css::uno::Reference< css::uno::XComponentContext > const & context):
-    context_(context)
+    context_(context), sharedExtensionLayer_(-1), userExtensionLayer_(-1)
 {
-    lock_ = lock();
-
     OSL_ASSERT(context.is());
-
-    // Check if we are being used for in-tree unit tests ...
-    rtl::OUString aUnitTestDir;
-    if (rtl::Bootstrap::get( rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM("OOO_CONFIG_REGISTRY_DIR") ), aUnitTestDir))
-    {
-        parseXcsXcuLayer( 0, aUnitTestDir );
-        // next is required for the (somewhat strange) filter configuration
-        parseModuleLayer( 2, aUnitTestDir + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/spool")));
-        // allow a directory to be specified to allow extra configuration to be stored
-        // for example to place a registrymodifications.xcu to override some configuration
-        rtl::OUString extra;
-        if (rtl::Bootstrap::get(
+    lock_ = lock();
+    rtl::OUString conf(
+        expand(
+            rtl::OUString(
+                RTL_CONSTASCII_USTRINGPARAM("${CONFIGURATION_LAYERS}"))));
+    RTL_LOGFILE_TRACE("configmgr : begin parsing");
+    int layer = 0;
+    for (sal_Int32 i = 0;;) {
+        while (i != conf.getLength() && conf[i] == ' ') {
+            ++i;
+        }
+        if (i == conf.getLength()) {
+            break;
+        }
+        if (!modificationFileUrl_.isEmpty()) {
+            throw css::uno::RuntimeException(
                 rtl::OUString(
                     RTL_CONSTASCII_USTRINGPARAM(
-                        "OOO_CONFIG_REGISTRY_EXTRA_DIR")),
-                extra))
+                        "CONFIGURATION_LAYERS: \"user\" followed by further"
+                        " layers")),
+                css::uno::Reference< css::uno::XInterface >());
+        }
+        sal_Int32 c = i;
+        for (;; ++c) {
+            if (c == conf.getLength() || conf[c] == ' ') {
+                throw css::uno::RuntimeException(
+                    rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM(
+                            "CONFIGURATION_LAYERS: missing \":\"")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            if (conf[c] == ':') {
+                break;
+            }
+        }
+        sal_Int32 n = conf.indexOf(' ', c + 1);
+        if (n == -1) {
+            n = conf.getLength();
+        }
+        rtl::OUString type(conf.copy(i, c - i));
+        rtl::OUString url(expand(conf.copy(c + 1, n - c - 1)));
+        if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("xcsxcu"))) {
+            parseXcsXcuLayer(layer, url);
+            layer += 2; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("bundledext")))
         {
-            parseXcsXcuLayer(3, extra);
+            parseXcsXcuIniLayer(layer, url, false);
+            layer += 2; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("sharedext"))) {
+            if (sharedExtensionLayer_ != -1) {
+                throw css::uno::RuntimeException(
+                    rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM(
+                            "CONFIGURATION_LAYERS: multiple \"sharedext\""
+                            " layers")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            sharedExtensionLayer_ = layer;
+            parseXcsXcuIniLayer(layer, url, true);
+            layer += 2; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("userext"))) {
+            if (userExtensionLayer_ != -1) {
+                throw css::uno::RuntimeException(
+                    rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM(
+                            "CONFIGURATION_LAYERS: multiple \"userext\""
+                            " layers")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            userExtensionLayer_ = layer;
+            parseXcsXcuIniLayer(layer, url, true);
+            layer += 2; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("module"))) {
+            parseModuleLayer(layer, url);
+            ++layer; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("res"))) {
+            parseResLayer(layer, url);
+            ++layer; //TODO: overflow
+        } else if (type.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("user"))) {
+            if (url.isEmpty()) {
+                throw css::uno::RuntimeException(
+                    rtl::OUString(
+                        RTL_CONSTASCII_USTRINGPARAM(
+                            "CONFIGURATION_LAYERS: empty \"user\" URL")),
+                    css::uno::Reference< css::uno::XInterface >());
+            }
+            modificationFileUrl_ = url;
+            parseModificationLayer(url);
+        } else {
+            throw css::uno::RuntimeException(
+                (rtl::OUString(
+                    RTL_CONSTASCII_USTRINGPARAM(
+                        "CONFIGURATION_LAYERS: unknown layer type \"")) +
+                 type +
+                 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\""))),
+                css::uno::Reference< css::uno::XInterface >());
         }
-        return;
+        i = n;
     }
-
-    RTL_LOGFILE_TRACE("configmgr : begin parsing");
-
-    parseXcsXcuLayer(
-        0,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "$BRAND_BASE_DIR/share/registry"))));
-    parseModuleLayer(
-        2,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "$BRAND_BASE_DIR/share/registry/modules"))));
-    parseResLayer(
-        3,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "$BRAND_BASE_DIR/share/registry"))));
-    parseXcsXcuIniLayer(
-        4,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("uno")
-                    ":BUNDLED_EXTENSIONS_USER}/registry/"
-                    "com.sun.star.comp.deployment.configuration."
-                    "PackageRegistryBackend/configmgr.ini"))),
-        false);
-    parseXcsXcuIniLayer(
-        6,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("uno")
-                    ":SHARED_EXTENSIONS_USER}/registry/"
-                    "com.sun.star.comp.deployment.configuration."
-                    "PackageRegistryBackend/configmgr.ini"))),
-        true);
-    parseXcsXcuLayer(
-        8,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("uno")
-                    ":UNO_USER_PACKAGES_CACHE}/registry/"
-                    "com.sun.star.comp.deployment.configuration."
-                    "PackageRegistryBackend/registry"))));
-        // can be dropped once old UserInstallation format can no longer exist
-        // (probably OOo 4)
-    parseXcsXcuIniLayer(
-        10,
-        expand(
-            rtl::OUString(
-                RTL_CONSTASCII_USTRINGPARAM(
-                    "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("uno")
-                    ":UNO_USER_PACKAGES_CACHE}/registry/"
-                    "com.sun.star.comp.deployment.configuration."
-                    "PackageRegistryBackend/configmgr.ini"))),
-        true);
-    parseModificationLayer();
     RTL_LOGFILE_TRACE("configmgr : end parsing");
 }
 
@@ -858,19 +871,9 @@ void Components::parseResLayer(int layer, rtl::OUString const & url) {
         &parseXcuFile, resUrl, false);
 }
 
-rtl::OUString Components::getModificationFileUrl() const {
-    return expand(
-        rtl::OUString(
-            RTL_CONSTASCII_USTRINGPARAM(
-                "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("bootstrap")
-                ":UserInstallation}/user/registrymodifications.xcu")));
-}
-
-void Components::parseModificationLayer() {
+void Components::parseModificationLayer(rtl::OUString const & url) {
     try {
-        parseFileLeniently(
-            &parseXcuFile, getModificationFileUrl(), Data::NO_LAYER, data_, 0,
-            0, 0);
+        parseFileLeniently(&parseXcuFile, url, Data::NO_LAYER, data_, 0, 0, 0);
     } catch (css::container::NoSuchElementException &) {
         OSL_TRACE(
             "configmgr user registrymodifications.xcu does not (yet) exist");
@@ -889,6 +892,18 @@ void Components::parseModificationLayer() {
     }
 }
 
+int Components::getExtensionLayer(bool shared) {
+    int layer = shared ? sharedExtensionLayer_ : userExtensionLayer_;
+    if (layer == -1) {
+        throw css::uno::RuntimeException(
+            rtl::OUString(
+                RTL_CONSTASCII_USTRINGPARAM(
+                    "insert extension xcs/xcu file into undefined layer")),
+            css::uno::Reference< css::uno::XInterface >());
+    }
+    return layer;
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx
index 26af3fb..bc4c5d0 100644
--- a/configmgr/source/components.hxx
+++ b/configmgr/source/components.hxx
@@ -155,9 +155,9 @@ private:
 
     void parseResLayer(int layer, rtl::OUString const & url);
 
-    rtl::OUString getModificationFileUrl() const;
+    void parseModificationLayer(rtl::OUString const & url);
 
-    void parseModificationLayer();
+    int getExtensionLayer(bool shared);
 
     typedef std::set< RootAccess * > WeakRootSet;
 
@@ -176,6 +176,9 @@ private:
     WeakRootSet roots_;
     ExternalServices externalServices_;
     rtl::Reference< WriteThread > writeThread_;
+    int sharedExtensionLayer_;
+    int userExtensionLayer_;
+    rtl::OUString modificationFileUrl_;
     boost::shared_ptr<osl::Mutex> lock_;
 };
 
diff --git a/sc/CppunitTest_sc_filters_test.mk b/sc/CppunitTest_sc_filters_test.mk
index e40ae2e..3260d32 100644
--- a/sc/CppunitTest_sc_filters_test.mk
+++ b/sc/CppunitTest_sc_filters_test.mk
@@ -99,8 +99,9 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,sc_filters_test,\
 $(eval $(call gb_CppunitTest_set_args,sc_filters_test,\
     --headless \
     --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
-    -env:OOO_CONFIG_REGISTRY_DIR=$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) \
+    "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool)" \
 ))
+    # .../spool is required for the (somewhat strange) filter configuration
 
 # we need to
 # a) explicitly depend on library msword because it is not implied by a link
diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk
index 0da6348..5d39769 100644
--- a/sc/CppunitTest_sc_macros_test.mk
+++ b/sc/CppunitTest_sc_macros_test.mk
@@ -99,9 +99,9 @@ $(eval $(call gb_CppunitTest_add_service_rdbs,sc_macros_test,\
 $(eval $(call gb_CppunitTest_set_args,sc_macros_test,\
     --headless \
     --protector unoexceptionprotector$(gb_Library_DLLEXT) unoexceptionprotector \
-    -env:OOO_CONFIG_REGISTRY_DIR=$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) \
-    -env:OOO_CONFIG_REGISTRY_EXTRA_DIR=$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/user) \
+    "-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry) module:$(call gb_CppunitTarget__make_url,$(OUTDIR)/xml/registry/spool) xcsxcu:$(call gb_CppunitTarget__make_url,$(OUTDIR)/unittest/user)" \
 ))
+    # .../spool is required for the (somewhat strange) filter configuration
 
 # we need to
 # a) explicitly depend on library msword because it is not implied by a link
diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp
index 01d0cec..d9baffa 100644
--- a/scp2/source/ooo/common_brand.scp
+++ b/scp2/source/ooo/common_brand.scp
@@ -927,6 +927,18 @@ ProfileItem gid_Brand_Profileitem_Soffice_Startlang
 End
 #endif
 
+ProfileItem gid_Brand_Profileitem_Soffice_ConfigurationLayers
+    ProfileID = gid_Brand_Profile_Soffice_Ini;
+    ModuleID = gid_Module_Root_Brand;
+    Section = "Bootstrap";
+    Key = "CONFIGURATION_LAYERS";
+    Value = "xcsxcu:${BRAND_BASE_DIR}/share/registry module:${BRAND_BASE_DIR}/share/registry/modules res:${BRAND_BASE_DIR}/share/registry bundledext:${${BRAND_BASE_DIR}/program/" PROFILENAME(uno) ":BUNDLED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini sharedext:${${BRAND_BASE_DIR}/program/" PROFILENAME(uno) ":SHARED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini xcsxcu:${${BRAND_BASE_DIR}/program/" PROFILENAME(uno) ":UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/registry userext:${${BRAND_BASE_DIR}/program/" PROFILENAME(uno) ":UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini user:${$BRAND_BASE_DIR/program/" PROFILENAME(bootstrap) ":UserInstallation}/user/registrymodifications.xcu";
+        // "xcsxcu:${${BRAND_BASE_DIR}/program/"PROFILENAME(uno)
+        // ":UNO_USER_PACKAGES_CACHE}/registry/com.sun.star.comp.deployment."
+        // "configuration.PackageRegistryBackend/registry" can be dropped once
+        // old UserInstallation format can no longer exist (probably OOo 4)
+End
+
 ProfileItem gid_Brand_Profileitem_Version_Buildid
     ProfileID = gid_Brand_Profile_Version_Ini;
     ModuleID = gid_Module_Root_Brand;
commit 983360d3bed84981650adfb30e2759bf6fa30e61
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Oct 31 16:49:56 2011 +0100

    Removed obsolete gid_Profile_Soffice_Ini items.
    
    They have been duplicated to gid_Brand_Profile_Soffice_Ini a long
    time ago.

diff --git a/scp2/source/ooo/profileitem_ooo.scp b/scp2/source/ooo/profileitem_ooo.scp
index 10ab481..3fd83da 100644
--- a/scp2/source/ooo/profileitem_ooo.scp
+++ b/scp2/source/ooo/profileitem_ooo.scp
@@ -103,67 +103,6 @@ End
 
 #endif
 
-ProfileItem gid_Profileitem_Soffice_Logo
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 1;
-    Key = "Logo";
-    Value = "1";
-End
-
-ProfileItem gid_Profileitem_Soffice_ProgressBarColor
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 2;
-    Key = "ProgressBarColor";
-    Value = "0,0,128";
-End
-
-ProfileItem gid_Profileitem_Soffice_ProgressSize
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 3;
-    Key = "ProgressSize";
-    Value = "-1,6";
-End
-
-ProfileItem gid_Profileitem_Soffice_ProgressPosition
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 4;
-    Key = "ProgressPosition";
-    Value = "-1,-1";
-End
-
-ProfileItem gid_Profileitem_Soffice_NativeProgress
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 6;
-    Key = "NativeProgress";
-    Value = "true";
-End
-
-#ifdef WNT
-
-ProfileItem gid_Profileitem_Soffice_Hideeula
-    ProfileID = gid_Profile_Soffice_Ini;
-    ModuleID = gid_Module_Root;
-    Section = "Bootstrap";
-    Order = 8;
-    Key = "HideEula";
-    Value = "[HIDEEULA]";
-    Inifiletablekey = "HideEula";
-    Inifiletableaction = "1";
-    Styles = (INIFILETABLE);
-End
-
-#endif
-
 ProfileItem gid_Profileitem_Uno_Uno_Bundled_Extensions
     ProfileID = gid_Profile_Uno_Ini;
     ModuleID = gid_Module_Root;


More information about the Libreoffice-commits mailing list