[PackageKit-commit] packagekit: Branch 'master' - 8 commits

Richard Hughes hughsient at kemper.freedesktop.org
Wed Jun 4 01:20:45 PDT 2008


 RELEASE                                 |    2 
 backends/yum/helpers/yumBackend.py      |   32 ++++++--
 backends/yum2/helpers/yumDBUSBackend.py |   78 ++++++++++++--------
 po/pl.po                                |  120 ++++++++++++++++----------------
 4 files changed, 129 insertions(+), 103 deletions(-)

New commits:
commit c6f7ccd61a2c6d882ac4ef07dd4f13e51f6e5d88
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jun 4 09:12:11 2008 +0100

    yum2: fix reporting of details from yumbase, just like we did for the yum backend

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 8a20f52..9f00e08 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -911,9 +911,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.Finished(EXIT_FAILED)
             return
         except yum.Errors.YumBaseError, ye:
-            retmsg = "Could not install package:\n" + ye.value
             self._unlock_yum()
-            self.ErrorCode(ERROR_TRANSACTION_ERROR,retmsg)
+            self.ErrorCode(ERROR_TRANSACTION_ERROR,self._format_msgs(ye.value))
             self.Finished(EXIT_FAILED)
             return
 
@@ -1732,6 +1731,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 self.require_restart(RESTART_SYSTEM,"")
                 break
 
