Attempt to manage without Berkeley DB on iOS and Android

Berkeley DB is used for help index and extension database. (Possibly
only for a backward-compatible format of the latter, I am not sure.)
Neither use makes much sense on Android and iOS.

The existing help is for LO on desktop OSes anyway, help for LO-based
apps on iOS and Android will naturally be quite different.

On iOS there will definitely be no "extensions", and probably we don't
want to bother with such on Android either.
This commit is contained in:
Tor Lillqvist
2012-01-16 16:42:51 +02:00
parent 6c1852c552
commit 081d76c3fa
11 changed files with 81 additions and 13 deletions

View File

@@ -49,11 +49,16 @@ $(eval $(call gb_Library_add_linked_libs,merged,\
)) ))
$(eval $(call gb_Library_use_externals,merged,\ $(eval $(call gb_Library_use_externals,merged,\
berkeleydb \
icuuc \ icuuc \
zlib \ zlib \
)) ))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_use_externals,merged,\
berkeleydb \
))
endif
# gb_MERGEDLIBS is defined in solenv/gbuild/extensions/pre_MergedLibsList.mk # gb_MERGEDLIBS is defined in solenv/gbuild/extensions/pre_MergedLibsList.mk
$(eval $(call gb_Library_add_library_objects,merged,\ $(eval $(call gb_Library_add_library_objects,merged,\
$(gb_MERGEDLIBS) \ $(gb_MERGEDLIBS) \

View File

@@ -60,7 +60,6 @@ copy-stuff:
bootstrap.uno \ bootstrap.uno \
comphelpgcc3 \ comphelpgcc3 \
configmgr.uno \ configmgr.uno \
db-4.7 \
fontconfig \ fontconfig \
forlo \ forlo \
foruilo \ foruilo \

View File

@@ -5819,10 +5819,12 @@ or install the Berkeley db development package.])
SCPDEFS="$SCPDEFS -DSYSTEM_DB" SCPDEFS="$SCPDEFS -DSYSTEM_DB"
MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll" MINGW_EXTERNAL_DLLS="$MINGW_EXTERNAL_DLLS libdb-4.8.dll"
else elif test $_os != iOS -a $_os != Android; then
AC_MSG_RESULT([internal]) AC_MSG_RESULT([internal])
SYSTEM_DB=NO SYSTEM_DB=NO
BUILD_TYPE="$BUILD_TYPE BERKELEYDB" BUILD_TYPE="$BUILD_TYPE BERKELEYDB"
else
AC_MSG_RESULT([none])
fi fi
AC_SUBST(SYSTEM_DB) AC_SUBST(SYSTEM_DB)
AC_SUBST(SYSTEM_DB_CFLAGS) AC_SUBST(SYSTEM_DB_CFLAGS)

View File

@@ -44,7 +44,6 @@ $(eval $(call gb_Library_add_linked_libs,deployment,\
cppu \ cppu \
cppuhelper \ cppuhelper \
deploymentmisc \ deploymentmisc \
helplinker \
sal \ sal \
svl \ svl \
tl \ tl \
@@ -54,15 +53,16 @@ $(eval $(call gb_Library_add_linked_libs,deployment,\
$(gb_STDLIBS) \ $(gb_STDLIBS) \
)) ))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_use_externals,deployment,\ $(eval $(call gb_Library_use_externals,deployment,\
berkeleydb \ berkeleydb \
)) ))
endif
$(eval $(call gb_Library_set_componentfile,deployment,desktop/source/deployment/deployment)) $(eval $(call gb_Library_set_componentfile,deployment,desktop/source/deployment/deployment))
$(eval $(call gb_Library_add_exception_objects,deployment,\ $(eval $(call gb_Library_add_exception_objects,deployment,\
desktop/source/deployment/dp_log \ desktop/source/deployment/dp_log \
desktop/source/deployment/dp_persmap \
desktop/source/deployment/dp_services \ desktop/source/deployment/dp_services \
desktop/source/deployment/dp_xml \ desktop/source/deployment/dp_xml \
desktop/source/deployment/manager/dp_activepackages \ desktop/source/deployment/manager/dp_activepackages \
@@ -92,4 +92,16 @@ $(eval $(call gb_Library_add_exception_objects,deployment,\
desktop/source/deployment/registry/sfwk/dp_sfwk \ desktop/source/deployment/registry/sfwk/dp_sfwk \
)) ))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_add_linked_libs,deployment,\
helplinker \
))
$(eval $(call gb_Library_add_exception_objects,deployment,\
desktop/source/deployment/dp_persmap \
))
endif
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:

