]> git.ipfire.org Git - pakfire.git/commitdiff
Add update functionality to command line.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Mar 2011 14:14:31 +0000 (14:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 6 Mar 2011 14:14:31 +0000 (14:14 +0000)
pakfire/__init__.py
pakfire/cli.py
po/pakfire.pot

index cc1f4dabc2fe48804983ff441c5984945eb94ae5..8f7d1afd69d8953a44700204f467bf538545238d 100644 (file)
@@ -206,6 +206,37 @@ class Pakfire(object):
                ts = transaction.Transaction(self, ds)
                ts.run()
 
+       def update(self, pkgs):
+               ds = depsolve.DependencySet(pakfire=self)
+
+               for pkg in ds.packages:
+                       # Skip unwanted packages (passed on command line)
+                       if pkgs and not pkg.name in pkgs:
+                               continue
+
+                       updates = self.repos.get_by_name(pkg.name)
+                       updates = packages.PackageListing(updates)
+
+                       latest = updates.get_most_recent()
+
+                       # If the current package is already the latest
+                       # we skip it.
+                       if latest == pkg:
+                               continue
+
+                       # Otherwise we want to update the package.
+                       ds.add_package(latest)
+
+               ds.resolve()
+               ds.dump()
+
+               ret = cli.ask_user(_("Is this okay?"))
+               if not ret:
+                       return
+
+               ts = transaction.Transaction(self, ds)
+               ts.run()
+
        def provides(self, patterns):
                pkgs = []
 
index f578d1d472bd141690ecdba13906782bffc90e8c..abf05bd59c5190653c51339ccfd45f08af58ab10 100644 (file)
@@ -160,7 +160,7 @@ class Cli(object):
                        print pkg.dump(short=True)
 
        def handle_update(self):
-               pass
+               self.pakfire.update(self.args.package)
 
        def handle_install(self, local=False):
                if local:
index 80ec7cc74757761c0911bd451a7a288203e15142..cc0f7439a5e1efbf892c495c3fa45ce5dc5f80d0 100644 (file)
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-06 11:49+0100\n"
+"POT-Creation-Date: 2011-03-06 12:48+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"
@@ -224,7 +224,7 @@ msgstr ""
 msgid "Total download size: %s"
 msgstr ""
 
-#: ../pakfire/__init__.py:202
+#: ../pakfire/__init__.py:202 ../pakfire/__init__.py:234
 msgid "Is this okay?"
 msgstr ""