]> git.ipfire.org Git - pakfire.git/commitdiff
Implement "localinstall" command.
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Jul 2011 19:01:57 +0000 (19:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Jul 2011 19:01:57 +0000 (19:01 +0000)
pakfire/base.py
pakfire/repository/index.py
po/pakfire.pot

index 97c4f29e7cf690151c0e329161e7212c14580b8f..e9544771efc043ad2ea84b5ff2b92c149a3fe36e 100644 (file)
@@ -153,33 +153,26 @@ class Pakfire(object):
                t.run()
 
        def localinstall(self, files):
-               repo_name = "localinstall"
+               repo_name = repo_desc = "localinstall"
 
                # Create a new repository that holds all packages we passed on
                # the commandline.
-               repo = self.solver.pool.create_repo(repo_name)
+               repo = repository.RepositoryDir(self, repo_name, repo_desc, ".")
 
-               # Open all passed files and try to open them.
+               # Add all packages to the repository index.
                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)
+                       repo.collect_packages(file)
 
                # Break if no packages were added at all.
-               if not repo.size():
+               if not len(repo):
                        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:
-                       request.install(solvable)
+               # Create a new request that installs all solvables from the
+               # repository.
+               request = self.create_request()
+               for solv in [p.solvable for p in repo]:
+                       request.install(solv)
 
                solver = self.create_solver()
                t = solver.solve(request)
@@ -189,8 +182,8 @@ class Pakfire(object):
                        return
 
                # Ask the user if this is okay.
-               #if not t.cli_yesno():
-               #       return
+               if not t.cli_yesno():
+                       return
 
                # If okay, run the transcation.
                t.run()
index cf6d6676c86d6837017c805d0b46fd851b4d2d5d..57eab3802d68ecb7b95663f4801a4caae06eea0d 100644 (file)
@@ -295,14 +295,18 @@ class IndexDir(Index):
 
                # Get a filelist of all files that could possibly be packages.
                files = []
-               for dir, subdirs, _files in os.walk(path):
-                       for file in sorted(_files):
-                               # Skip files that do not have the right extension
-                               if not file.endswith(".%s" % PACKAGE_EXTENSION):
-                                       continue
 
-                               file = os.path.join(dir, file)
-                               files.append(file)
+               if os.path.isdir(path):
+                       for dir, subdirs, _files in os.walk(path):
+                               for file in sorted(_files):
+                                       # Skip files that do not have the right extension
+                                       if not file.endswith(".%s" % PACKAGE_EXTENSION):
+                                               continue
+
+                                       file = os.path.join(dir, file)
+                                       files.append(file)
+               elif os.path.isfile(path) and path.endswith(".%s" % PACKAGE_EXTENSION):
+                       files.append(path)
 
                if not files:
                        return pkgs
index 389d63ad3a4208bc08290be25f86c93181e024ac..c120265b427d48cc5086c2729b995bf93658804e 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-07-29 17:32+0200\n"
+"POT-Creation-Date: 2011-07-29 18:51+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"
@@ -187,11 +187,11 @@ msgstr ""
 msgid "Build the package for the given architecture."
 msgstr ""
 
-#: ../pakfire/cli.py:318 ../pakfire/cli.py:344
+#: ../pakfire/cli.py:318 ../pakfire/cli.py:342
 msgid "Path were the output files should be copied to."
 msgstr ""
 
-#: ../pakfire/cli.py:320 ../pakfire/cli.py:333
+#: ../pakfire/cli.py:320
 msgid "Mode to run in. Is either 'release' or 'development' (default)."
 msgstr ""
 
@@ -207,55 +207,55 @@ msgstr ""
 msgid "Emulated architecture in the shell."
 msgstr ""
 
-#: ../pakfire/cli.py:338
+#: ../pakfire/cli.py:336
 msgid "Generate a source package."
 msgstr ""
 
-#: ../pakfire/cli.py:340
+#: ../pakfire/cli.py:338
 msgid "Give name(s) of a package(s)."
 msgstr ""
 
-#: ../pakfire/cli.py:416
+#: ../pakfire/cli.py:413
 msgid "Pakfire repo command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:441
+#: ../pakfire/cli.py:438
 msgid "Repository management commands."
 msgstr ""
 
-#: ../pakfire/cli.py:449
+#: ../pakfire/cli.py:446
 msgid "Create a new repository index."
 msgstr ""
 
-#: ../pakfire/cli.py:450
+#: ../pakfire/cli.py:447
 msgid "Path to the packages."
 msgstr ""
 
-#: ../pakfire/cli.py:451
+#: ../pakfire/cli.py:448
 msgid "Path to input packages."
 msgstr ""
 
-#: ../pakfire/cli.py:463
+#: ../pakfire/cli.py:460
 msgid "Pakfire master command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:491
+#: ../pakfire/cli.py:488
 msgid "Update the sources."
 msgstr ""
 
-#: ../pakfire/cli.py:501
+#: ../pakfire/cli.py:498
 msgid "Pakfire server command line interface."
 msgstr ""
 
-#: ../pakfire/cli.py:533
+#: ../pakfire/cli.py:530
 msgid "Request a build job from the server."
 msgstr ""
 
-#: ../pakfire/cli.py:539
+#: ../pakfire/cli.py:536
 msgid "Send a keepalive to the server."
 msgstr ""
 
-#: ../pakfire/cli.py:546
+#: ../pakfire/cli.py:543
 msgid "Update all repositories."
 msgstr ""
 
@@ -333,13 +333,13 @@ msgid "%s: package database"
 msgstr ""
 
 #. Create progress bar.
-#: ../pakfire/repository/index.py:311
+#: ../pakfire/repository/index.py:315
 #, python-format
 msgid "Loading from %s"
 msgstr ""
 
 #. Add all packages from the database to the index.
-#: ../pakfire/repository/index.py:364
+#: ../pakfire/repository/index.py:368
 msgid "Loading installed packages"
 msgstr ""
 
@@ -347,12 +347,6 @@ msgstr ""
 msgid "The solver returned one problem:"
 msgstr ""
 
-#. Print information about the problem to the user.
-#: ../pakfire/satsolver.py:118
-#, python-format
-msgid "  #%d: %s"
-msgstr ""
-
 #. Ask the user if he or she want to modify the request. If not, just exit.
 #: ../pakfire/satsolver.py:126
 msgid "Do you want to manually alter the request?"