From: Michael Tremer Date: Mon, 21 Jun 2021 10:40:50 +0000 (+0000) Subject: cli: Remove using pakfire in context X-Git-Tag: 0.9.28~1218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74fe39d39ea2f37b58e48af1fdd989b8a858cdaa;p=pakfire.git cli: Remove using pakfire in context Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/cli.py b/src/pakfire/cli.py index 59e5cc0a7..c16e2196a 100644 --- a/src/pakfire/cli.py +++ b/src/pakfire/cli.py @@ -265,19 +265,21 @@ class Cli(object): return e.exit_code def handle_info(self, ns): - with self.pakfire(ns) as p: - for pkg in p.info(ns.package): - s = pkg.dump(long=ns.long) - print(s) + p = self.pakfire(ns) + + for pkg in p.info(ns.package): + s = pkg.dump(long=ns.long) + print(s) def handle_search(self, ns): - with self.pakfire(ns) as p: - for pkg in p.search(ns.pattern): - # Skip any -debuginfo packages - if pkg.name.endswith("-debuginfo"): - continue + p = self.pakfire(ns) - print("%-24s: %s" % (pkg.name, pkg.summary)) + for pkg in p.search(ns.pattern): + # Skip any -debuginfo packages + if pkg.name.endswith("-debuginfo"): + continue + + print("%-24s: %s" % (pkg.name, pkg.summary)) def handle_update(self, ns): p = self.pakfire(ns) @@ -324,20 +326,20 @@ class Cli(object): p.erase(ns.package) def handle_provides(self, ns, long=False): - with self.pakfire(ns) as p: - for pkg in p.provides(ns.pattern): - s = pkg.dump(long=long) - print(s) + for pkg in self.pakfire(ns).whatprovides(ns.pattern): + s = pkg.dump(long=long) + print(s) def handle_repolist(self, ns): - with self.pakfire(ns) as p: - FORMAT = " %-20s %8s %12s %12s " - title = FORMAT % (_("Repository"), _("Enabled"), _("Priority"), _("Packages")) - print(title) - print("=" * len(title)) # spacing line + p = self.pakfire(ns) + + FORMAT = " %-20s %8s %12s %12s " + title = FORMAT % (_("Repository"), _("Enabled"), _("Priority"), _("Packages")) + print(title) + print("=" * len(title)) # spacing line - for repo in p.repos: - print(FORMAT % (repo.name, repo.enabled, repo.priority, len(repo))) + for repo in p.repos: + print(FORMAT % (repo.name, repo.enabled, repo.priority, len(repo))) def handle_clean(self, ns): print(_("Cleaning up everything..."))