View File

@@ -54,12 +54,19 @@ $(eval $(call gb_Library_add_linked_libs,deploymentmisc,\
$(gb_STDLIBS) \ $(gb_STDLIBS) \
)) ))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_use_externals,deploymentmisc,\ $(eval $(call gb_Library_use_externals,deploymentmisc,\
berkeleydb \ berkeleydb \
)) ))
endif
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_add_exception_objects,deploymentmisc,\ $(eval $(call gb_Library_add_exception_objects,deploymentmisc,\
desktop/source/deployment/misc/db \ desktop/source/deployment/misc/db \
))
endif
$(eval $(call gb_Library_add_exception_objects,deploymentmisc,\
desktop/source/deployment/misc/dp_dependencies \ desktop/source/deployment/misc/dp_dependencies \
desktop/source/deployment/misc/dp_descriptioninfoset \ desktop/source/deployment/misc/dp_descriptioninfoset \
desktop/source/deployment/misc/dp_identifier \ desktop/source/deployment/misc/dp_identifier \

View File

@@ -43,8 +43,6 @@
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include "dp_identifier.hxx" #include "dp_identifier.hxx"
#include "dp_persmap.h"
#include "dp_activepackages.hxx" #include "dp_activepackages.hxx"
// Old format of database entry: // Old format of database entry:
@@ -126,7 +124,15 @@ namespace dp_manager {
ActivePackages::ActivePackages() {} ActivePackages::ActivePackages() {}
ActivePackages::ActivePackages(::rtl::OUString const & url) : m_map(url) {} ActivePackages::ActivePackages(::rtl::OUString const & url)
#if !defined(ANDROID) && !defined(IOS)
: m_map(url)
#endif
{
#if defined(ANDROID) || defined(IOS)
(void)url;
#endif
}
ActivePackages::~ActivePackages() {} ActivePackages::~ActivePackages() {}
@@ -140,6 +146,7 @@ bool ActivePackages::get(
Data * data, ::rtl::OUString const & id, ::rtl::OUString const & fileName) Data * data, ::rtl::OUString const & id, ::rtl::OUString const & fileName)
const const
{ {
#if !defined(ANDROID) && !defined(IOS)
::rtl::OString v; ::rtl::OString v;
if (m_map.get(&v, newKey(id))) { if (m_map.get(&v, newKey(id))) {
if (data != NULL) { if (data != NULL) {
@@ -154,10 +161,17 @@ bool ActivePackages::get(
} else { } else {
return false; return false;
} }
#else
(void) data;
(void) id;
(void) fileName;
return false;
#endif
} }
ActivePackages::Entries ActivePackages::getEntries() const { ActivePackages::Entries ActivePackages::getEntries() const {
Entries es; Entries es;
#if !defined(ANDROID) && !defined(IOS)
::dp_misc::t_string2string_map m(m_map.getEntries()); ::dp_misc::t_string2string_map m(m_map.getEntries());
for (::dp_misc::t_string2string_map::const_iterator i(m.begin()); for (::dp_misc::t_string2string_map::const_iterator i(m.begin());
i != m.end(); ++i) i != m.end(); ++i)
@@ -178,10 +192,12 @@ ActivePackages::Entries ActivePackages::getEntries() const {
decodeOldData(fn, i->second))); decodeOldData(fn, i->second)));
} }
} }
#endif
return es; return es;
} }
void ActivePackages::put(::rtl::OUString const & id, Data const & data) { void ActivePackages::put(::rtl::OUString const & id, Data const & data) {
#if !defined(ANDROID) && !defined(IOS)
::rtl::OStringBuffer b; ::rtl::OStringBuffer b;
b.append( b.append(
::rtl::OUStringToOString(data.temporaryName, RTL_TEXTENCODING_UTF8)); ::rtl::OUStringToOString(data.temporaryName, RTL_TEXTENCODING_UTF8));
@@ -194,12 +210,21 @@ void ActivePackages::put(::rtl::OUString const & id, Data const & data) {
b.append(separator); b.append(separator);
b.append(::rtl::OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8)); b.append(::rtl::OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8));
m_map.put(newKey(id), b.makeStringAndClear()); m_map.put(newKey(id), b.makeStringAndClear());
#else
(void) id;
(void) data;
#endif
} }
void ActivePackages::erase( void ActivePackages::erase(
::rtl::OUString const & id, ::rtl::OUString const & fileName) ::rtl::OUString const & id, ::rtl::OUString const & fileName)
{ {
#if !defined(ANDROID) && !defined(IOS)
m_map.erase(newKey(id), true) || m_map.erase(oldKey(fileName), true); m_map.erase(newKey(id), true) || m_map.erase(oldKey(fileName), true);
#else
(void) id;
(void) fileName;
#endif
} }
} }

