From ad7468bf1468a787cd38c7f65cb6ce436e6ea5c0 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Sat, 16 Jun 2018 18:56:00 +0200 Subject: [PATCH] Add a hint on how to reinstall broken packages This is a small usability improvement that shows users what to do when `eopkg check` says that they have broken packages. --- pisi/cli/check.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pisi/cli/check.py b/pisi/cli/check.py index 48d3bcf..7073485 100644 --- a/pisi/cli/check.py +++ b/pisi/cli/check.py @@ -84,6 +84,8 @@ def run(self): necessary_permissions = True + broken_packages = [] + # True if we should also check the configuration files check_config = ctx.get_option('config') @@ -103,6 +105,7 @@ def run(self): if check_results['missing'] or check_results['corrupted'] \ or check_results['config']: ctx.ui.info(util.colorize(_("Broken"), 'brightred')) + broken_packages.append(pkg) elif check_results['denied']: # We can't deduce a result when some files # can't be accessed @@ -134,6 +137,14 @@ def run(self): # Package is not installed ctx.ui.info(_('Package %s not installed') % pkg) + if len(broken_packages) > 0: + broken_packages_str = ' '.join(broken_packages) + + ctx.ui.info("") + ctx.ui.warning(_("Some packages are reported as broken, you may " + "want to repair these packages by running:")) + ctx.ui.warning("sudo eopkg it --reinstall %s" % broken_packages_str) + if not necessary_permissions: ctx.ui.info("") ctx.ui.warning(_("Pisi was unable to check the integrity of "