desktop/inc/deployment.hrc | 7 - desktop/source/deployment/misc/dp_dependencies.cxx | 115 +++++++++++++------ desktop/source/deployment/misc/dp_misc.hrc | 33 ----- desktop/source/deployment/misc/dp_misc.src | 10 + desktop/source/deployment/misc/dp_ucb.cxx | 2 desktop/test/deployment/dependencies/loversion35.oxt |binary desktop/test/deployment/dependencies/loversion36.oxt |binary 7 files changed, 95 insertions(+), 72 deletions(-)
New commits: commit 8a993919377f0b602b7db88d1de6696b21a11cbf Author: Stephan Bergmann <[email protected]> Date: Tue Nov 15 12:42:44 2011 +0100 Introduced LibreOffice-minimal-version extension dependency. diff --git a/desktop/inc/deployment.hrc b/desktop/inc/deployment.hrc index 1777f69..4bd6dbc 100644 --- a/desktop/inc/deployment.hrc +++ b/desktop/inc/deployment.hrc @@ -68,8 +68,11 @@ #define RID_DEPLOYMENT_DEPENDENCIES_START (RID_DEPLOYMENT_START + 4400) #define RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN RID_DEPLOYMENT_DEPENDENCIES_START -#define RID_DEPLOYMENT_DEPENDENCIES_MIN (RID_DEPLOYMENT_DEPENDENCIES_START+1) -#define RID_DEPLOYMENT_DEPENDENCIES_MAX (RID_DEPLOYMENT_DEPENDENCIES_START+2) +#define RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN \ + (RID_DEPLOYMENT_DEPENDENCIES_START+1) +#define RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX \ + (RID_DEPLOYMENT_DEPENDENCIES_START+2) +#define RID_DEPLOYMENT_DEPENDENCIES_LO_MIN (RID_DEPLOYMENT_DEPENDENCIES_START+3) #define RID_DEPLOYMENT_LICENSE_START (RID_DEPLOYMENT_START+4500) diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index f2a997f..b563a52 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -40,6 +40,7 @@ #include "rtl/ustring.hxx" #include "sal/types.h" #include "tools/resid.hxx" +#include "unotools/configmgr.hxx" #include "deployment.hrc" #include "dp_resource.h" @@ -52,28 +53,43 @@ namespace { namespace css = com::sun::star; -static char const xmlNamespace[] = +static char const namespaceLibreOffice[] = + "http://libreoffice.org/extensions/description/2011"; + +static char const namespaceOpenOfficeOrg[] = "http://openoffice.org/extensions/description/2006"; -static char const minimalVersion[] = "OpenOffice.org-minimal-version"; +static char const minimalVersionLibreOffice[] = "LibreOffice-minimal-version"; + +static char const minimalVersionOpenOfficeOrg[] = + "OpenOffice.org-minimal-version"; + +static char const maximalVersionOpenOfficeOrg[] = + "OpenOffice.org-maximal-version"; -static char const maximalVersion[] = "OpenOffice.org-maximal-version"; +rtl::OUString getLibreOfficeMajorMinorMicro() { + return utl::ConfigManager::getAboutBoxProductVersion(); +} -bool versionIsNot(dp_misc::Order order, rtl::OUString const & version) { - rtl::OUString oooVersion( +rtl::OUString getReferenceOpenOfficeOrgMajorMinor() { + rtl::OUString v( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":Version:ReferenceOOoMajorMinor}")); - rtl::Bootstrap::expandMacros(oooVersion); //TODO: check for failure - return dp_misc::compareVersions(oooVersion, version) != order; + rtl::Bootstrap::expandMacros(v); //TODO: check for failure + return v; } -bool satisfiesMinimalVersion(rtl::OUString const & version) { - return versionIsNot(dp_misc::LESS, version); +bool satisfiesMinimalVersion( + rtl::OUString const & actual, rtl::OUString const & specified) +{ + return dp_misc::compareVersions(actual, specified) != dp_misc::LESS; } -bool satisfiesMaximalVersion(rtl::OUString const & version) { - return versionIsNot(dp_misc::GREATER, version); +bool satisfiesMaximalVersion( + rtl::OUString const & actual, rtl::OUString const & specified) +{ + return dp_misc::compareVersions(actual, specified) != dp_misc::GREATER; } rtl::OUString produceErrorText( @@ -106,32 +122,47 @@ check(dp_misc::DescriptionInfoset const & infoset) { deps->item(i), css::uno::UNO_QUERY_THROW); bool sat = false; if (e->getNamespaceURI().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(xmlNamespace)) + RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg)) && e->getTagName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(minimalVersion))) + RTL_CONSTASCII_STRINGPARAM(minimalVersionOpenOfficeOrg))) { sat = satisfiesMinimalVersion( + getReferenceOpenOfficeOrgMajorMinor(), e->getAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); } else if (e->getNamespaceURI().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(xmlNamespace)) + RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg)) && e->getTagName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(maximalVersion))) + RTL_CONSTASCII_STRINGPARAM(maximalVersionOpenOfficeOrg))) { sat = satisfiesMaximalVersion( - e->getAttribute( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); + getReferenceOpenOfficeOrgMajorMinor(), + e->getAttribute( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); + } else if (e->getNamespaceURI().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM(namespaceLibreOffice)) + && e->getTagName().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM(minimalVersionLibreOffice))) + { + sat = satisfiesMinimalVersion( + getLibreOfficeMajorMinorMicro(), + e->getAttribute( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); } else if (e->hasAttributeNS( rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)), + RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)), rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(minimalVersion)))) + RTL_CONSTASCII_USTRINGPARAM( + minimalVersionOpenOfficeOrg)))) { sat = satisfiesMinimalVersion( + getReferenceOpenOfficeOrgMajorMinor(), e->getAttributeNS( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)), rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(minimalVersion)))); + RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + minimalVersionOpenOfficeOrg)))); } if (!sat) { unsatisfied[unsat++] = e; @@ -146,36 +177,54 @@ rtl::OUString getErrorText( { OSL_ASSERT(dependency.is()); if (dependency->getNamespaceURI().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(xmlNamespace)) + RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg)) && dependency->getTagName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(minimalVersion))) + RTL_CONSTASCII_STRINGPARAM(minimalVersionOpenOfficeOrg))) { return produceErrorText( - ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MIN)), + ResId::toString( + dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN)), dependency->getAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); } else if (dependency->getNamespaceURI().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(xmlNamespace)) + RTL_CONSTASCII_STRINGPARAM(namespaceOpenOfficeOrg)) && dependency->getTagName().equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM(maximalVersion))) + RTL_CONSTASCII_STRINGPARAM(maximalVersionOpenOfficeOrg))) { return produceErrorText( - ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MAX)), + ResId::toString( + dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX)), + dependency->getAttribute( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); + } else if (dependency->getNamespaceURI().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM(namespaceLibreOffice)) + && dependency->getTagName().equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM(minimalVersionLibreOffice))) + { + return produceErrorText( + ResId::toString( + dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_LO_MIN)), dependency->getAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value")))); } else if (dependency->hasAttributeNS( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)), rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM(minimalVersion)))) + RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + minimalVersionOpenOfficeOrg)))) { return produceErrorText( - ResId::toString(dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_MIN)), + ResId::toString( + dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN)), dependency->getAttributeNS( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(minimalVersion)))); - } else + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(namespaceOpenOfficeOrg)), + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM(minimalVersionOpenOfficeOrg)))); + } else { return ResId::toString( dp_misc::getResId(RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN)); + } } } diff --git a/desktop/source/deployment/misc/dp_misc.hrc b/desktop/source/deployment/misc/dp_misc.hrc deleted file mode 100644 index 55fabac..0000000 --- a/desktop/source/deployment/misc/dp_misc.hrc +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#if ! defined INCLUDED_DP_MISC_HRC -#define INCLUDED_DP_MISC_HRC - -#include "deployment.hrc" - -#endif diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src index 22a6683..dda9edf 100644 --- a/desktop/source/deployment/misc/dp_misc.src +++ b/desktop/source/deployment/misc/dp_misc.src @@ -25,16 +25,20 @@ * ************************************************************************/ -#include "dp_misc.hrc" +#include "deployment.hrc" String RID_DEPLOYMENT_DEPENDENCIES_UNKNOWN { Text[en-US] = "Unknown"; }; -String RID_DEPLOYMENT_DEPENDENCIES_MIN { +String RID_DEPLOYMENT_DEPENDENCIES_OOO_MIN { Text[en-US] = "Extension requires at least OpenOffice.org reference version %VERSION"; }; -String RID_DEPLOYMENT_DEPENDENCIES_MAX { +String RID_DEPLOYMENT_DEPENDENCIES_OOO_MAX { Text[en-US] = "Extension does not support OpenOffice.org reference versions greater than %VERSION"; }; + +String RID_DEPLOYMENT_DEPENDENCIES_LO_MIN { + Text[en-US] = "Extension requires at least LibreOffice version %VERSION"; +}; diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index fa3896a..b0cda17 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -29,7 +29,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" -#include "dp_misc.hrc" +#include "deployment.hrc" #include "dp_misc.h" #include "dp_ucb.h" #include "rtl/uri.hxx" diff --git a/desktop/test/deployment/dependencies/loversion35.oxt b/desktop/test/deployment/dependencies/loversion35.oxt new file mode 100644 index 0000000..ecd509c Binary files /dev/null and b/desktop/test/deployment/dependencies/loversion35.oxt differ diff --git a/desktop/test/deployment/dependencies/loversion36.oxt b/desktop/test/deployment/dependencies/loversion36.oxt new file mode 100644 index 0000000..f38630e Binary files /dev/null and b/desktop/test/deployment/dependencies/loversion36.oxt differ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
