From 08c23599e2e1a6989d29fe6ab6c10d1b993b5bd1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 6 Nov 2019 23:48:58 +0100 Subject: [PATCH] Improve yunohost package version diagnosis --- data/hooks/diagnosis/00-basesystem.py | 8 ++++++-- locales/en.json | 4 ++-- src/yunohost/utils/packages.py | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/data/hooks/diagnosis/00-basesystem.py b/data/hooks/diagnosis/00-basesystem.py index 8bd522ee7..4add48fb2 100644 --- a/data/hooks/diagnosis/00-basesystem.py +++ b/data/hooks/diagnosis/00-basesystem.py @@ -37,16 +37,20 @@ class BaseSystemDiagnoser(Diagnoser): # Here, ynh_core_version is for example "3.5.4.12", so [:3] is "3.5" and we check it's the same for all packages ynh_core_version = ynh_packages["yunohost"]["version"] consistent_versions = all(infos["version"][:3] == ynh_core_version[:3] for infos in ynh_packages.values()) - ynh_version_details = [("diagnosis_basesystem_ynh_single_version", (package, infos["version"])) + ynh_version_details = [("diagnosis_basesystem_ynh_single_version", (package, infos["version"], infos["repo"])) for package, infos in ynh_packages.items()] if consistent_versions: yield dict(meta={"test": "ynh_versions"}, + data={"main_version": ynh_core_version, "repo": ynh_packages["yunohost"]["repo"]}, status="INFO", - summary=("diagnosis_basesystem_ynh_main_version", {"main_version": ynh_core_version[:3]}), + summary=("diagnosis_basesystem_ynh_main_version", + {"main_version": ynh_core_version, + "repo": ynh_packages["yunohost"]["repo"]}), details=ynh_version_details) else: yield dict(meta={"test": "ynh_versions"}, + data={"main_version": ynh_core_version, "repo": ynh_packages["yunohost"]["repo"]}, status="ERROR", summary=("diagnosis_basesystem_ynh_inconsistent_versions", {}), details=ynh_version_details) diff --git a/locales/en.json b/locales/en.json index ebe6b4571..751180a37 100644 --- a/locales/en.json +++ b/locales/en.json @@ -152,8 +152,8 @@ "custom_appslist_name_required": "You must provide a name for your custom app list", "diagnosis_basesystem_host": "Server is running Debian {debian_version}.", "diagnosis_basesystem_kernel": "Server is running Linux kernel {kernel_version}", - "diagnosis_basesystem_ynh_single_version": "{0} version: {1}", - "diagnosis_basesystem_ynh_main_version": "Server is running YunoHost {main_version}", + "diagnosis_basesystem_ynh_single_version": "{0} version: {1} ({2})", + "diagnosis_basesystem_ynh_main_version": "Server is running YunoHost {main_version} ({repo})", "diagnosis_basesystem_ynh_inconsistent_versions": "You are running inconsistents versions of the YunoHost packages ... most probably because of a failed or partial upgrade.", "diagnosis_display_tip_web": "You can go to the Diagnosis section (in the home screen) to see the issues found.", "diagnosis_display_tip_cli": "You can run 'yunohost diagnosis show --issues' to display the issues found.", diff --git a/src/yunohost/utils/packages.py b/src/yunohost/utils/packages.py index 6df736432..debba70f4 100644 --- a/src/yunohost/utils/packages.py +++ b/src/yunohost/utils/packages.py @@ -406,6 +406,9 @@ def get_installed_version(*pkgnames, **kwargs): except AttributeError: repo = "" + if repo == "now": + repo = "local" + if with_repo: versions[pkgname] = { "version": version,