From: Michael Tremer Date: Sun, 6 Mar 2011 14:14:31 +0000 (+0000) Subject: Add update functionality to command line. X-Git-Tag: 0.9.3~89^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a412c9893235e0ada1866ac6fc8f99d63d7ae53b;p=pakfire.git Add update functionality to command line. --- diff --git a/pakfire/__init__.py b/pakfire/__init__.py index cc1f4dabc..8f7d1afd6 100644 --- a/pakfire/__init__.py +++ b/pakfire/__init__.py @@ -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 = [] diff --git a/pakfire/cli.py b/pakfire/cli.py index f578d1d47..abf05bd59 100644 --- a/pakfire/cli.py +++ b/pakfire/cli.py @@ -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: diff --git a/po/pakfire.pot b/po/pakfire.pot index 80ec7cc74..cc0f7439a 100644 --- a/po/pakfire.pot +++ b/po/pakfire.pot @@ -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 \n" "Language-Team: LANGUAGE \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 ""