From: Michael Tremer Date: Wed, 7 Dec 2016 21:46:37 +0000 (+0100) Subject: Move check() to PakfireContext X-Git-Tag: 0.9.28~1285^2~1382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dc4873ea9bda144dba1964558b416a5453b5ed0;p=pakfire.git Move check() to PakfireContext Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/base.py b/src/pakfire/base.py index 3d45e340f..0fdb991d6 100644 --- a/src/pakfire/base.py +++ b/src/pakfire/base.py @@ -458,37 +458,6 @@ class Pakfire(object): # Clean up repository caches. self.repos.clean() - def check(self, allow_downgrade=True, allow_uninstall=True): - """ - Try to fix any errors in the system. - """ - # Detect any errors in the dependency tree. - # For that we create an empty request and solver and try to solve - # something. - request = self.pool.create_request() - request.verify() - - solver = self.pool.solve( - request, - allow_downgrade=allow_downgrade, - allow_uninstall=allow_uninstall, - ) - - if solver.status is False: - log.info(_("Everything is fine.")) - return - - # Create the transaction. - t = transaction.Transaction.from_solver(self, solver) - t.dump() - - # Ask the user if okay. - if not t.cli_yesno(): - return - - # Process the transaction. - t.run() - def build(self, makefile, resultdir, stages=None, **kwargs): b = builder.Builder(self, makefile, resultdir, **kwargs) @@ -519,6 +488,37 @@ class PakfireContext(object): def __init__(self, pakfire): self.pakfire = pakfire + def check(self, allow_downgrade=True, allow_uninstall=True): + """ + Try to fix any errors in the system. + """ + # Detect any errors in the dependency tree. + # For that we create an empty request and solver and try to solve + # something. + request = self.pakfire.pool.create_request() + request.verify() + + solver = self.pakfire.pool.solve( + request, + allow_downgrade=allow_downgrade, + allow_uninstall=allow_uninstall, + ) + + if solver.status is False: + log.info(_("Everything is fine.")) + return + + # Create the transaction. + t = transaction.Transaction.from_solver(self.pakfire, solver) + t.dump() + + # Ask the user if okay. + if not t.cli_yesno(): + return + + # Process the transaction. + t.run() + def info(self, patterns): pkgs = []