]> git.ipfire.org Git - pakfire.git/commitdiff
Move check() to PakfireContext
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Dec 2016 21:46:37 +0000 (22:46 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Dec 2016 21:46:37 +0000 (22:46 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/base.py

index 3d45e340f14ed6fccd0a2b6a889ef93a418da8a9..0fdb991d6a386ce1e602049754d321747337c1e7 100644 (file)
@@ -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 = []