]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Make localinstall command work again.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Apr 2011 13:01:59 +0000 (13:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 30 Apr 2011 13:01:59 +0000 (13:01 +0000)
pakfire/api.py
pakfire/base.py
pakfire/cli.py
po/pakfire.pot

index 6757e52f662468034df292066de6391ebb92f272..940de91fef4f44d4516bc860bb35b071a3058bcb 100644 (file)
@@ -11,6 +11,11 @@ def install(requires, **pakfire_args):
 
        return pakfire.install(requires)
 
+def localinstall(files, **pakfire_args):
+       pakfire = Pakfire(**pakfire_args)
+
+       return pakfire.localinstall(files)
+
 def remove(**pakfire_args):
        pass
 
index cc8d66c1f7ecbc36c408ba847db80cc57931563f..5ea411150648d60debdb8946221f7e46c548f81e 100644 (file)
@@ -98,6 +98,45 @@ class Pakfire(object):
 
                t.run()
 
+       def localinstall(self, files):
+               repo_name = "localinstall"
+
+               # Create a new repository that holds all packages we passed on
+               # the commandline.
+               repo = self.solver.pool.create_repo(repo_name)
+
+               # Open all passed files and try to open them.
+               for file in files:
+                       pkg = packages.open(self, None, file)
+
+                       if not isinstance(pkg, packages.BinaryPackage):
+                               logging.warning("Skipping package which is a wrong format: %s" % file)
+                               continue
+
+                       # Add the package information to the solver.
+                       self.solver.add_package(pkg, repo_name)
+
+               # Break if no packages were added at all.
+               if not repo.size():
+                       logging.critical("There are no packages to install.")
+                       return
+
+               # Create a new request which contains all solvabled from the CLI and
+               # try to solve it.
+               request = self.solver.create_request()
+               for solvable in repo:
+                       print solvable
+                       request.install(solvable)
+
+               t = self.solver.solve(request)
+
+               # If solving was not possible, we exit here.
+               if not t:
+                       return
+
+               # Otherwise we run the transcation.
+               t.run()
+
        def update(self, pkgs):
                # XXX needs to be done
                pass
index a7f8d7e764ff0b9e0ac8f20dadea68dda2ee9087..8de62a3c63dc2e32e57dc422069163015e85d071 100644 (file)
@@ -191,21 +191,11 @@ class Cli(object):
        def handle_update(self):
                pakfire.update(self.args.package, **self.pakfire_args)
 
-       def handle_install(self, local=False):
-               if local:
-                       repo = repository.FileSystemRepository(self.pakfire)
-
-               pkgs = []
-               for pkg in self.args.package:
-                       if local and os.path.exists(pkg):
-                               pkg = packages.BinaryPackage(self.pakfire, repo, pkg)
-
-                       pkgs.append(pkg)
-
-               pakfire.install(pkgs, **self.pakfire_args)
+       def handle_install(self):
+               pakfire.install(self.args.package, **self.pakfire_args)
 
        def handle_localinstall(self):
-               return self.handle_install(local=True, **self.pakfire_args)
+               pakfire.localinstall(self.args.package, **self.pakfire_args)
 
        def handle_provides(self):
                pkgs = pakfire.provides(self.args.pattern, **self.pakfire_args)
index a2bb874fe8b006d333785ea98f6101ed0554910d..7e8fcb8555e5422ca7b5170260b6237dd8bf9b06 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-04-29 21:17+0200\n"
+"POT-Creation-Date: 2011-04-30 12:49+0000\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -114,7 +114,7 @@ msgstr ""
 msgid "Package"
 msgstr ""
 
-#: ../pakfire/repository/transaction.py:278 ../pakfire/cli.py:237
+#: ../pakfire/repository/transaction.py:278 ../pakfire/cli.py:227
 msgid "Repository"
 msgstr ""
 
@@ -264,94 +264,94 @@ msgstr ""
 msgid "List all currently enabled repositories."
 msgstr ""
 
-#: ../pakfire/cli.py:237
+#: ../pakfire/cli.py:227
 msgid "Enabled"
 msgstr ""
 
-#: ../pakfire/cli.py:237
+#: ../pakfire/cli.py:227
 msgid "Priority"
 msgstr ""
 
-#: ../pakfire/cli.py:252
+#: ../pakfire/cli.py:242
 msgid "Pakfire builder command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:294
+#: ../pakfire/cli.py:284
 msgid "Update the package indexes."
 msgstr ""
 
-#: ../pakfire/cli.py:300
+#: ../pakfire/cli.py:290
 msgid "Build one or more packages."
 msgstr ""
 
-#: ../pakfire/cli.py:302
+#: ../pakfire/cli.py:292
 msgid "Give name of at least one package to build."
 msgstr ""
 
-#: ../pakfire/cli.py:306
+#: ../pakfire/cli.py:296
 msgid "Build the package for the given architecture."
 msgstr ""
 
-#: ../pakfire/cli.py:308 ../pakfire/cli.py:330
+#: ../pakfire/cli.py:298 ../pakfire/cli.py:320
 msgid "Path were the output files should be copied to."
 msgstr ""
 
-#: ../pakfire/cli.py:313
+#: ../pakfire/cli.py:303
 msgid "Go into a shell."
 msgstr ""
 
-#: ../pakfire/cli.py:315
+#: ../pakfire/cli.py:305
 msgid "Give name of a package."
 msgstr ""
 
-#: ../pakfire/cli.py:319
+#: ../pakfire/cli.py:309
 msgid "Emulated architecture in the shell."
 msgstr ""
 
-#: ../pakfire/cli.py:324
+#: ../pakfire/cli.py:314
 msgid "Generate a source package."
 msgstr ""
 
-#: ../pakfire/cli.py:326
+#: ../pakfire/cli.py:316
 msgid "Give name(s) of a package(s)."
 msgstr ""
 
-#: ../pakfire/cli.py:395
+#: ../pakfire/cli.py:385
 msgid "Pakfire repo command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:414
+#: ../pakfire/cli.py:404
 msgid "Repository management commands."
 msgstr ""
 
-#: ../pakfire/cli.py:422
+#: ../pakfire/cli.py:412
 msgid "Create a new repository index."
 msgstr ""
 
-#: ../pakfire/cli.py:423
+#: ../pakfire/cli.py:413
 msgid "Path to the packages."
 msgstr ""
 
-#: ../pakfire/cli.py:424
+#: ../pakfire/cli.py:414
 msgid "Path to input packages."
 msgstr ""
 
-#: ../pakfire/cli.py:436
+#: ../pakfire/cli.py:426
 msgid "Pakfire master command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:458
+#: ../pakfire/cli.py:448
 msgid "Update the sources."
 msgstr ""
 
-#: ../pakfire/cli.py:468
+#: ../pakfire/cli.py:458
 msgid "Pakfire slave command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:492
+#: ../pakfire/cli.py:482
 msgid "Request a build job from the server."
 msgstr ""
 
-#: ../pakfire/cli.py:498
+#: ../pakfire/cli.py:488
 msgid "Send a keepalive to the server."
 msgstr ""