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,\
berkeleydb \
icuuc \
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
$(eval $(call gb_Library_add_library_objects,merged,\
$(gb_MERGEDLIBS) \

View File

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

View File

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

View File

@@ -44,7 +44,6 @@ $(eval $(call gb_Library_add_linked_libs,deployment,\
cppu \
cppuhelper \
deploymentmisc \
helplinker \
sal \
svl \
tl \
@@ -54,15 +53,16 @@ $(eval $(call gb_Library_add_linked_libs,deployment,\
$(gb_STDLIBS) \
))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_use_externals,deployment,\
berkeleydb \
))
endif
$(eval $(call gb_Library_set_componentfile,deployment,desktop/source/deployment/deployment))
$(eval $(call gb_Library_add_exception_objects,deployment,\
desktop/source/deployment/dp_log \
desktop/source/deployment/dp_persmap \
desktop/source/deployment/dp_services \
desktop/source/deployment/dp_xml \
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 \
))
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:

View File

@@ -54,12 +54,19 @@ $(eval $(call gb_Library_add_linked_libs,deploymentmisc,\
$(gb_STDLIBS) \
))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_use_externals,deploymentmisc,\
berkeleydb \
))
endif
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
$(eval $(call gb_Library_add_exception_objects,deploymentmisc,\
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_descriptioninfoset \
desktop/source/deployment/misc/dp_identifier \

View File

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

View File

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

View File

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

View File

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

View File

@@ -32,7 +32,9 @@
#include "dp_configuration.hrc"
#include "dp_backend.h"
#if !defined(ANDROID) && !defined(IOS)
#include "dp_persmap.h"
#endif
#include "dp_ucb.h"
#include "rtl/string.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 & identifier,
Reference<XCommandEnvironment> const & xCmdEnv );
#if !defined(ANDROID) && !defined(IOS)
// for backwards compatibility - nil if no (compatible) back-compat db present
::std::auto_ptr<PersistentMap> m_registeredPackages;
#endif
virtual void SAL_CALL disposing();
const Reference<deployment::XPackageTypeInfo> m_xConfDataTypeInfo;
@@ -224,6 +226,8 @@ BackendImpl::BackendImpl(
deleteUnusedFolders(OUString(), folders);
configmgrini_verify_init( xCmdEnv );
#if !defined(ANDROID) && !defined(IOS)
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr<PersistentMap> pMap;
SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -247,6 +251,7 @@ BackendImpl::BackendImpl(
}
}
m_registeredPackages = pMap;
#endif
}
}
@@ -566,13 +571,14 @@ BackendImpl::PackageImpl::isRegistered_(
bool bReg = false;
if (that->hasActiveEntry(getURL()))
bReg = true;
#if !defined(ANDROID) && !defined(IOS)
if (!bReg && that->m_registeredPackages.get())
{
// fallback for user extension registered in berkeley DB
bReg = that->m_registeredPackages->has(
rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ));
}
#endif
return beans::Optional< beans::Ambiguous<sal_Bool> >(
true, beans::Ambiguous<sal_Bool>( bReg, false ) );
}
@@ -754,6 +760,7 @@ void BackendImpl::PackageImpl::processPackage_(
}
else // revoke
{
#if !defined(ANDROID) && !defined(IOS)
if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv) &&
that->m_registeredPackages.get()) {
// Obsolete package database handling - should be removed for LibreOffice 4.0
@@ -803,7 +810,7 @@ void BackendImpl::PackageImpl::processPackage_(
OSL_ASSERT(0);
}
}
#endif
::boost::optional<ConfigurationBackendDb::Data> data = that->readDataFromDb(url);
//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

View File

@@ -39,7 +39,9 @@
#include "svl/inettype.hxx"
#include "unotools/pathoptions.hxx"
#if !defined(ANDROID) && !defined(IOS)
#include <l10ntools/compilehelp.hxx>
#endif
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
@@ -397,6 +399,7 @@ void BackendImpl::implProcessHelp(
data.dataUrl = xPackage->getURL();
if (!package->extensionContainsCompiledHelp())
{
#if !defined(ANDROID) && !defined(IOS)
const OUString sHelpFolder = createFolder(OUString(), xCmdEnv);
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
//point the registration was successful.