From a16fb94d82a04bdfbee9cc4647bd51690ea2415c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 21 Apr 2019 02:03:59 +0200 Subject: [PATCH] Only upgrade system or apps, not both at the same time --- data/actionsmap/yunohost.yml | 10 +++++----- src/yunohost/tools.py | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/data/actionsmap/yunohost.yml b/data/actionsmap/yunohost.yml index fabdcb923..08188c8c8 100644 --- a/data/actionsmap/yunohost.yml +++ b/data/actionsmap/yunohost.yml @@ -1563,11 +1563,11 @@ tools: authenticate: all authenticator: ldap-anonymous arguments: - --ignore-apps: - help: Ignore apps upgrade - action: store_true - --ignore-packages: - help: Ignore APT packages upgrade + --apps: + help: List of apps to upgrade (all by default) + nargs: "*" + --system: + help: Upgrade only the system packages action: store_true ### tools_diagnosis() diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index ff02e5e39..784f5d512 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -582,22 +582,29 @@ def _dump_sources_list(): @is_unit_operation() -def tools_upgrade(operation_logger, auth, ignore_apps=False, ignore_packages=False): +def tools_upgrade(operation_logger, auth, apps=None, system=False): """ Update apps & package cache, then display changelog Keyword arguments: - ignore_apps -- Ignore apps upgrade - ignore_packages -- Ignore APT packages upgrade - + apps -- List of apps to upgrade (or [] to update all apps) + system -- True to upgrade system """ from yunohost.utils import packages if packages.dpkg_is_broken(): raise YunohostError("dpkg_is_broken") + if system is not False and apps is not None: + # TODO : i18n + raise YunohostError("Cannot upgrade both system and apps at the same time") + + if system is False and apps is None: + # TODO : i18n + raise YunohostError("Please specify --apps OR --system") + failure = False - if not ignore_packages: + if system is True: # Check that there's indeed some packages to upgrade upgradables = list(_list_upgradable_apt_packages()) @@ -722,7 +729,7 @@ def tools_upgrade(operation_logger, auth, ignore_apps=False, ignore_packages=Fal operation_logger.success() - if not ignore_apps: + if apps is not None: try: app_upgrade(auth) except Exception as e: