diff --git a/locales/en.json b/locales/en.json index 90f9e46e5..9290b7c24 100644 --- a/locales/en.json +++ b/locales/en.json @@ -34,6 +34,8 @@ "app_extraction_failed" : "Unable to extract installation files", "app_install_files_invalid" : "Invalid installation files", "app_manifest_invalid" : "Invalid app manifest", + "app_incompatible" : "The app is incompatible with your YunoHost version", + "app_package_need_update" : "The app package need to be updated to follow YunoHost changes", "app_argument_choice_invalid" : "Invalid choice for argument '{name:s}', it must be one of {choices:s}", "app_argument_invalid" : "Invalid value for argument '{name:s}': {error:s}", "app_argument_required" : "Argument '{name:s}' is required", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 032f7fb4a..f6a099bd1 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1385,12 +1385,24 @@ def _encode_string(value): def _check_manifest_requirements(manifest): """Check if required packages are met from the manifest""" requirements = manifest.get('requirements', dict()) + # FIXME: Deprecate min_version key if 'min_version' in manifest: requirements['yunohost'] = '>> {0}'.format(manifest['min_version']) logger.debug("the manifest key 'min_version' is deprecated, " "use 'requirements' instead.") - if not requirements: + + # Validate multi-instance app + if manifest.get('multi_instance', False): + # Handle backward-incompatible change introduced in yunohost >= 2.3.6 + # See https://dev.yunohost.org/issues/156 + yunohost_req = requirements.get('yunohost', None) + if (not yunohost_req or + not packages.SpecifierSet(yunohost_req) & '>= 2.3.6'): + raise MoulinetteError(errno.EINVAL, '{0}{1}'.format( + m18n.g('colon', m18n.n('app_incompatible')), + m18n.n('app_package_need_update'))) + elif not requirements: return logger.info(m18n.n('app_requirements_checking'))