View File

@@ -34,7 +34,9 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#if !defined(ANDROID) && !defined(IOS)
#include "dp_persmap.h" #include "dp_persmap.h"
#endif
namespace rtl { class OUString; } namespace rtl { class OUString; }
@@ -91,8 +93,9 @@ public:
private: private:
ActivePackages(ActivePackages &); // not defined ActivePackages(ActivePackages &); // not defined
void operator =(ActivePackages &); // not defined void operator =(ActivePackages &); // not defined
#if !defined(ANDROID) && !defined(IOS)
::dp_misc::PersistentMap m_map; ::dp_misc::PersistentMap m_map;
#endif
}; };
} }

View File

@@ -40,6 +40,7 @@
#include "com/sun/star/deployment/XPackageManager.hpp" #include "com/sun/star/deployment/XPackageManager.hpp"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include <list> #include <list>
#include <boost/unordered_map.hpp>
namespace css = ::com::sun::star; namespace css = ::com::sun::star;

View File

@@ -32,6 +32,7 @@
#include "cppuhelper/compbase1.hxx" #include "cppuhelper/compbase1.hxx"
#include "comphelper/servicedecl.hxx" #include "comphelper/servicedecl.hxx"
#include "com/sun/star/deployment/thePackageManagerFactory.hpp" #include "com/sun/star/deployment/thePackageManagerFactory.hpp"
#include <boost/unordered_map.hpp>
using namespace ::dp_misc; using namespace ::dp_misc;

View File

