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

index 07f63d2e3250615268c5f9a964465cce513842a7..3d45e340f14ed6fccd0a2b6a889ef93a418da8a9 100644 (file)
@@ -426,23 +426,6 @@ class Pakfire(object):
                # Process the transaction.
                t.run()
 
-       def search(self, pattern):
-               # Do the search.
-               pkgs = {}
-               for solv in self.pool.search(pattern, satsolver.SEARCH_STRING|satsolver.SEARCH_FILES):
-                       pkg = packages.SolvPackage(self, solv)
-
-                       # Check, if a package with the name is already in the resultset
-                       # and always replace older ones by more recent ones.
-                       if pkg.name in pkgs:
-                               if pkgs[pkg.name] < pkg:
-                                       pkgs[pkg.name] = pkg
-                       else:
-                               pkgs[pkg.name] = pkg
-
-               # Return a list of the packages, alphabetically sorted.
-               return sorted(pkgs.values())
-
        def groupinstall(self, group, **kwargs):
                self.install("@%s" % group, **kwargs)
 
@@ -559,6 +542,23 @@ class PakfireContext(object):
 
                return sorted(pkgs)
 
+       def search(self, pattern):
+               # Do the search.
+               pkgs = {}
+               for solv in self.pakfire.pool.search(pattern, satsolver.SEARCH_STRING|satsolver.SEARCH_FILES):
+                       pkg = packages.SolvPackage(self.pakfire, solv)
+
+                       # Check, if a package with the name is already in the resultset
+                       # and always replace older ones by more recent ones.
+                       if pkg.name in pkgs:
+                               if pkgs[pkg.name] < pkg:
+                                       pkgs[pkg.name] = pkg
+                       else:
+                               pkgs[pkg.name] = pkg
+
+               # Return a list of the packages, alphabetically sorted.
+               return sorted(pkgs.values())
+
 
 class PakfireBuilder(Pakfire):
        mode = "builder"