mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Consistent options for tools_update (compared to upgrade) + semantic improvements
This commit is contained in:
parent
ec9deec9d4
commit
a192bdd31a
3 changed files with 28 additions and 23 deletions
|
@ -1548,11 +1548,11 @@ tools:
|
|||
action_help: YunoHost update
|
||||
api: PUT /update
|
||||
arguments:
|
||||
--ignore-apps:
|
||||
help: Ignore apps cache update and changelog
|
||||
--apps:
|
||||
help: Fetch the application list to check which apps can be upgraded
|
||||
action: store_true
|
||||
--ignore-packages:
|
||||
help: Ignore APT cache update and changelog
|
||||
--system:
|
||||
help: Fetch available system packages upgrades (equivalent to apt update)
|
||||
action: store_true
|
||||
|
||||
### tools_upgrade()
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
"admin_password": "Administration password",
|
||||
"admin_password_change_failed": "Unable to change password",
|
||||
"admin_password_changed": "The administration password has been changed",
|
||||
"app_action_cannot_be_ran_because_required_services_down": "This app requires some services which are currently down. Before continuing, you should try to restart the following services (and possibly investigate why they are down) : {services}",
|
||||
"admin_password_too_long": "Please choose a password shorter than 127 characters",
|
||||
"already_up_to_date": "Nothing to do! Everything is already up to date!",
|
||||
"app_action_cannot_be_ran_because_required_services_down": "This app requires some services which are currently down. Before continuing, you should try to restart the following services (and possibly investigate why they are down) : {services}",
|
||||
"app_already_installed": "{app:s} is already installed",
|
||||
"app_already_installed_cant_change_url": "This app is already installed. The url cannot be changed just by this function. Look into `app changeurl` if it's available.",
|
||||
"app_already_up_to_date": "{app:s} is already up to date",
|
||||
|
@ -367,7 +368,6 @@
|
|||
"package_not_installed": "Package '{pkgname}' is not installed",
|
||||
"package_unexpected_error": "An unexpected error occurred processing the package '{pkgname}'",
|
||||
"package_unknown": "Unknown package '{pkgname}'",
|
||||
"packages_no_upgrade": "There is no package to upgrade",
|
||||
"packages_upgrade_critical_later": "Critical packages ({packages:s}) will be upgraded later",
|
||||
"packages_upgrade_failed": "Unable to upgrade all of the packages",
|
||||
"password_listed": "This password is among the most used password in the world. Please choose something a bit more unique.",
|
||||
|
@ -499,6 +499,7 @@
|
|||
"update_apt_cache_failed": "Unable to update the cache of APT (Debian's package manager). Here is a dump of the sources.list lines which might help to identify problematic lines : \n{sourceslist}",
|
||||
"update_apt_cache_warning": "Some errors happened while updating the cache of APT (Debian's package manager). Here is a dump of the sources.list lines which might help to identify problematic lines : \n{sourceslist}",
|
||||
"updating_apt_cache": "Fetching available upgrades for system packages…",
|
||||
"updating_app_lists": "Fetching available upgrades for applications…",
|
||||
"upgrade_complete": "Upgrade complete",
|
||||
"upgrading_packages": "Upgrading packages…",
|
||||
"upnp_dev_not_found": "No UPnP device found",
|
||||
|
|
|
@ -470,18 +470,22 @@ def tools_regen_conf(names=[], with_diff=False, force=False, dry_run=False,
|
|||
return regen_conf(names, with_diff, force, dry_run, list_pending)
|
||||
|
||||
|
||||
def tools_update(ignore_apps=False, ignore_packages=False):
|
||||
def tools_update(apps=False, system=False):
|
||||
"""
|
||||
Update apps & package cache, then display changelog
|
||||
Update apps & system package cache
|
||||
|
||||
Keyword arguments:
|
||||
ignore_apps -- Ignore app list update and changelog
|
||||
ignore_packages -- Ignore apt cache update and changelog
|
||||
|
||||
system -- Fetch available system packages upgrades (equivalent to apt update)
|
||||
apps -- Fetch the application list to check which apps can be upgraded
|
||||
"""
|
||||
# "packages" will list upgradable packages
|
||||
packages = []
|
||||
if not ignore_packages:
|
||||
|
||||
# If neither --apps nor --system specified, do both
|
||||
if not apps and not system:
|
||||
apps = True
|
||||
system = True
|
||||
|
||||
upgradable_system_packages = []
|
||||
if system:
|
||||
|
||||
# Update APT cache
|
||||
# LC_ALL=C is here to make sure the results are in english
|
||||
|
@ -514,12 +518,12 @@ def tools_update(ignore_apps=False, ignore_packages=False):
|
|||
elif warnings:
|
||||
logger.error(m18n.n('update_apt_cache_warning', sourceslist='\n'.join(_dump_sources_list())))
|
||||
|
||||
packages = list(_list_upgradable_apt_packages())
|
||||
upgradable_system_packages = list(_list_upgradable_apt_packages())
|
||||
logger.debug(m18n.n('done'))
|
||||
|
||||
# "apps" will list upgradable packages
|
||||
apps = []
|
||||
if not ignore_apps:
|
||||
upgradable_apps = []
|
||||
if apps:
|
||||
logger.info(m18n.n('updating_app_lists'))
|
||||
try:
|
||||
app_fetchlist()
|
||||
except YunohostError:
|
||||
|
@ -532,15 +536,15 @@ def tools_update(ignore_apps=False, ignore_packages=False):
|
|||
app_dict = app_info(app_id, raw=True)
|
||||
|
||||
if app_dict["upgradable"] == "yes":
|
||||
apps.append({
|
||||
upgradable_apps.append({
|
||||
'id': app_id,
|
||||
'label': app_dict['settings']['label']
|
||||
})
|
||||
|
||||
if len(apps) == 0 and len(packages) == 0:
|
||||
logger.info(m18n.n('packages_no_upgrade'))
|
||||
if len(upgradable_apps) == 0 and len(upgradable_system_packages) == 0:
|
||||
logger.info(m18n.n('already_up_to_date'))
|
||||
|
||||
return {'packages': packages, 'apps': apps}
|
||||
return {'system': upgradable_system_packages, 'apps': upgradable_apps}
|
||||
|
||||
|
||||
# TODO : move this to utils/packages.py ?
|
||||
|
@ -622,7 +626,7 @@ def tools_upgrade(operation_logger, auth, apps=None, system=False):
|
|||
# Check that there's indeed some packages to upgrade
|
||||
upgradables = list(_list_upgradable_apt_packages())
|
||||
if not upgradables:
|
||||
logger.info(m18n.n('packages_no_upgrade'))
|
||||
logger.info(m18n.n('already_up_to_date'))
|
||||
|
||||
logger.info(m18n.n('upgrading_packages'))
|
||||
operation_logger.start()
|
||||
|
|
Loading…
Add table
Reference in a new issue