@@ -32,7 +32,9 @@
#include "dp_configuration.hrc" #include "dp_configuration.hrc"
#include "dp_backend.h" #include "dp_backend.h"
#if !defined(ANDROID) && !defined(IOS)
#include "dp_persmap.h" #include "dp_persmap.h"
#endif
#include "dp_ucb.h" #include "dp_ucb.h"
#include "rtl/string.hxx" #include "rtl/string.hxx"
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
@@ -118,10 +120,10 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend
OUString const & url, OUString const & mediaType, sal_Bool bRemoved, OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
OUString const & identifier, OUString const & identifier,
Reference<XCommandEnvironment> const & xCmdEnv ); Reference<XCommandEnvironment> const & xCmdEnv );
#if !defined(ANDROID) && !defined(IOS)
// for backwards compatibility - nil if no (compatible) back-compat db present // for backwards compatibility - nil if no (compatible) back-compat db present
::std::auto_ptr<PersistentMap> m_registeredPackages; ::std::auto_ptr<PersistentMap> m_registeredPackages;
#endif
virtual void SAL_CALL disposing(); virtual void SAL_CALL disposing();
const Reference<deployment::XPackageTypeInfo> m_xConfDataTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xConfDataTypeInfo;
@@ -224,6 +226,8 @@ BackendImpl::BackendImpl(
deleteUnusedFolders(OUString(), folders); deleteUnusedFolders(OUString(), folders);
configmgrini_verify_init( xCmdEnv ); configmgrini_verify_init( xCmdEnv );
#if !defined(ANDROID) && !defined(IOS)
SAL_WNODEPRECATED_DECLARATIONS_PUSH SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr<PersistentMap> pMap; ::std::auto_ptr<PersistentMap> pMap;
SAL_WNODEPRECATED_DECLARATIONS_POP SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -247,6 +251,7 @@ BackendImpl::BackendImpl(
} }
} }
m_registeredPackages = pMap; m_registeredPackages = pMap;
#endif
} }
} }
@@ -566,13 +571,14 @@ BackendImpl::PackageImpl::isRegistered_(
bool bReg = false; bool bReg = false;
if (that->hasActiveEntry(getURL())) if (that->hasActiveEntry(getURL()))
bReg = true; bReg = true;
#if !defined(ANDROID) && !defined(IOS)
if (!bReg && that->m_registeredPackages.get()) if (!bReg && that->m_registeredPackages.get())
{ {
// fallback for user extension registered in berkeley DB // fallback for user extension registered in berkeley DB
bReg = that->m_registeredPackages->has( bReg = that->m_registeredPackages->has(
rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 )); rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ));
} }
#endif
return beans::Optional< beans::Ambiguous<sal_Bool> >( return beans::Optional< beans::Ambiguous<sal_Bool> >(
true, beans::Ambiguous<sal_Bool>( bReg, false ) ); true, beans::Ambiguous<sal_Bool>( bReg, false ) );
} }
@@ -754,6 +760,7 @@ void BackendImpl::PackageImpl::processPackage_(
} }
else // revoke else // revoke
{ {
#if !defined(ANDROID) && !defined(IOS)
if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv) && if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv) &&
that->m_registeredPackages.get()) { that->m_registeredPackages.get()) {
// Obsolete package database handling - should be removed for LibreOffice 4.0 // Obsolete package database handling - should be removed for LibreOffice 4.0
@@ -803,7 +810,7 @@ void BackendImpl::PackageImpl::processPackage_(
OSL_ASSERT(0); OSL_ASSERT(0);
} }
} }
#endif
::boost::optional<ConfigurationBackendDb::Data> data = that->readDataFromDb(url); ::boost::optional<ConfigurationBackendDb::Data> data = that->readDataFromDb(url);
//If an xcu file was life deployed then always a data entry is written. //If an xcu file was life deployed then always a data entry is written.
//If the xcu file was already in the configmr.ini then there is also //If the xcu file was already in the configmr.ini then there is also

View File

@@ -39,7 +39,9 @@
#include "svl/inettype.hxx" #include "svl/inettype.hxx"
#include "unotools/pathoptions.hxx" #include "unotools/pathoptions.hxx"
#if !defined(ANDROID) && !defined(IOS)
#include <l10ntools/compilehelp.hxx> #include <l10ntools/compilehelp.hxx>
#endif
#include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp> #include <com/sun/star/uri/XUriReferenceFactory.hpp>
@@ -397,6 +399,7 @@ void BackendImpl::implProcessHelp(
data.dataUrl = xPackage->getURL(); data.dataUrl = xPackage->getURL();
if (!package->extensionContainsCompiledHelp()) if (!package->extensionContainsCompiledHelp())
{ {
#if !defined(ANDROID) && !defined(IOS)
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv); const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
data.dataUrl = sHelpFolder; data.dataUrl = sHelpFolder;
@@ -593,6 +596,9 @@ void BackendImpl::implProcessHelp(
} }
} }
} }
#else
(void) xCmdEnv;
#endif
} }
//Writing the data entry replaces writing the flag file. If we got to this //Writing the data entry replaces writing the flag file. If we got to this
//point the registration was successful. //point the registration was successful.