+    def _format_msgs(self,msgs):
+        if isinstance(msgs,basestring):
+             msgs = msgs.split('\n')
+        text = ";".join(msgs)
+        text = text.replace("Missing Dependency: ","")
+        text = text.replace(" (installed)","")
+        return text
+
     def _runYumTransaction(self,removedeps=None):
         '''
         Run the yum Transaction
@@ -1741,18 +1748,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
         rc,msgs =  self.yumbase.buildTransaction()
         if rc !=2:
-            retmsg = "Error in Dependency Resolution\n" +"\n".join(msgs)
             self._unlock_yum()
-            self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+            self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
             self.Finished(EXIT_FAILED)
             return False
 
         self._check_for_reboot()
 
         if removedeps == False and len(self.yumbase.tsInfo) > 1:
-            retmsg = 'package could not be removed, as other packages depend on it'
             self._unlock_yum()
-            self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+            self.ErrorCode(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
             self.Finished(EXIT_FAILED)
             return False
 
@@ -1762,15 +1767,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.yumbase.processTransaction(callback=callback,
                                             rpmDisplay=rpmDisplay)
         except yum.Errors.YumDownloadError, ye:
-            retmsg = "Error in Download\n" + "\n".join(ye.value)
             self._unlock_yum()
-            self.ErrorCode(ERROR_PACKAGE_DOWNLOAD_FAILED,retmsg)
+            self.ErrorCode(ERROR_PACKAGE_DOWNLOAD_FAILED,self._format_msgs(ye.value))
             self.Finished(EXIT_FAILED)
             return False
         except yum.Errors.YumGPGCheckError, ye:
-            retmsg = "Error in Package Signatures\n" +"\n".join(ye.value)
             self._unlock_yum()
-            self.ErrorCode(ERROR_BAD_GPG_SIGNATURE,retmsg)
+            self.ErrorCode(ERROR_BAD_GPG_SIGNATURE,self._format_msgs(ye.value))
             self.Finished(EXIT_FAILED)
             return False
         except GPGKeyNotImported, e:
@@ -1795,9 +1798,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.Finished(EXIT_FAILED)
             return False
         except yum.Errors.YumBaseError, ye:
-            retmsg = "Error in Transaction Processing\n" + "\n".join(ye.value)
             self._unlock_yum()
-            self.ErrorCode(ERROR_TRANSACTION_ERROR,retmsg)
+            self.ErrorCode(ERROR_TRANSACTION_ERROR,self._format_msgs(ye.value))
             self.Finished(EXIT_FAILED)
             return False
 
commit b8e5b9f3b01a9b871e14ed056a5c50e0e69e4444
Merge: a8e6699... 37726ca...
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jun 4 09:09:45 2008 +0100

    Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit

commit 37726ca00b493ba67f06bbd5f3d482ddd168db43
Author: Piotr DrÄ…g <piotrdrag at gmail.com>
Date:   Tue Jun 3 18:34:03 2008 +0000

    2008-06-03  Piotr DrÄ…g <piotrdrag at gmail.com> (via raven at fedoraproject.org)
    
      * po/pl.po: Updated Polish translation

diff --git a/po/pl.po b/po/pl.po
index 5fef406..1ca23c3 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -5,49 +5,49 @@ msgid ""
 msgstr ""
 "Project-Id-Version: pl\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-03 01:34+0000\n"
-"PO-Revision-Date: 2008-05-03 15:25+0200\n"
+"POT-Creation-Date: 2008-06-03 09:39+0000\n"
+"PO-Revision-Date: 2008-06-03 20:30+0200\n"
 "Last-Translator: Piotr DrÄ…g <piotrdrag at gmail.com>\n"
 "Language-Team: Polish <pl at li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: ../client/pk-console.c:224
+#: ../client/pk-console.c:223
 msgid "Update detail"
 msgstr "Szczegóły aktualizacji"
 
-#: ../client/pk-console.c:425
+#: ../client/pk-console.c:424
 msgid "A system restart is required"
 msgstr "Wymagane jest ponowne uruchomienie systemu"
 
-#: ../client/pk-console.c:427
+#: ../client/pk-console.c:426
 msgid "A logout and login is required"
 msgstr "Wymagane jest wylogowanie siÄ™ i ponowne zalogowanie"
 
-#: ../client/pk-console.c:429
+#: ../client/pk-console.c:428
 msgid "An application restart is required"
 msgstr "Wymagane jest ponowne uruchomienie aplikacji"
 
-#: ../client/pk-console.c:474
+#: ../client/pk-console.c:473
 #, c-format
 msgid "Please enter a number from 1 to %i: "
 msgstr "Proszę podać numer od 1 do %i: "
 
-#: ../client/pk-console.c:524
+#: ../client/pk-console.c:533
 msgid "Could not find a package match"
 msgstr "Nie można znaleźć pasującego pakietu"
 
-#: ../client/pk-console.c:538
+#: ../client/pk-console.c:547
 msgid "There are multiple package matches"
 msgstr "Pasuje kilka pakietów"
 
 #. find out what package the user wants to use
-#: ../client/pk-console.c:545
+#: ../client/pk-console.c:554
 msgid "Please enter the package number: "
 msgstr "Proszę podać numer pakietu: "
 
-#: ../client/pk-console.c:561
+#: ../client/pk-console.c:589
 msgid ""
 "Could not find a package with that name to install, or package already "
 "installed"
@@ -55,179 +55,179 @@ msgstr ""
 "Nie można znaleźć pakietu o tej nazwie do zainstalowania, lub pakiet jest "
 "już zainstalowany"
 
-#: ../client/pk-console.c:643
-msgid "Could not find a package with that name to remove"
-msgstr "Nie można znaleźć pakietu o tej nazwie do usunięcia"
+#: ../client/pk-console.c:737
+msgid "Could not find a package to remove"
+msgstr "Nie można znaleźć pakietu do usunięcia"
 
-#: ../client/pk-console.c:683
+#: ../client/pk-console.c:806
 msgid "The following packages have to be removed"
 msgstr "Następujące pakiety muszą zostać usunięte"
 
 #. get user input
-#: ../client/pk-console.c:692
+#: ../client/pk-console.c:815
 msgid "Okay to remove additional packages?"
 msgstr "Usunąć dodatkowe pakiety?"
 
-#: ../client/pk-console.c:696
+#: ../client/pk-console.c:819
 msgid "Cancelled!"
 msgstr "Anulowano!"
 
-#: ../client/pk-console.c:718
+#: ../client/pk-console.c:844
 msgid "Could not find a package with that name to update"
 msgstr "Nie można znaleźć pakietu o tej nazwie do zaktualizowania"
 
-#: ../client/pk-console.c:736
+#: ../client/pk-console.c:862
 msgid "Could not find what packages require this package"
 msgstr "Nie można znaleźć pakietów, które wymagają tego pakietu"
 
-#: ../client/pk-console.c:754
+#: ../client/pk-console.c:880
 msgid "Could not get dependencies for this package"
 msgstr "Nie można uzyskać zależności tego pakietu"
 
-#: ../client/pk-console.c:772
+#: ../client/pk-console.c:898
 msgid "Could not find details for this package"
 msgstr "Nie można znaleźć szczegółów tego pakietu"
 
-#: ../client/pk-console.c:790
+#: ../client/pk-console.c:916
 msgid "Could not find the files for this package"
 msgstr "Nie można znaleźć plików tego pakietu"
 
-#: ../client/pk-console.c:870
+#: ../client/pk-console.c:996
 msgid "Package description"
 msgstr "Opis pakietu"
 
-#: ../client/pk-console.c:893
+#: ../client/pk-console.c:1019
 msgid "Package files"
 msgstr "Pliki pakiety"
 
-#: ../client/pk-console.c:901
+#: ../client/pk-console.c:1027
 msgid "No files"
 msgstr "Brak plików"
 
 #. get user input
-#: ../client/pk-console.c:933
+#: ../client/pk-console.c:1059
 msgid "Okay to import key?"
 msgstr "Zaimportować klucz?"
 
-#: ../client/pk-console.c:936
+#: ../client/pk-console.c:1062
 msgid "Did not import key"
 msgstr "Nie zaimportowano klucza"
 
 #. get user input
-#: ../client/pk-console.c:976
+#: ../client/pk-console.c:1102
 msgid "Do you agree?"
 msgstr "Zgadzasz siÄ™?"
 
-#: ../client/pk-console.c:979
+#: ../client/pk-console.c:1105
 msgid "Did not agree to licence, task will fail"
 msgstr "Nie zaakceptowano licencji, zadanie nie powiedzie siÄ™"
 
-#: ../client/pk-console.c:1008
+#: ../client/pk-console.c:1134
 msgid "The daemon crashed mid-transaction!"
 msgstr "Demon zawiesił się w połowie transakcji!"
 
 #. header
-#: ../client/pk-console.c:1061
+#: ../client/pk-console.c:1187
 msgid "PackageKit Console Interface"
 msgstr "Interfejs konsoli PackageKit"
 
-#: ../client/pk-console.c:1061
+#: ../client/pk-console.c:1187
 msgid "Subcommands:"
 msgstr "Podpolecenia:"
 
-#: ../client/pk-console.c:1165 ../client/pk-monitor.c:104 ../src/pk-main.c:189
+#: ../client/pk-console.c:1290 ../client/pk-monitor.c:104 ../src/pk-main.c:189
 msgid "Show extra debugging information"
 msgstr "Wyświetla dodatkowe informacje o debugowaniu"
 
-#: ../client/pk-console.c:1167 ../client/pk-monitor.c:106
+#: ../client/pk-console.c:1292 ../client/pk-monitor.c:106
 msgid "Show the program version and exit"
 msgstr "Wyświetla wersję programu i wyłącza"
 
-#: ../client/pk-console.c:1169
+#: ../client/pk-console.c:1294
 msgid "Set the filter, e.g. installed"
 msgstr "Ustawia filtr, np. zainstalowane"
 
-#: ../client/pk-console.c:1171
+#: ../client/pk-console.c:1296
 msgid "Exit without waiting for actions to complete"
 msgstr "Wyłącza bez oczekiwania na zakończenie działań"
 
-#: ../client/pk-console.c:1194
+#: ../client/pk-console.c:1319
 msgid "Could not connect to system DBUS."
 msgstr "Nie można połączyć się z systemowym D-Bus."
 
-#: ../client/pk-console.c:1288
+#: ../client/pk-console.c:1413
 msgid "You need to specify a search type"
 msgstr "Należy podać typ wyszukiwania"
 
-#: ../client/pk-console.c:1293 ../client/pk-console.c:1300
-#: ../client/pk-console.c:1307 ../client/pk-console.c:1314
-#: ../client/pk-console.c:1421 ../client/pk-console.c:1428
-#: ../client/pk-console.c:1435 ../client/pk-console.c:1442
+#: ../client/pk-console.c:1418 ../client/pk-console.c:1425
+#: ../client/pk-console.c:1432 ../client/pk-console.c:1439
+#: ../client/pk-console.c:1538 ../client/pk-console.c:1545
+#: ../client/pk-console.c:1552 ../client/pk-console.c:1559
 msgid "You need to specify a search term"
 msgstr "Należy podać termin wyszukiwania"
 
-#: ../client/pk-console.c:1319
+#: ../client/pk-console.c:1444
 msgid "Invalid search type"
 msgstr "Nieprawidłowy typ wyszukiwania"
 
-#: ../client/pk-console.c:1324
+#: ../client/pk-console.c:1449
 msgid "You need to specify a package or file to install"
 msgstr "Należy podać pakiet lub plik do zainstalowania"
 
-#: ../client/pk-console.c:1339
+#: ../client/pk-console.c:1456
 msgid "You need to specify a type, key_id and package_id"
 msgstr "Należy podać typ, key_id i package_id"
 
-#: ../client/pk-console.c:1346
+#: ../client/pk-console.c:1463
 msgid "You need to specify a package to remove"
 msgstr "Należy podać pakiet do usunięcia"
 
-#: ../client/pk-console.c:1353
+#: ../client/pk-console.c:1470
 msgid "You need to specify a eula-id"
 msgstr "Należy podać eula-id"
 
-#: ../client/pk-console.c:1369
+#: ../client/pk-console.c:1486
 msgid "You need to specify a package name to resolve"
 msgstr "Należy podać nazwę pakietu do rozwiązania"
 
-#: ../client/pk-console.c:1376 ../client/pk-console.c:1383
+#: ../client/pk-console.c:1493 ../client/pk-console.c:1500
 msgid "You need to specify a repo name"
 msgstr "Należy podać nazwę repozytorium"
 
-#: ../client/pk-console.c:1390
+#: ../client/pk-console.c:1507
 msgid "You need to specify a repo name/parameter and value"
 msgstr "Należy podać nazwę/parametr repozytorium i wartość"
 
-#: ../client/pk-console.c:1403
+#: ../client/pk-console.c:1520
 msgid "You need to specify a time term"
 msgstr "Należy podać termin czasu"
 
-#: ../client/pk-console.c:1408
+#: ../client/pk-console.c:1525
 msgid "You need to specify a correct role"
 msgstr "Należy podać poprawną rolę"
 
-#: ../client/pk-console.c:1413
+#: ../client/pk-console.c:1530
 msgid "Failed to get last time"
 msgstr "Uzyskanie ostatniego czasu nie powiodło się"
 
-#: ../client/pk-console.c:1449
+#: ../client/pk-console.c:1566
 msgid "You need to specify a package to find the details for"
 msgstr "Należy podać pakiet do znalezienia szczegółów dla"
 
-#: ../client/pk-console.c:1456
+#: ../client/pk-console.c:1573
 msgid "You need to specify a package to find the files for"
 msgstr "Należy podać pakiet do znalezienia plików dla"
 
-#: ../client/pk-console.c:1503
+#: ../client/pk-console.c:1622
 #, c-format
 msgid "Option '%s' not supported"
 msgstr "Opcja \"%s\" nie jest obsługiwana"
 
-#: ../client/pk-console.c:1514
+#: ../client/pk-console.c:1633
 msgid "Command failed"
 msgstr "Polecenie nie powiodło się"
 
-#: ../client/pk-console.c:1518
+#: ../client/pk-console.c:1637
 msgid "You don't have the necessary privileges for this operation"
 msgstr "Nie posiadasz niezbędnych uprawnień dla tej operacji"
 
@@ -235,12 +235,12 @@ msgstr "Nie posiadasz niezbędnych uprawnień dla tej operacji"
 msgid "PackageKit Monitor"
 msgstr "Monitor PackageKit"
 
-#: ../client/pk-import-desktop.c:293 ../client/pk-import-specspo.c:169
+#: ../client/pk-import-desktop.c:298 ../client/pk-import-specspo.c:173
 #, c-format
 msgid "Could not open database: %s"
 msgstr "Nie można otworzyć bazy danych: %s"
 
-#: ../client/pk-import-desktop.c:294 ../client/pk-import-specspo.c:170
+#: ../client/pk-import-desktop.c:299 ../client/pk-import-specspo.c:174
 msgid "You probably need to run this program as the root user"
 msgstr "Prawdopodobnie należy uruchomić ten program jako użytkownik root"
 
commit a8e66992b7901010fa91128babce5054dce522e9
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jun 3 15:29:03 2008 +0100

    yum: fallback to i686 for i386 arch packages to prevent warning the user glibc.i386 is going to be downloaded when the i686 package exists

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index ca711c7..48903e4 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -686,8 +686,22 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                             self._show_package(txmbr.po,INFO_INSTALLED)
 
     def _is_inst(self,pkg):
+        # search only for requested arch
         return self.yumbase.rpmdb.installed(po=pkg)
 
+    def _is_inst_arch(self,pkg):
+        # search for a requested arch first
+        ret = self._is_inst(pkg)
+        if ret:
+            return True;
+
+        # then fallback to i686 if i386
+        if pkg.arch == 'i386':
+            pkg.arch = 'i686'
+            ret = self._is_inst(pkg)
+            pkg.arch = 'i386'
+        return ret
+
     def _installable(self,pkg,ematch=False):
 
         """check if the package is reasonably installable, true/false"""
@@ -696,7 +710,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         # we look through each returned possibility and rule out the
         # ones that we obviously can't use
 
-        if self._is_inst(pkg):
+        if self._is_inst_arch(pkg):
             return False
 
         # everything installed that matches the name
@@ -783,7 +797,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 pkgver = self._get_package_ver(pkg)
                 id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repoid)
 
-                if self._is_inst(pkg) and FILTER_NOT_INSTALLED not in fltlist:
+                if self._is_inst_arch(pkg) and FILTER_NOT_INSTALLED not in fltlist:
                     self.package(id,INFO_INSTALLED,pkg.summary)
                 else:
                     if self._installable(pkg) and FILTER_INSTALLED not in fltlist:
@@ -1011,7 +1025,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             self.error(ERROR_INVALID_PACKAGE_FILE, "%s does not appear to be a valid package." % pkg)
             return False
 
-        if self._is_inst(po):
+        if self._is_inst_arch(po):
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "The package %s is already installed" % str(po))
             return False
 
commit 7bf1128f0516968fde416c3b958feb8bb4fc71c4
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jun 3 14:43:13 2008 +0100

    trivial: tiny correction to URL in RELEASE

diff --git a/RELEASE b/RELEASE
index bd0cc2e..ef8e5bb 100644
--- a/RELEASE
+++ b/RELEASE
@@ -44,7 +44,7 @@ Today I released PackageKit and gnome-packagekit 0.2.2.
 PackageKit release notes: http://gitweb.freedesktop.org/?p=packagekit.git;a=blob;f=NEWS
 gnome-packagekit release notes: http://gitweb.freedesktop.org/?p=users/hughsient/gnome-packagekit.git;a=blob;f=NEWS
 
-Tarballs available here: http://people.freedesktop.org/~hughsient/releases/
+Tarballs available here: http://www.packagekit.org/releases/
 Thanks to all those who made this possible.
 =================================================
 
commit 93a449d42c0467c2f4090289b5c4a2f070993260
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jun 3 14:32:14 2008 +0100

    yum: when we searchNevra make sure we pass in the arch to try to fix rh#447957

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index bdd70e5..ca711c7 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -700,7 +700,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             return False
 
         # everything installed that matches the name
-        installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name)
+        installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
         comparable = []
         for instpo in installedByKey:
             if rpmUtils.arch.isMultiLibArch(instpo.arch) == rpmUtils.arch.isMultiLibArch(pkg.arch):
@@ -1354,7 +1354,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
     def _get_updated(self,pkg):
         updated = None
-        pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name)
+        pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
         if pkgs:
             return self._pkg_to_id(pkgs[0])
         else:
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index b8295be..8a20f52 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -1657,7 +1657,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             return False
 
         # everything installed that matches the name
-        installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name)
+        installedByKey = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
         comparable = []
         for instpo in installedByKey:
             if rpmUtils.arch.isMultiLibArch(instpo.arch) == rpmUtils.arch.isMultiLibArch(pkg.arch):
@@ -1875,7 +1875,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
 
     def _get_updated(self,pkg):
         updated = None
-        pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name)
+        pkgs = self.yumbase.rpmdb.searchNevra(name=pkg.name,arch=pkg.arch)
         if pkgs:
             return self._pkg_to_id(pkgs[0])
         else:
commit 9e2e8562f85f8234567dc6c6a1226e2e4e41a5ac
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jun 3 14:23:28 2008 +0100

    yum: be more specific when we specify a package to yumbase as sometimes we match the wrong one. Fixes rh#447767

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index d70d8dc..bdd70e5 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -675,7 +675,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         # FIXME: This is a hack, it simulates a removal of the
         # package and return the transaction
         if inst and pkg:
-            txmbrs = self.yumbase.remove(name=pkg.name)
+            txmbrs = self.yumbase.remove(po=pkg)
             if txmbrs:
                 rc,msgs =  self.yumbase.buildTransaction()
                 if rc !=2:
@@ -903,7 +903,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 if not already_warned and not repo.gpgcheck:
                     self.message(MESSAGE_WARNING,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
                     already_warned = True
-                txmbr = self.yumbase.install(name=pkg.name)
+                txmbr = self.yumbase.install(po=pkg)
                 txmbrs.extend(txmbr)
             if inst:
                 self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"The package %s is already installed", pkg.name)
@@ -1038,7 +1038,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             for package in packages:
                 pkg,inst = self._findPackage(package)
                 if pkg:
-                    txmbr = self.yumbase.update(name=pkg.name)
+                    txmbr = self.yumbase.update(po=pkg)
                     txmbrs.extend(txmbr)
         except yum.Errors.RepoError,e:
             self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
@@ -1135,7 +1135,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         pkg,inst = self._findPackage(package)
         if pkg and inst:
             try:
-                txmbr = self.yumbase.remove(name=pkg.name)
+                txmbr = self.yumbase.remove(po=pkg)
             except yum.Errors.RepoError,e:
                 self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
             if txmbr:
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index b124b9c..b8295be 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -833,7 +833,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
                 if not already_warned and not repo.gpgcheck:
                     self.message(MESSAGE_WARNING,"The untrusted package %s will be installed from %s." % (pkg.name, repo))
                     already_warned = True
-                txmbr = self.yumbase.install(name=pkg.name)
+                txmbr = self.yumbase.install(po=pkg)
                 txmbrs.extend(txmbr)
             if inst:
                 self._unlock_yum()
@@ -934,21 +934,21 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.StatusChanged(STATUS_RUNNING)
 
         for package_id in packages:
-            package, installed = self._findPackage(package_id)
+            pkg,inst = self._findPackage(package_id)
 
-            if not package:
+            if not pkg:
                 self._unlock_yum()
                 self.ErrorCode(ERROR_PACKAGE_NOT_FOUND, "%s could not be found." % package_id)
                 self.Finished(EXIT_FAILED)
                 return
 
-            if installed:
+            if inst:
                 self._unlock_yum()
                 self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED, "%s is already installed." % package_id)
                 self.Finished(EXIT_FAILED)
                 return
 
-            txmbr = self.yumbase.update(po=package)
+            txmbr = self.yumbase.update(po=pkg)
 
             if not txmbr:
                 self._unlock_yum()
@@ -983,7 +983,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         for package in packages:
             pkg,inst = self._findPackage(package)
             if pkg and inst:
-                txmbr = self.yumbase.remove(name=pkg.name)
+                txmbr = self.yumbase.remove(po=pkg)
                 txmbrs.extend(txmbr)
             if not inst:
                 self._unlock_yum()
commit 8fa5f820b95db085ac19dcd0c679e2fa59adb6ac
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jun 3 13:17:15 2008 +0100

    yum2: fix RemovePackages to work with more than one package_id

diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 3406b8b..b124b9c 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -979,30 +979,40 @@ class PackageKitYumBackend(PackageKitBaseBackend):
         self.PercentageChanged(0)
         self.StatusChanged(STATUS_RUNNING)
 
-        pkg,inst = self._findPackage( package)
-        if pkg and inst:
-            txmbr = self.yumbase.remove(name=pkg.name)
-            if txmbr:
+        txmbrs = []
+        for package in packages:
+            pkg,inst = self._findPackage(package)
+            if pkg and inst:
+                txmbr = self.yumbase.remove(name=pkg.name)
+                txmbrs.extend(txmbr)
+            if not inst:
+                self._unlock_yum()
+                self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,"The package %s is not installed", pkg.name)
+                self.Finished(EXIT_FAILED)
+                return
+        if txmbrs:
+            try:
                 if allowdep:
                     successful = self._runYumTransaction(removedeps=True)
-                    if not successful:
-                        return
                 else:
                     successful = self._runYumTransaction(removedeps=False)
-                    if not successful:
-                        return
-            else:
+                if not successful:
+                    # _runYumTransaction unlocked yum, set the error code, and called Finished.
+                    return
+            except yum.Errors.RemoveError,e:
+                msgs = '\n'.join(e)
                 self._unlock_yum()
-                self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+                self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,msgs)
                 self.Finished(EXIT_FAILED)
                 return
-
-            self._unlock_yum()
-            self.Finished(EXIT_SUCCESS)
         else:
             self._unlock_yum()
-            self.ErrorCode(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+            self.ErrorCode(ERROR_PACKAGE_ALREADY_INSTALLED,"The packages failed to be removed")
             self.Finished(EXIT_FAILED)
+            return
+
+        self._unlock_yum()
+        self.Finished(EXIT_SUCCESS)
         return
 
     @threaded


More information about the PackageKit-commit mailing list