diff --git a/CHANGELOG.md b/CHANGELOG.md index 9263f50d..cce047e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ * Add: option [storage] use_cache_subfolder_for_synctoken for storing 'sync-token' cache outside collection-root * Add: option [storage] folder_umask for configuration of umask (overwrite system-default) * Fix: also remove 'item' from cache on delete +* Improve: avoid automatically invalid cache on upgrade in case no change on cache structure +* Improve: log important module versions on startup ## 3.3.1 diff --git a/radicale/server.py b/radicale/server.py index 80e58fd3..77080117 100644 --- a/radicale/server.py +++ b/radicale/server.py @@ -2,7 +2,7 @@ # Copyright © 2008 Nicolas Kandel # Copyright © 2008 Pascal Halter # Copyright © 2008-2017 Guillaume Ayoub -# Copyright © 2017-2019 Unrud +# Copyright © 2017-2023 Unrud # Copyright © 2024-2024 Peter Bieringer # # This library is free software: you can redistribute it and/or modify @@ -301,7 +301,7 @@ def serve(configuration: config.Configuration, """ - logger.info("Starting Radicale") + logger.info("Starting Radicale (%s)", utils.packages_version()) # Copy configuration before modifying configuration = configuration.copy() configuration.update({"server": {"_internal_server": "True"}}, "server", diff --git a/radicale/storage/__init__.py b/radicale/storage/__init__.py index 58f2a499..da89bcf3 100644 --- a/radicale/storage/__init__.py +++ b/radicale/storage/__init__.py @@ -2,6 +2,7 @@ # Copyright © 2014 Jean-Marc Martins # Copyright © 2012-2017 Guillaume Ayoub # Copyright © 2017-2022 Unrud +# Copyright © 2024-2024 Peter Bieringer # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,17 +36,19 @@ from radicale import item as radicale_item from radicale import types, utils from radicale.item import filter as radicale_filter +from radicale.log import logger INTERNAL_TYPES: Sequence[str] = ("multifilesystem", "multifilesystem_nolock",) -CACHE_DEPS: Sequence[str] = ("radicale", "vobject") -CACHE_VERSION: bytes = "".join( - "%s=%s;" % (pkg, utils.package_version(pkg)) - for pkg in CACHE_DEPS).encode() +# NOTE: change only if cache structure is modified to avoid cache invalidation on update +CACHE_VERSION_RADICALE = "3.3.1" + +CACHE_VERSION: bytes = ("%s=%s;%s=%s;" % ("radicale", CACHE_VERSION_RADICALE, "vobject", utils.package_version("vobject"))).encode() def load(configuration: "config.Configuration") -> "BaseStorage": """Load the storage module chosen in configuration.""" + logger.debug("storage cache version: %r", str(CACHE_VERSION)) return utils.load_plugin(INTERNAL_TYPES, "storage", "Storage", BaseStorage, configuration) diff --git a/radicale/utils.py b/radicale/utils.py index 50a8d822..097be3fb 100644 --- a/radicale/utils.py +++ b/radicale/utils.py @@ -26,6 +26,8 @@ _T_co = TypeVar("_T_co", covariant=True) +RADICALE_MODULES: Sequence[str] = ("radicale", "vobject", "passlib", "defusedxml") + def load_plugin(internal_types: Sequence[str], module_name: str, class_name: str, base_class: Type[_T_co], @@ -51,6 +53,13 @@ def package_version(name): return metadata.version(name) +def packages_version(): + versions = [] + for pkg in RADICALE_MODULES: + versions.append("%s=%s" % (pkg, package_version(pkg))) + return " ".join(versions) + + def ssl_context_options_by_protocol(protocol: str, ssl_context_options): logger.debug("SSL protocol string: '%s' and current SSL context options: '0x%x'", protocol, ssl_context_options) # disable any protocol by default