[PackageKit-commit] packagekit: Branch 'master' - 12 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Apr 21 15:07:42 PDT 2008
backends/poldek/pk-backend-poldek.c | 118 +++++++-
backends/yum/helpers/yumBackend.py | 359 +++++++++++++-------------
configure.ac | 1
contrib/Makefile.am | 4
contrib/PackageKit.spec.in | 16 +
contrib/udev/.gitignore | 3
contrib/udev/51-packagekit-firmware.rules | 5
contrib/udev/Makefile.am | 11
contrib/udev/packagekit-firmware.sh | 19 +
libpackagekit/pk-control.c | 3
po/LINGUAS | 1
po/pl.po | 401 ++++++++++++++++++++++++++++++
12 files changed, 741 insertions(+), 200 deletions(-)
New commits:
commit b2d762e62f18e785351f6154e7a65a04502d26b9
Author: Piotr DrÄ
g <piotrdrag at gmail.com>
Date: Mon Apr 21 23:06:46 2008 +0100
add Polish Translation
diff --git a/po/LINGUAS b/po/LINGUAS
index 0a0be80..99a4573 100644
--- a/po/LINGUAS
+++ b/po/LINGUAS
@@ -8,4 +8,5 @@ he
nl
fr
it
+pl
diff --git a/po/pl.po b/po/pl.po
new file mode 100644
index 0000000..b4b818c
--- /dev/null
+++ b/po/pl.po
@@ -0,0 +1,401 @@
+# translation of pl.po to Polish
+# Piotr DrÄ
g <piotrdrag at gmail.com>, 2008.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: pl\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2008-04-18 16:49+0100\n"
+"PO-Revision-Date: 2008-04-21 23:59+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"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:1
+msgid "Accept EULA"
+msgstr "Akceptacja EULA"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:2
+msgid "Authentication is required to accept a EULA"
+msgstr "Aby zaakceptowaÄ EULA, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:3
+msgid "Authentication is required to change software source parameters"
+msgstr ""
+"Aby zmieniÄ parametry źródeÅ oprogramowania, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:4
+msgid "Authentication is required to install a local file"
+msgstr "Aby zainstalowaÄ lokalny plik, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:5
+msgid "Authentication is required to install a package"
+msgstr "Aby zainstalowaÄ pakiet, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:6
+msgid "Authentication is required to install a security signature"
+msgstr "Aby zainstalowaÄ podpis bezpieczeÅstwa, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:7
+msgid "Authentication is required to refresh the package lists"
+msgstr "Aby odÅwieżyÄ listÄ pakietów, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:8
+msgid "Authentication is required to remove packages"
+msgstr "Aby usunÄ
Ä pakiety, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:9
+msgid "Authentication is required to rollback a transaction"
+msgstr "Aby przywróciÄ transakcjÄ, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:10
+msgid "Authentication is required to update all packages"
+msgstr "Aby zaktualizowaÄ wszystkie pakiety, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:11
+msgid "Authentication is required to update packages"
+msgstr "Aby zaktualizowaÄ pakiety, wymagane jest uwierzytelnienie"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:12
+msgid "Change software source parameters"
+msgstr "Zmiana parametrów źródeŠoprogramowania"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:13
+msgid "Install local file"
+msgstr "Instalacja lokalnego pliku"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:14
+msgid "Install package"
+msgstr "Instalacja pakietu"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:15
+msgid "Install security signature"
+msgstr "Instalacja podpisu bezpieczeÅstwa"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:16
+msgid "Refresh package lists"
+msgstr "OdÅwieżenie listy pakietów"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:17
+msgid "Remove package"
+msgstr "UsuniÄcie pakietu"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:18
+msgid "Rollback to a previous transaction"
+msgstr "Przywrócenie poprzedniej transakcji"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:19
+msgid "Update all packages"
+msgstr "Aktualizacja wszystkich pakietów"
+
+#: ../policy/org.freedesktop.packagekit.policy.in.h:20
+msgid "Update package"
+msgstr "Aktualizacja pakietu"
+
+#: ../client/pk-console.c:208
+msgid "Update detail"
+msgstr "SzczegóÅy aktualizacji"
+
+#: ../client/pk-console.c:400
+msgid "A system restart is required"
+msgstr "Wymagane jest ponowne uruchomienie systemu"
+
+#: ../client/pk-console.c:402
+msgid "A logout and login is required"
+msgstr "Wymagane jest wylogowanie siÄ i ponowne zalogowanie"
+
+#: ../client/pk-console.c:404
+msgid "An application restart is required"
+msgstr "Wymagane jest ponowne uruchomienie aplikacji"
+
+#: ../client/pk-console.c:443
+#, c-format
+msgid "Please enter a number from 1 to %i: "
+msgstr "ProszÄ podaÄ numer od 1 do %i: "
+
+#: ../client/pk-console.c:493
+msgid "Could not find a package match"
+msgstr "Nie można znaleÅºÄ pasujÄ
cego pakietu"
+
+#: ../client/pk-console.c:507
+msgid "There are multiple package matches"
+msgstr "Pasuje kilka pakietów"
+
+#. find out what package the user wants to use
+#: ../client/pk-console.c:514
+msgid "Please enter the package number: "
+msgstr "ProszÄ podaÄ numer pakietu: "
+
+#: ../client/pk-console.c:530
+msgid ""
+"Could not find a package with that name to install, or package already "
+"installed"
+msgstr ""
+"Nie można znaleÅºÄ pakietu o tej nazwie do zainstalowania, lub pakiet jest "
+"już zainstalowany"
+
+#: ../client/pk-console.c:612
+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:652
+msgid "The following packages have to be removed"
+msgstr "NastÄpujÄ
ce pakiety muszÄ
zostaÄ usuniÄte"
+
+#. get user input
+#: ../client/pk-console.c:661
+msgid "Okay to remove additional packages?"
+msgstr "UsunÄ
Ä dodatkowe pakiety?"
+
+#: ../client/pk-console.c:665
+msgid "Cancelled!"
+msgstr "Anulowano!"
+
+#: ../client/pk-console.c:687
+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:705
+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:723
+msgid "Could not get dependencies for this package"
+msgstr "Nie można uzyskaÄ zależnoÅci tego pakietu"
+
+#: ../client/pk-console.c:741
+msgid "Could not find a description for this package"
+msgstr "Nie można znaleÅºÄ opisu pakietu"
+
+#: ../client/pk-console.c:759
+#, c-format
+msgid "Could not find the files for this package"
+msgstr "Nie można znaleÅºÄ plików tego pakietu"
+
+#: ../client/pk-console.c:819
+msgid "Package description"
+msgstr "Opis pakietu"
+
+#: ../client/pk-console.c:842
+msgid "Package files"
+msgstr "Pliki pakiety"
+
+#: ../client/pk-console.c:850
+msgid "No files"
+msgstr "Brak plików"
+
+#. get user input
+#: ../client/pk-console.c:882
+msgid "Okay to import key?"
+msgstr "ZaimportowaÄ klucz?"
+
+#: ../client/pk-console.c:885
+msgid "Did not import key"
+msgstr "Nie zaimportowano klucza"
+
+#. get user input
+#: ../client/pk-console.c:925
+msgid "Do you agree?"
+msgstr "Zgadzasz siÄ?"
+
+#: ../client/pk-console.c:928
+msgid "Did not agree to licence, task will fail"
+msgstr "Nie zaakceptowano licencji, zadanie nie powiedzie siÄ"
+
+#: ../client/pk-console.c:957
+msgid "The daemon crashed mid-transaction!"
+msgstr "Demon zawiesiÅ siÄ w poÅowie transakcji!"
+
+#. header
+#: ../client/pk-console.c:1010
+msgid "PackageKit Console Interface"
+msgstr "Interfejs konsoli PackageKit"
+
+#: ../client/pk-console.c:1010
+msgid "Subcommands:"
+msgstr "Podpolecenia:"
+
+#: ../client/pk-console.c:1114 ../client/pk-monitor.c:100 ../src/pk-main.c:189
+msgid "Show extra debugging information"
+msgstr "WyÅwietla dodatkowe informacje o debugowaniu"
+
+#: ../client/pk-console.c:1116 ../client/pk-monitor.c:102
+msgid "Show the program version and exit"
+msgstr "WyÅwietla wersjÄ programu i wyÅÄ
cza"
+
+#: ../client/pk-console.c:1118
+msgid "Set the filter, e.g. installed"
+msgstr "Ustawia filtr, np. zainstalowane"
+
+#: ../client/pk-console.c:1120
+msgid "Exit without waiting for actions to complete"
+msgstr "WyÅÄ
cza bez oczekiwania na zakoÅczenie dziaÅaÅ"
+
+#: ../client/pk-console.c:1143
+msgid "Could not connect to system DBUS."
+msgstr "Nie można poÅÄ
czyÄ siÄ z systemowym D-Bus."
+
+#: ../client/pk-console.c:1231
+#, c-format
+msgid "You need to specify a search type"
+msgstr "Należy podaÄ typ wyszukiwania"
+
+#: ../client/pk-console.c:1236 ../client/pk-console.c:1243
+#: ../client/pk-console.c:1250 ../client/pk-console.c:1257
+#: ../client/pk-console.c:1361 ../client/pk-console.c:1368
+#: ../client/pk-console.c:1375 ../client/pk-console.c:1382
+#, c-format
+msgid "You need to specify a search term"
+msgstr "Należy podaÄ termin wyszukiwania"
+
+#: ../client/pk-console.c:1262
+#, c-format
+msgid "Invalid search type"
+msgstr "NieprawidÅowy typ wyszukiwania"
+
+#: ../client/pk-console.c:1267
+#, c-format
+msgid "You need to specify a package or file to install"
+msgstr "Należy podaÄ pakiet lub plik do zainstalowania"
+
+#: ../client/pk-console.c:1280
+#, c-format
+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:1287
+#, c-format
+msgid "You need to specify a package to remove"
+msgstr "Należy podaÄ pakiet do usuniÄcia"
+
+#: ../client/pk-console.c:1294
+#, c-format
+msgid "You need to specify a eula-id"
+msgstr "Należy podaÄ eula-id"
+
+#: ../client/pk-console.c:1309
+#, c-format
+msgid "You need to specify a package name to resolve"
+msgstr "Należy podaÄ nazwÄ pakietu do rozwiÄ
zania"
+
+#: ../client/pk-console.c:1316 ../client/pk-console.c:1323
+#, c-format
+msgid "You need to specify a repo name"
+msgstr "Należy podaÄ nazwÄ repozytorium"
+
+#: ../client/pk-console.c:1330
+#, c-format
+msgid "You need to specify a repo name/parameter and value"
+msgstr "Należy podaÄ nazwÄ/parametr repozytorium i wartoÅÄ"
+
+#: ../client/pk-console.c:1343
+#, c-format
+msgid "You need to specify a time term"
+msgstr "Należy podaÄ termin czasu"
+
+#: ../client/pk-console.c:1348
+#, c-format
+msgid "You need to specify a correct role"
+msgstr "Należy podaÄ poprawnÄ
rolÄ"
+
+#: ../client/pk-console.c:1353
+#, c-format
+msgid "Failed to get last time"
+msgstr "Uzyskanie ostatniego czasu nie powiodÅo siÄ"
+
+#: ../client/pk-console.c:1389
+#, c-format
+msgid "You need to specify a package to find the description for"
+msgstr "Należy podaÄ pakiet do znalezienia opisu dla"
+
+#: ../client/pk-console.c:1396
+#, c-format
+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:1441
+#, c-format
+msgid "Option '%s' not supported"
+msgstr "Opcja \"%s\" nie jest obsÅugiwana"
+
+#: ../client/pk-console.c:1452
+msgid "Command failed"
+msgstr "Polecenie nie powiodÅo siÄ"
+
+#: ../client/pk-console.c:1456
+msgid "You don't have the necessary privileges for this operation"
+msgstr "Nie posiadasz niezbÄdnych uprawnieÅ dla tej operacji"
+
+#: ../client/pk-monitor.c:113
+msgid "PackageKit Monitor"
+msgstr "Monitor PackageKit"
+
+#: ../client/pk-import-desktop.c:283 ../client/pk-import-specspo.c:169
+#, c-format
+msgid "Could not open database: %s"
+msgstr "Nie można otworzyÄ bazy danych: %s"
+
+#: ../client/pk-import-desktop.c:284 ../client/pk-import-specspo.c:170
+msgid "You probably need to run this program as the root user"
+msgstr "Prawdopodobnie należy uruchomiÄ ten program jako użytkownik root"
+
+#: ../src/pk-main.c:83
+msgid "Startup failed due to security policies on this machine."
+msgstr ""
+"Uruchomienie nie powiodÅo siÄ z powodu polityk bezpieczeÅstwa tego komputera."
+
+#: ../src/pk-main.c:84
+msgid "This can happen for two reasons:"
+msgstr "MogÅo siÄ to wydarzyÄ z dwóch powodów:"
+
+#: ../src/pk-main.c:85
+msgid "The correct user is not launching the executable (usually root)"
+msgstr ""
+"PrawidÅowy użytkownik nie uruchamiania pliku wykonywalnego (zwykle root)"
+
+#: ../src/pk-main.c:86
+msgid ""
+"The org.freedesktop.PackageKit.conf file is not installed in the system /etc/"
+"dbus-1/system.d directory"
+msgstr ""
+"Plik org.freedesktop.PackageKit.conf nie jest zainstalowany w folderze "
+"systemowym /etc/dbus-1/system.d"
+
+#: ../src/pk-main.c:185
+msgid "Packaging backend to use, e.g. dummy"
+msgstr "Używany moduÅ przetwarzajÄ
cy, np. dummy"
+
+#: ../src/pk-main.c:187
+msgid "Daemonize and detach from the terminal"
+msgstr "Tworzy demona i odÅÄ
cza z terminala"
+
+#: ../src/pk-main.c:191
+msgid "Disable the idle timer"
+msgstr "WyÅÄ
cza licznik czasu bezczynnoÅci"
+
+#: ../src/pk-main.c:193
+msgid "Show version and exit"
+msgstr "WyÅwietla wersjÄ i wyÅÄ
cza"
+
+#: ../src/pk-main.c:195
+msgid "Exit after a small delay"
+msgstr "WyÅÄ
cza po maÅej przerwie"
+
+#: ../src/pk-main.c:197
+msgid "Exit after the engine has loaded"
+msgstr "WyÅÄ
cza po wczytaniu mechanizmu"
+
+#: ../src/pk-main.c:207
+msgid "PackageKit service"
+msgstr "UsÅuga PackageKit"
+
+#: ../src/pk-main.c:233
+msgid "Cannot connect to the system bus"
+msgstr "Nie można poÅÄ
czyÄ siÄ z magistralÄ
systemowÄ
"
+
+#: ../src/pk-main.c:273
+#, c-format
+msgid "Error trying to start: %s\n"
+msgstr "BÅÄ
d podczas próbowania uruchomienia: %s\n"
commit 9c2089acd32d3aec47d9ff2d449d3775e4249b67
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 19:31:53 2008 +0100
fix installing the udev helper
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 24da432..4d4a7e3 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -43,6 +43,17 @@ PackageKit is a D-Bus abstraction layer that allows the session user
to manage packages in a secure way using a cross-distro,
cross-architecture API.
+%package -n udev-packagekit
+Summary: Tell PackageKit to install firmware that udev requires
+Group: System Environment/Base
+Requires: udev
+Requires: PackageKit
+
+%description -n udev-packagekit
+udev-packagekit tells PackageKit that firmware was not available and was
+needed. This allows PackageKit to do the right thing and prompt for
+the firmware to be installed.
+
%package -n yum-packagekit
Summary: Tell PackageKit to check for updates when yum exits
Group: System Environment/Base
@@ -154,6 +165,11 @@ rm -rf $RPM_BUILD_ROOT
%config(noreplace) %{_sysconfdir}/yum/pluginconf.d/refresh-packagekit.conf
/usr/lib/yum-plugins/refresh-packagekit.*
+%files -n udev-packagekit
+%defattr(-, root, root)
+%{_sysconfdir}/udev/rules.d/*.rules
+/lib/udev/*.sh
+
%files libs
%defattr(-,root,root,-)
%doc README AUTHORS NEWS COPYING
diff --git a/contrib/udev/Makefile.am b/contrib/udev/Makefile.am
index ccd8a49..3dcd7f6 100644
--- a/contrib/udev/Makefile.am
+++ b/contrib/udev/Makefile.am
@@ -1,6 +1,11 @@
udevrulesdir = ${SYSCONFDIR}/udev/rules.d
dist_udevrules_DATA = 51-packagekit-firmware.rules
-udevscriptdir = ${DESTDIR}/lib/udev
-dist_udevscript_DATA = packagekit-firmware.sh
+install-data-hook:
+ if test -w $(DESTDIR)/; then \
+ mkdir -p $(DESTDIR)/lib/udev; \
+ cp packagekit-firmware.sh $(DESTDIR)/lib/udev; \
+ fi
+
+EXTRA_DIST = packagekit-firmware.sh
commit 7af79b7370c9125486a6aab831c8f692c9c983bc
Merge: 7fd6738... df6f894...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 18:48:29 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 7fd673834ab9b055205497f694ad2f59680704b6
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 18:47:10 2008 +0100
add the udev rules for telling PackageKit we need firmware - nothing works yet, but allows a sneak peak at new functionality
diff --git a/configure.ac b/configure.ac
index 073a445..b084ac4 100755
--- a/configure.ac
+++ b/configure.ac
@@ -588,6 +588,7 @@ docs/spec/Makefile
docs/api/Makefile
docs/api/version.xml
contrib/Makefile
+contrib/udev/Makefile
contrib/yum-packagekit/Makefile
backends/Makefile
backends/alpm/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 40ab36e..acfd88c 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,5 +1,7 @@
+SUBDIRS = udev
+
if BACKEND_TYPE_YUM
-SUBDIRS = yum-packagekit
+SUBDIRS += yum-packagekit
endif
bashcompletiondir = ${SYSCONFDIR}/bash_completion.d
diff --git a/contrib/udev/.gitignore b/contrib/udev/.gitignore
new file mode 100644
index 0000000..22a4e72
--- /dev/null
+++ b/contrib/udev/.gitignore
@@ -0,0 +1,3 @@
+Makefile
+Makefile.in
+
diff --git a/contrib/udev/51-packagekit-firmware.rules b/contrib/udev/51-packagekit-firmware.rules
new file mode 100644
index 0000000..9f1afe9
--- /dev/null
+++ b/contrib/udev/51-packagekit-firmware.rules
@@ -0,0 +1,5 @@
+# do not edit this file, it will be overwritten on update
+
+# firmware class requests
+SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh"
+
diff --git a/contrib/udev/Makefile.am b/contrib/udev/Makefile.am
new file mode 100644
index 0000000..ccd8a49
--- /dev/null
+++ b/contrib/udev/Makefile.am
@@ -0,0 +1,6 @@
+udevrulesdir = ${SYSCONFDIR}/udev/rules.d
+dist_udevrules_DATA = 51-packagekit-firmware.rules
+
+udevscriptdir = ${DESTDIR}/lib/udev
+dist_udevscript_DATA = packagekit-firmware.sh
+
diff --git a/contrib/udev/packagekit-firmware.sh b/contrib/udev/packagekit-firmware.sh
new file mode 100755
index 0000000..7631cd1
--- /dev/null
+++ b/contrib/udev/packagekit-firmware.sh
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+#
+# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+#
+# Licensed under the GNU General Public License Version 2
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+FIRMWARE_DIR="/lib/firmware"
+
+if [ ! -e "$FIRMWARE_DIR/$FIRMWARE" ]; then
+ # we've need firmware
+ echo "$FIRMWARE_DIR/$FIRMWARE" > /var/run/PackageKit/udev-firmware
+fi
+
+exit 0
+
commit df6f894efe35b6f2e063d86306a1acf9e6cf2367
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date: Mon Apr 21 17:36:04 2008 +0200
poldek: enable allow_cancel for methods that really needs it
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index a2d08de..03f1826 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -311,6 +311,9 @@ poldek_vf_progress (void *bar, long total, long amount)
if (td->type != TS_TYPE_ENUM_REFRESH_CACHE) {
if (pd->filesget == pd->filesdownload) {
+ /* we shouldn't cancel packages installation proccess */
+ poldek_backend_set_allow_cancel (backend, FALSE, FALSE);
+
if (td->type == TS_TYPE_ENUM_INSTALL)
pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL);
else if (td->type == TS_TYPE_ENUM_UPDATE)
@@ -434,6 +437,9 @@ ts_confirm (void *data, struct poldek_ts *ts)
/* set proper status if there are no packages to download */
if (result == 1 && td->pd->filesdownload == 0) {
+ /* we shouldn't cancel packages installation proccess */
+ poldek_backend_set_allow_cancel (backend, FALSE, FALSE);
+
if (td->type == TS_TYPE_ENUM_INSTALL)
pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL);
else if (td->type == TS_TYPE_ENUM_UPDATE)
@@ -466,8 +472,10 @@ ts_confirm (void *data, struct poldek_ts *ts)
}
/* set proper status if removing will be performed */
- if (result == 1)
+ if (result == 1) {
+ poldek_backend_set_allow_cancel (backend, FALSE, FALSE);
pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE);
+ }
break;
}
@@ -1138,6 +1146,11 @@ pb_load_packages (PkBackend *backend)
static void
pb_error_show (PkBackend *backend, PkErrorCodeEnum errorcode)
{
+ if (sigint_reached()) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED, "Action cancelled.");
+ return;
+ }
+
/* Before emiting error_code try to find the most suitable PkErrorCodeEnum */
if (g_strrstr (pberror->tslog->str, " unresolved depend") != NULL)
errorcode = PK_ERROR_ENUM_DEP_RESOLUTION_FAILED;
@@ -1147,6 +1160,29 @@ pb_error_show (PkBackend *backend, PkErrorCodeEnum errorcode)
pk_backend_error_code (backend, errorcode, pberror->tslog->str);
}
+/**
+ * pb_error_check:
+ *
+ * When we try to install already installed package, poldek won't report any error
+ * just show message like 'liferea-1.4.11-2.i686: equal version installed, skipped'.
+ * This function checks if it happens and if yes, emits error_code and returns TRUE.
+ **/
+static gboolean
+pb_error_check (PkBackend *backend)
+{
+ PkErrorCodeEnum errorcode = PK_ERROR_ENUM_UNKNOWN;
+
+ if (g_strrstr (pberror->tslog->str, " version installed, skipped") != NULL)
+ errorcode = PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED;
+
+ if (errorcode != PK_ERROR_ENUM_UNKNOWN) {
+ pk_backend_error_code (backend, errorcode, pberror->tslog->str);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
pb_error_clean (void)
{
@@ -1170,6 +1206,9 @@ poldek_backend_log (void *data, int pri, char *message)
/* catch vfff messages */
if (g_str_has_prefix (message, "vfff: ")) {
+ if (g_str_has_prefix (message, "vfff: Inter")) // 'Interrupted system call'
+ return;
+
/* check if this message was already showed */
if (pberror->vfffmsg) {
if (strcmp (pberror->vfffmsg, message) == 0)
@@ -1245,9 +1284,13 @@ do_poldek_destroy (void)
}
static void
-poldek_reload (void) {
+poldek_reload (PkBackend *backend, gboolean load_packages) {
do_poldek_destroy ();
do_poldek_init ();
+
+ if (load_packages)
+ pb_load_packages (backend);
+
}
/**
@@ -1803,14 +1846,14 @@ backend_install_package_thread (PkBackendThread *thread, gpointer data)
rcmd = poclidek_rcmd_new (cctx, ts);
nvra = poldek_get_nvra_from_package_id (td->package_id);
- command = g_strdup_printf ("install --test %s", nvra);
+ command = g_strdup_printf ("install %s", nvra);
pk_backend_set_status (backend, PK_STATUS_ENUM_DEP_RESOLVE);
if (!poclidek_rcmd_execline (rcmd, command))
- {
pb_error_show (backend, PK_ERROR_ENUM_TRANSACTION_ERROR);
- }
+ else
+ pb_error_check (backend);
g_free (nvra);
g_free (command);
@@ -1843,7 +1886,7 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
return;
}
- poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
+ poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
pb_error_clean ();
data->package_id = g_strdup (package_id);
@@ -1897,13 +1940,16 @@ backend_refresh_cache_thread (PkBackendThread *thread, gpointer data)
if (src->flags & PKGSOURCE_NOAUTOUP)
continue;
+ if (sigint_reached ())
+ break;
+
source_update (src, 0);
pd->step++;
}
n_array_free (sources);
}
- poldek_reload ();
+ poldek_reload (backend, TRUE);
pk_backend_set_percentage (backend, 100);
@@ -1921,7 +1967,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
+ poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
pb_error_clean ();
if (pk_network_is_online (network) == FALSE) {
@@ -2127,6 +2173,7 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
struct pkg *pkg = NULL;
pk_backend_set_status (backend, PK_STATUS_ENUM_DEP_RESOLVE);
+ pb_error_clean ();
pk_backend_set_sub_percentage (backend, 0);
@@ -2146,6 +2193,9 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
pb_error_show (backend, PK_ERROR_ENUM_TRANSACTION_ERROR);
update_cancelled = TRUE;
+ } else {
+ /* allow_cancel is disabled in ts_confirm () */
+ poldek_backend_set_allow_cancel (backend, TRUE, FALSE);
}
g_free (nvra);
@@ -2194,7 +2244,7 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
return;
}
- poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
+ poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
pb_error_clean ();
data->package_ids = g_strdupv (package_ids);
@@ -2266,6 +2316,8 @@ backend_update_system_thread (PkBackendThread *thread, gpointer data)
pk_backend_set_status (backend, PK_STATUS_ENUM_DEP_RESOLVE);
+ pb_error_clean ();
+
pk_backend_set_sub_percentage (backend, 0);
ts = poldek_ts_new (ctx, 0);
@@ -2277,6 +2329,9 @@ backend_update_system_thread (PkBackendThread *thread, gpointer data)
pb_error_show (backend, PK_ERROR_ENUM_TRANSACTION_ERROR);
update_cancelled = TRUE;
+ } else {
+ /* allow_cancel is disabled in ts_confirm () */
+ poldek_backend_set_allow_cancel (backend, TRUE, FALSE);
}
g_free (command);
@@ -2321,7 +2376,7 @@ backend_update_system (PkBackend *backend)
return;
}
- poldek_backend_set_allow_cancel (backend, FALSE, TRUE);
+ poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
pb_error_clean ();
data->pd = g_new0 (PercentageData, 1);
commit 4b92031978181ae50664147a3b81d21eb1bd6ecb
Merge: 2840f48... aff2ef7...
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date: Mon Apr 21 17:32:53 2008 +0200
Merge branch 'master' of git+ssh://megabajt@git.packagekit.org/srv/git/PackageKit
commit aff2ef70ecf498fec4f67e9ad08f9f91a0743aa0
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 16:00:31 2008 +0100
make the spacing all the same in the yum backend so we are all singing from the same hymnsheet
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 973ce79..891d946 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -32,7 +32,7 @@ from yum.rpmtrans import RPMBaseCallback
from yum.constants import *
from yum.update_md import UpdateMetadata
from yum.callbacks import *
-from yum.misc import prco_tuple_to_string, unique
+from yum.misc import prco_tuple_to_string,unique
from yum.packages import YumLocalPackage
import rpmUtils
import exceptions
@@ -202,10 +202,10 @@ GUI_KEYS = re.compile(r'(qt)|(gtk)')
class GPGKeyNotImported(exceptions.Exception):
pass
-def sigquit(signum, frame):
- print >> sys.stderr, "Quit signal sent - exiting immediately"
+def sigquit(signum,frame):
+ print >> sys.stderr,"Quit signal sent - exiting immediately"
if yumbase:
- print >> sys.stderr, "unlocking backend"
+ print >> sys.stderr,"unlocking backend"
yumbase.closeRpmDB()
yumbase.doUnlock(YUM_PID_FILE)
sys.exit(1)
@@ -213,28 +213,28 @@ def sigquit(signum, frame):
class PackageKitYumBackend(PackageKitBaseBackend):
# Packages there require a reboot
- rebootpkgs = ("kernel", "kernel-smp", "kernel-xen-hypervisor", "kernel-PAE",
- "kernel-xen0", "kernel-xenU", "kernel-xen", "kernel-xen-guest",
- "glibc", "hal", "dbus", "xen")
+ rebootpkgs = ("kernel","kernel-smp","kernel-xen-hypervisor","kernel-PAE",
+ "kernel-xen0","kernel-xenU","kernel-xen","kernel-xen-guest",
+ "glibc","hal","dbus","xen")
def handle_repo_error(func):
- def wrapper(*args, **kwargs):
+ def wrapper(*args,**kwargs):
self = args[0]
try:
- func(*args, **kwargs)
+ func(*args,**kwargs)
except yum.Errors.RepoError,e:
self._refresh_yum_cache()
try:
- func(*args, **kwargs)
- except yum.Errors.RepoError, e:
+ func(*args,**kwargs)
+ except yum.Errors.RepoError,e:
self.error(ERROR_NO_CACHE,str(e))
return wrapper
def __init__(self,args,lock=True):
- signal.signal(signal.SIGQUIT, sigquit)
+ signal.signal(signal.SIGQUIT,sigquit)
PackageKitBaseBackend.__init__(self,args)
self.yumbase = PackageKitYumBase(self)
yumbase = self.yumbase
@@ -267,10 +267,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
summary = self._to_unicode(summary)
PackageKitBaseBackend.package(self,id,status,summary)
- def _to_unicode(self, txt, encoding='utf-8'):
- if isinstance(txt, basestring):
- if not isinstance(txt, unicode):
- txt = unicode(txt, encoding, errors='replace')
+ def _to_unicode(self,txt,encoding='utf-8'):
+ if isinstance(txt,basestring):
+ if not isinstance(txt,unicode):
+ txt = unicode(txt,encoding,errors='replace')
return txt
def doLock(self):
@@ -278,7 +278,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
retries = 0
while not self.isLocked():
try: # Try to lock yum
- self.yumbase.doLock( YUM_PID_FILE )
+ self.yumbase.doLock(YUM_PID_FILE)
PackageKitBaseBackend.doLock(self)
except:
time.sleep(2)
@@ -313,7 +313,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
@param filters: package types to search (all,installed,available)
@param key: key to seach for
'''
- res = self.yumbase.searchGenerator(searchlist, [key])
+ res = self.yumbase.searchGenerator(searchlist,[key])
fltlist = filters.split(';')
installed_nevra = [] # yum returns packages as available even when installed
pkg_list = [] # only do the second iteration on not installed pkgs
@@ -343,17 +343,17 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _do_extra_filtering(self,pkg,filterList):
''' do extra filtering (gui,devel etc) '''
for filter in filterList:
- if filter in (FILTER_INSTALLED, FILTER_NOT_INSTALLED):
- if not self._do_installed_filtering(filter, pkg):
+ if filter in (FILTER_INSTALLED,FILTER_NOT_INSTALLED):
+ if not self._do_installed_filtering(filter,pkg):
return False
- elif filter in (FILTER_GUI, FILTER_NOT_GUI):
- if not self._do_gui_filtering(filter, pkg):
+ elif filter in (FILTER_GUI,FILTER_NOT_GUI):
+ if not self._do_gui_filtering(filter,pkg):
return False
- elif filter in (FILTER_DEVELOPMENT, FILTER_NOT_DEVELOPMENT):
- if not self._do_devel_filtering(filter, pkg):
+ elif filter in (FILTER_DEVELOPMENT,FILTER_NOT_DEVELOPMENT):
+ if not self._do_devel_filtering(filter,pkg):
return False
- elif filter in (FILTER_FREE, FILTER_NOT_FREE):
- if not self._do_free_filtering(filter, pkg):
+ elif filter in (FILTER_FREE,FILTER_NOT_FREE):
+ if not self._do_free_filtering(filter,pkg):
return False
return True
@@ -416,7 +416,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
searchlist = ['name']
self.status(STATUS_QUERY)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
- self._do_search(searchlist, filters, key)
+ self._do_search(searchlist,filters,key)
def search_details(self,filters,key):
'''
@@ -426,16 +426,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(None)
- searchlist = ['name', 'summary', 'description', 'group']
+ searchlist = ['name','summary','description','group']
self.status(STATUS_QUERY)
- self._do_search(searchlist, filters, key)
+ self._do_search(searchlist,filters,key)
def _buildGroupDict(self):
pkgGroups= {}
cats = self.yumbase.comps.categories
for cat in cats:
- grps = map( lambda x: self.yumbase.comps.return_group( x ),
- filter( lambda x: self.yumbase.comps.has_group( x ), cat.groups ) )
+ grps = map(lambda x: self.yumbase.comps.return_group(x),
+ filter(lambda x: self.yumbase.comps.has_group(x),cat.groups))
grplist = []
for group in grps:
for pkg in group.mandatory_packages.keys():
@@ -476,7 +476,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if groupMap.has_key(cg):
group = groupMap[cg] # use the pk group name, instead of yum 'category/group'
if group == key:
- if self._do_extra_filtering(pkg, fltlist):
+ if self._do_extra_filtering(pkg,fltlist):
package_list.append((pkg,INFO_INSTALLED))
installed_nevra.append(self._get_nevra(pkg))
@@ -491,7 +491,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if groupMap.has_key(cg):
group = groupMap[cg]
if group == key:
- if self._do_extra_filtering(pkg, fltlist):
+ if self._do_extra_filtering(pkg,fltlist):
package_list.append((pkg,INFO_AVAILABLE))
except yum.Errors.GroupsError,e:
@@ -559,8 +559,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
matches = self.yumbase.rpmdb.searchFiles(key)
for pkg in matches:
if not found.has_key(str(pkg)):
- if self._do_extra_filtering(pkg, fltlist):
- self._show_package(pkg, INFO_INSTALLED)
+ if self._do_extra_filtering(pkg,fltlist):
+ self._show_package(pkg,INFO_INSTALLED)
found[str(pkg)] = 1
if not FILTER_INSTALLED in fltlist:
# Check available for file
@@ -568,12 +568,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
matches = self.yumbase.pkgSack.searchFiles(key)
for pkg in matches:
if not found.has_key(str(pkg)):
- if self._do_extra_filtering(pkg, fltlist):
- self._show_package(pkg, INFO_AVAILABLE)
+ if self._do_extra_filtering(pkg,fltlist):
+ self._show_package(pkg,INFO_AVAILABLE)
found[str(pkg)] = 1
@handle_repo_error
- def what_provides(self, filters, provides_type, search):
+ def what_provides(self,filters,provides_type,search):
'''
Implement the {backend}-what-provides functionality
'''
@@ -589,16 +589,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
matches = self.yumbase.rpmdb.searchProvides(search)
for pkg in matches:
if not found.has_key(str(pkg)):
- if self._do_extra_filtering(pkg, fltlist):
- self._show_package(pkg, INFO_INSTALLED)
+ if self._do_extra_filtering(pkg,fltlist):
+ self._show_package(pkg,INFO_INSTALLED)
found[str(pkg)] = 1
if not FILTER_INSTALLED in fltlist:
# Check available for file
matches = self.yumbase.pkgSack.searchProvides(search)
for pkg in matches:
if found.has_key(str(pkg)):
- if self._do_extra_filtering(pkg, fltlist):
- self._show_package(pkg, INFO_AVAILABLE)
+ if self._do_extra_filtering(pkg,fltlist):
+ self._show_package(pkg,INFO_AVAILABLE)
found[str(pkg)] = 1
def _getEVR(self,idver):
@@ -643,7 +643,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
return None,False
- def _get_pkg_requirements(self,pkg,reqlist=[] ):
+ def _get_pkg_requirements(self,pkg,reqlist=[]):
pkgs = self.yumbase.rpmdb.searchRequires(pkg.name)
reqlist.extend(pkgs)
if pkgs:
@@ -677,7 +677,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _is_inst(self,pkg):
return self.yumbase.rpmdb.installed(po=pkg)
- def _installable(self, pkg, ematch=False):
+ def _installable(self,pkg,ematch=False):
"""check if the package is reasonably installable, true/false"""
@@ -770,13 +770,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
for pkg in deps:
if pkg.name != name:
pkgver = self._get_package_ver(pkg)
- id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repoid)
+ id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repoid)
if self._is_inst(pkg) and FILTER_NOT_INSTALLED not in fltlist:
- self.package(id, INFO_INSTALLED, pkg.summary)
+ self.package(id,INFO_INSTALLED,pkg.summary)
else:
if self._installable(pkg) and FILTER_INSTALLED not in fltlist:
- self.package(id, INFO_AVAILABLE, pkg.summary)
+ self.package(id,INFO_AVAILABLE,pkg.summary)
def update_system(self):
'''
@@ -821,10 +821,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
for repo in self.yumbase.repos.listEnabled():
repo.metadata_expire = 0
- self.yumbase.repos.populateSack(which=[repo.id], mdtype='metadata', cacheonly=1)
+ self.yumbase.repos.populateSack(which=[repo.id],mdtype='metadata',cacheonly=1)
pct+=bump
self.percentage(pct)
- self.yumbase.repos.populateSack(which=[repo.id], mdtype='filelists', cacheonly=1)
+ self.yumbase.repos.populateSack(which=[repo.id],mdtype='filelists',cacheonly=1)
pct+=bump
self.percentage(pct)
@@ -834,13 +834,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
#we might have a rounding error
self.percentage(100)
- except yum.Errors.RepoError, e:
+ except yum.Errors.RepoError,e:
self.error(ERROR_REPO_CONFIGURATION_ERROR,str(e))
- except yum.Errors.YumBaseError, e:
+ except yum.Errors.YumBaseError,e:
self.error(ERROR_UNKNOWN,str(e))
@handle_repo_error
- def resolve(self, filters, name):
+ def resolve(self,filters,name):
'''
Implement the {backend}-resolve functionality
'''
@@ -871,7 +871,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
break
@handle_repo_error
- def install(self, packages):
+ def install(self,packages):
'''
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
@@ -898,7 +898,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if newest.EVR > po.EVR:
self.message(MESSAGE_WARNING,"A newer version of %s is available online." % po.name)
- def install_file (self, inst_file):
+ def install_file (self,inst_file):
'''
Implement the {backend}-install_file functionality
Install the package containing the inst_file file
@@ -927,7 +927,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
except yum.Errors.InstallError,e:
self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
- except (yum.Errors.RepoError, yum.Errors.PackageSackError, IOError):
+ except (yum.Errors.RepoError,yum.Errors.PackageSackError,IOError):
# We might not be able to connect to the internet to get
# repository metadata, or the package might not exist.
# Try again, (temporarily) disabling repos first.
@@ -945,7 +945,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
- def update(self, packages):
+ def update(self,packages):
'''
Implement the {backend}-install functionality
This will only work with yum 3.2.4 or higher
@@ -974,7 +974,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkg = txmbr.po
# check if package is in reboot list or flagged with reboot_suggested
# in the update metadata and is installed/updated etc
- notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ notice = md.get_notice((pkg.name,pkg.version,pkg.release))
if (pkg.name in self.rebootpkgs \
or (notice and notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']))\
and txmbr.ts_state in TS_INSTALL_STATES:
@@ -982,7 +982,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
break
def _format_msgs(self,msgs):
- if isinstance(msgs, basestring):
+ if isinstance(msgs,basestring):
msgs = msgs.split('\n')
return ";".join(msgs)
@@ -1001,7 +1001,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self._check_for_reboot()
if removedeps == False:
if len(self.yumbase.tsInfo) > 1:
- retmsg = 'package could not be removed, as other packages depend on it'
+ retmsg = 'package could not be removed,as other packages depend on it'
self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
return
@@ -1010,11 +1010,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
callback = ProcessTransPackageKitCallback(self)
self.yumbase.processTransaction(callback=callback,
rpmDisplay=rpmDisplay)
- except yum.Errors.YumDownloadError, ye:
+ except yum.Errors.YumDownloadError,ye:
self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,self._format_msgs(ye.value))
- except yum.Errors.YumGPGCheckError, ye:
+ except yum.Errors.YumGPGCheckError,ye:
self.error(ERROR_BAD_GPG_SIGNATURE,self._format_msgs(ye.value))
- except GPGKeyNotImported, e:
+ except GPGKeyNotImported,e:
keyData = self.yumbase.missingGPGKey
if not keyData:
self.error(ERROR_BAD_GPG_SIGNATURE,
@@ -1030,14 +1030,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
keyData['timestamp'],
'GPG')
self.error(ERROR_GPG_FAILURE,"GPG key %s required" % keyData['hexkeyid'])
- except yum.Errors.YumBaseError, ye:
+ except yum.Errors.YumBaseError,ye:
message = self._format_msgs(ye.value)
if message.find ("conflicts with file") != -1:
self.error(ERROR_FILE_CONFLICTS,message)
else:
self.error(ERROR_TRANSACTION_ERROR,message)
- def remove(self, allowdep, package):
+ def remove(self,allowdep,package):
'''
Implement the {backend}-remove functionality
Needed to be implemented in a sub class
@@ -1047,7 +1047,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.percentage(0)
self.status(STATUS_RUNNING)
- pkg,inst = self._findPackage( package)
+ pkg,inst = self._findPackage(package)
if pkg and inst:
try:
txmbr = self.yumbase.remove(name=pkg.name)
@@ -1063,7 +1063,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
self.error(ERROR_PACKAGE_NOT_INSTALLED,"Package %s is not installed" % package)
- def get_description(self, package):
+ def get_description(self,package):
'''
Print a detailed description for a given package
'''
@@ -1080,15 +1080,15 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _show_description(self,pkg):
pkgver = self._get_package_ver(pkg)
- id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
+ id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repo)
desc = pkg.description
desc = desc.replace('\n\n',';')
desc = desc.replace('\n',' ')
- self.description(id, pkg.license, "unknown", desc, pkg.url,
+ self.description(id,pkg.license,"unknown",desc,pkg.url,
pkg.size)
- def get_files(self, package):
+ def get_files(self,package):
self._check_init()
self.allow_cancel(True)
self.percentage(None)
@@ -1101,19 +1101,19 @@ class PackageKitYumBackend(PackageKitBaseBackend):
file_list = ";".join(files)
- self.files(package, file_list)
+ self.files(package,file_list)
else:
self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
def _pkg_to_id(self,pkg):
pkgver = self._get_package_ver(pkg)
- id = self.get_package_id(pkg.name, pkgver, pkg.arch, pkg.repo)
+ id = self.get_package_id(pkg.name,pkgver,pkg.arch,pkg.repo)
return id
def _show_package(self,pkg,status):
''' Show info about package'''
id = self._pkg_to_id(pkg)
- self.package(id,status, pkg.summary)
+ self.package(id,status,pkg.summary)
def _get_status(self,notice):
ut = notice['type']
@@ -1126,7 +1126,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
return INFO_UNKNOWN
- def _is_main_package(self, repo):
+ def _is_main_package(self,repo):
if repo.endswith('-debuginfo'):
return False
if repo.endswith('-devel'):
@@ -1135,7 +1135,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
return False
return True
- def _basename_filter(self, package_list):
+ def _basename_filter(self,package_list):
'''
Filter the list so that the number of packages are reduced.
This is done by only displaying gtk2 rather than gtk2-devel, gtk2-debuginfo, etc.
@@ -1178,7 +1178,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
base_list_already_got.append ((base,version))
return output_list
- def get_updates(self, filters):
+ def get_updates(self,filters):
'''
Implement the {backend}-get-updates functionality
@param filters: package types to show
@@ -1197,9 +1197,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
md = self.updateMetadata
for pkg in ygl.updates:
- if self._do_extra_filtering(pkg, fltlist):
+ if self._do_extra_filtering(pkg,fltlist):
# Get info about package in updates info
- notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ notice = md.get_notice((pkg.name,pkg.version,pkg.release))
if notice:
status = self._get_status(notice)
package_list.append((pkg,status))
@@ -1214,7 +1214,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
for (pkg,status) in package_list:
self._show_package(pkg,status)
- def repo_enable(self, repoid, enable):
+ def repo_enable(self,repoid,enable):
'''
Implement the {backend}-repo-enable functionality
'''
@@ -1232,7 +1232,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
except yum.Errors.RepoError,e:
self.error(ERROR_REPO_NOT_FOUND,str(e))
- def _is_development_repo(self, repo):
+ def _is_development_repo(self,repo):
if repo.endswith('-debuginfo'):
return True
if repo.endswith('-testing'):
@@ -1245,7 +1245,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
return True
return False
- def get_repo_list(self, filters):
+ def get_repo_list(self,filters):
'''
Implement the {backend}-get-repo-list functionality
'''
@@ -1260,10 +1260,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.repo_detail(repo.id,repo.name,'false')
def _get_obsoleted(self,name):
- obsoletes = self.yumbase.up.getObsoletesTuples( newest=1 )
- for ( obsoleting, installed ) in obsoletes:
+ obsoletes = self.yumbase.up.getObsoletesTuples(newest=1)
+ for (obsoleting,installed) in obsoletes:
if obsoleting[0] == name:
- pkg = self.yumbase.rpmdb.searchPkgTuple( installed )[0]
+ pkg = self.yumbase.rpmdb.searchPkgTuple(installed)[0]
return self._pkg_to_id(pkg)
return ""
@@ -1309,8 +1309,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _get_update_extras(self,pkg):
md = self.updateMetadata
- notice = md.get_notice((pkg.name, pkg.version, pkg.release))
- urls = {'bugzilla':[], 'cve' : [], 'vendor': []}
+ notice = md.get_notice((pkg.name,pkg.version,pkg.release))
+ urls = {'bugzilla':[],'cve' : [],'vendor': []}
if notice:
# Update Description
desc = notice['description']
@@ -1354,7 +1354,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
vendor_url = self._format_list(urls['vendor'])
self.update_detail(package,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc)
- def repo_set_data(self, repoid, parameter, value):
+ def repo_set_data(self,repoid,parameter,value):
'''
Implement the {backend}-repo-set-data functionality
'''
@@ -1362,10 +1362,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
# Get the repo
repo = self.yumbase.repos.getRepo(repoid)
if repo:
- repo.cfg.set(repoid, parameter, value)
+ repo.cfg.set(repoid,parameter,value)
try:
- repo.cfg.write(file(repo.repofile, 'w'))
- except IOError, e:
+ repo.cfg.write(file(repo.repofile,'w'))
+ except IOError,e:
self.error(ERROR_CANNOT_WRITE_REPO_CONFIG,str(e))
else:
self.error(ERROR_REPO_NOT_FOUND,'repo %s not found' % repoid)
@@ -1378,8 +1378,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkg,inst = self._findPackage(package)
if pkg:
try:
- self.yumbase.getKeyForPackage(pkg, askcb = lambda x, y, z: True)
- except yum.Errors.YumBaseError, e:
+ self.yumbase.getKeyForPackage(pkg,askcb = lambda x,y,z: True)
+ except yum.Errors.YumBaseError,e:
self.error(ERROR_UNKNOWN,str(e))
except:
self.error(ERROR_GPG_FAILURE,"Error importing GPG Key for %s" % pkg)
@@ -1402,9 +1402,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.repos.setCache(0)
try:
- self.yumbase.repos.populateSack(mdtype='metadata', cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='filelists', cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='otherdata', cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='metadata',cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='filelists',cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='otherdata',cacheonly=1)
except yum.Errors.RepoError,e:
self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
@@ -1415,12 +1415,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0) # Setup Yum Config
self.yumbase.conf.throttle = "90%" # Set bandwidth throttle to 40%
self.dnlCallback = DownloadCallback(self,showNames=True) # Download callback
- self.yumbase.repos.setProgressBar( self.dnlCallback ) # Setup the download callback class
+ self.yumbase.repos.setProgressBar(self.dnlCallback) # Setup the download callback class
-class DownloadCallback( BaseMeter ):
+class DownloadCallback(BaseMeter):
""" Customized version of urlgrabber.progress.BaseMeter class """
def __init__(self,base,showNames = False):
- BaseMeter.__init__( self )
+ BaseMeter.__init__(self)
self.totSize = ""
self.base = base
self.showNames = showNames
@@ -1440,7 +1440,7 @@ class DownloadCallback( BaseMeter ):
def _getPackage(self,name):
if self.pkgs:
for pkg in self.pkgs:
- if isinstance(pkg, YumLocalPackage):
+ if isinstance(pkg,YumLocalPackage):
rpmfn = pkg.localPkg
else:
rpmfn = os.path.basename(pkg.remote_path) # get the rpm filename of the package
@@ -1448,34 +1448,34 @@ class DownloadCallback( BaseMeter ):
return pkg
return None
- def update( self, amount_read, now=None ):
- BaseMeter.update( self, amount_read, now )
+ def update(self,amount_read,now=None):
+ BaseMeter.update(self,amount_read,now)
- def _do_start( self, now=None ):
+ def _do_start(self,now=None):
name = self._getName()
self.updateProgress(name,0.0,"","")
if not self.size is None:
- self.totSize = format_number( self.size )
+ self.totSize = format_number(self.size)
- def _do_update( self, amount_read, now=None ):
- fread = format_number( amount_read )
+ def _do_update(self,amount_read,now=None):
+ fread = format_number(amount_read)
name = self._getName()
if self.size is None:
# Elapsed time
etime = self.re.elapsed_time()
- fetime = format_time( etime )
+ fetime = format_time(etime)
frac = 0.0
self.updateProgress(name,frac,fread,fetime)
else:
# Remaining time
rtime = self.re.remaining_time()
- frtime = format_time( rtime )
+ frtime = format_time(rtime)
frac = self.re.fraction_read()
self.updateProgress(name,frac,fread,frtime)
- def _do_end( self, amount_read, now=None ):
- total_time = format_time( self.re.elapsed_time() )
- total_size = format_number( amount_read )
+ def _do_end(self,amount_read,now=None):
+ total_time = format_time(self.re.elapsed_time())
+ total_size = format_number(amount_read)
name = self._getName()
self.updateProgress(name,1.0,total_size,total_time)
@@ -1483,7 +1483,7 @@ class DownloadCallback( BaseMeter ):
'''
Get the name of the package being downloaded
'''
- if self.text and type( self.text ) == type( "" ):
+ if self.text and type(self.text) == type(""):
name = self.text
else:
name = self.basename
@@ -1497,7 +1497,7 @@ class DownloadCallback( BaseMeter ):
@param fread: formated string containing BytesRead
@param ftime : formated string containing remaining or elapsed time
'''
- pct = int( frac*100 )
+ pct = int(frac*100)
if name != self.oldName: # If this a new package
if self.oldName:
self.base.sub_percentage(100)
@@ -1559,22 +1559,22 @@ class PackageKitCallback(RPMBaseCallback):
id = self.base.get_package_id(self.curpkg,'','','')
else:
pkgver = self.base._get_package_ver(self.curpkg)
- id = self.base.get_package_id(self.curpkg.name, pkgver, self.curpkg.arch, self.curpkg.repo)
- self.base.package(id,status, "")
+ id = self.base.get_package_id(self.curpkg.name,pkgver,self.curpkg.arch,self.curpkg.repo)
+ self.base.package(id,status,"")
- def event(self, package, action, te_current, te_total, ts_current, ts_total):
+ def event(self,package,action,te_current,te_total,ts_current,ts_total):
if str(package) != str(self.curpkg):
self.curpkg = package
self.base.status(self.state_actions[action])
self._showName(self.info_actions[action])
- pct = self._calcTotalPct(ts_current, ts_total)
+ pct = self._calcTotalPct(ts_current,ts_total)
self.base.percentage(pct)
val = (ts_current*100L)/ts_total
if val != self.pct:
self.pct = val
self.base.sub_percentage(val)
- def errorlog(self, msg):
+ def errorlog(self,msg):
# grrrrrrrr
pass
@@ -1607,7 +1607,7 @@ class DepSolveCallback(object):
# XXX takes a PackageKitBackend so we can call StatusChanged on it.
# That's kind of hurky.
- def __init__(self, backend):
+ def __init__(self,backend):
self.started = False
self.backend = backend
@@ -1617,10 +1617,10 @@ class DepSolveCallback(object):
self.backend.percentage(None)
# Be lazy and not define the others explicitly
- def _do_nothing(self, *args, **kwargs):
+ def _do_nothing(self,*args,**kwargs):
pass
- def __getattr__(self, x):
+ def __getattr__(self,x):
return self._do_nothing
class PackageKitYumBase(yum.YumBase):
@@ -1629,7 +1629,7 @@ class PackageKitYumBase(yum.YumBase):
and nab the gpg sig data
"""
- def __init__(self, backend):
+ def __init__(self,backend):
yum.YumBase.__init__(self)
self.missingGPGKey = None
self.dsCallback = DepSolveCallback(backend)
@@ -1639,22 +1639,22 @@ class PackageKitYumBase(yum.YumBase):
# This can be overloaded by a subclass.
for po in pkgs:
- result, errmsg = self.sigCheckPkg(po)
+ result,errmsg = self.sigCheckPkg(po)
if result == 0:
# Verified ok, or verify not req'd
continue
elif result == 1:
- self.getKeyForPackage(po, fullaskcb=self._fullAskForGPGKeyImport)
+ self.getKeyForPackage(po,fullaskcb=self._fullAskForGPGKeyImport)
else:
- raise yum.Errors.YumGPGCheckError, errmsg
+ raise yum.Errors.YumGPGCheckError,errmsg
return 0
- def _fullAskForGPGKeyImport(self, data):
+ def _fullAskForGPGKeyImport(self,data):
self.missingGPGKey = data
raise GPGKeyNotImported()
- def _askForGPGKeyImport(self, po, userid, hexkeyid):
+ def _askForGPGKeyImport(self,po,userid,hexkeyid):
'''
Ask for GPGKeyImport
'''
commit b9005045f0f870836bbf26432795d9be494107f5
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 15:53:07 2008 +0100
properly handle exceptions locally rather than using customTracebackHandler. fixes rh#443342
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 2662a25..973ce79 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -229,7 +229,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
try:
func(*args, **kwargs)
except yum.Errors.RepoError, e:
- self.error(ERROR_NO_CACHE,"Package cache is invalid and could not be rebuilt.")
+ self.error(ERROR_NO_CACHE,str(e))
return wrapper
@@ -416,7 +416,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
searchlist = ['name']
self.status(STATUS_QUERY)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
-
self._do_search(searchlist, filters, key)
def search_details(self,filters,key):
@@ -429,7 +428,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
searchlist = ['name', 'summary', 'description', 'group']
self.status(STATUS_QUERY)
-
self._do_search(searchlist, filters, key)
def _buildGroupDict(self):
@@ -497,7 +495,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
package_list.append((pkg,INFO_AVAILABLE))
except yum.Errors.GroupsError,e:
- self.error(ERROR_GROUP_NOT_FOUND,e)
+ self.error(ERROR_GROUP_NOT_FOUND,str(e))
# basename filter if specified
if FILTER_BASENAME in fltlist:
@@ -635,7 +633,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if len(pkgs) != 0:
return pkgs[0],True
# search the pkgSack for the nevra
- pkgs = self.yumbase.pkgSack.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
+ try:
+ pkgs = self.yumbase.pkgSack.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
# if the package is found, then return it
if len(pkgs) != 0:
return pkgs[0],False
@@ -667,8 +668,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if txmbrs:
rc,msgs = self.yumbase.buildTransaction()
if rc !=2:
- retmsg = "Error in Dependency Resolution;" + self._format_msgs(msgs)
- self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+ self.error(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
else:
for txmbr in self.yumbase.tsInfo:
if txmbr.po.name != pkg.name:
@@ -760,12 +760,13 @@ class PackageKitYumBackend(PackageKitBaseBackend):
fltlist = filters.split(';')
name = package.split(';')[0]
+
pkg,inst = self._findPackage(package)
results = {}
if pkg:
deps = self._get_best_dependencies(pkg)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+ self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
for pkg in deps:
if pkg.name != name:
pkgver = self._get_package_ver(pkg)
@@ -790,7 +791,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.conf.throttle = "60%" # Set bandwidth throttle to 60%
# to avoid taking all the system's bandwidth.
- txmbr = self.yumbase.update() # Add all updates to Transaction
+ try:
+ txmbr = self.yumbase.update() # Add all updates to Transaction
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
if txmbr:
self._runYumTransaction()
else:
@@ -831,7 +835,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.percentage(100)
except yum.Errors.RepoError, e:
- self.error(ERROR_REPO_CONFIGURATION_ERROR, str(e))
+ self.error(ERROR_REPO_CONFIGURATION_ERROR,str(e))
except yum.Errors.YumBaseError, e:
self.error(ERROR_UNKNOWN,str(e))
@@ -919,11 +923,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if len(self.yumbase.tsInfo) > 0:
self._runYumTransaction()
else:
- self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s " % inst_file)
+ self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % inst_file)
except yum.Errors.InstallError,e:
- msgs = ';'.join(e)
- self.error(ERROR_LOCAL_INSTALL_FAILED,msgs)
+ self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
except (yum.Errors.RepoError, yum.Errors.PackageSackError, IOError):
# We might not be able to connect to the internet to get
# repository metadata, or the package might not exist.
@@ -937,10 +940,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if len(self.yumbase.tsInfo) > 0:
self._runYumTransaction()
else:
- self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s " % inst_file)
+ self.error(ERROR_LOCAL_INSTALL_FAILED,"Can't install %s" % inst_file)
except yum.Errors.InstallError,e:
- msgs = ';'.join(e)
- self.error(ERROR_LOCAL_INSTALL_FAILED, msgs)
+ self.error(ERROR_LOCAL_INSTALL_FAILED,str(e))
def update(self, packages):
@@ -953,11 +955,14 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.percentage(0)
self.status(STATUS_RUNNING)
txmbrs = []
- for package in packages:
- pkg,inst = self._findPackage(package)
- if pkg:
- txmbr = self.yumbase.update(name=pkg.name)
- txmbrs.extend(txmbr)
+ try:
+ for package in packages:
+ pkg,inst = self._findPackage(package)
+ if pkg:
+ txmbr = self.yumbase.update(name=pkg.name)
+ txmbrs.extend(txmbr)
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
if txmbrs:
self._runYumTransaction()
else:
@@ -986,10 +991,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
Run the yum Transaction
This will only work with yum 3.2.4 or higher
'''
- rc,msgs = self.yumbase.buildTransaction()
+ try:
+ rc,msgs = self.yumbase.buildTransaction()
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
if rc !=2:
- retmsg = "Error in Dependency Resolution;" + self._format_msgs(msgs)
- self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
+ self.error(ERROR_DEP_RESOLUTION_FAILED,self._format_msgs(msgs))
else:
self._check_for_reboot()
if removedeps == False:
@@ -1004,11 +1011,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.processTransaction(callback=callback,
rpmDisplay=rpmDisplay)
except yum.Errors.YumDownloadError, ye:
- retmsg = "Error in Download;" + self._format_msgs(ye.value)
- self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,retmsg)
+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,self._format_msgs(ye.value))
except yum.Errors.YumGPGCheckError, ye:
- retmsg = "Error in Package Signatures;" + self._format_msgs(ye.value)
- self.error(ERROR_BAD_GPG_SIGNATURE,retmsg)
+ self.error(ERROR_BAD_GPG_SIGNATURE,self._format_msgs(ye.value))
except GPGKeyNotImported, e:
keyData = self.yumbase.missingGPGKey
if not keyData:
@@ -1024,7 +1029,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
keyData['fingerprint'],
keyData['timestamp'],
'GPG')
- self.error(ERROR_GPG_FAILURE,"GPG key not imported.")
+ self.error(ERROR_GPG_FAILURE,"GPG key %s required" % keyData['hexkeyid'])
except yum.Errors.YumBaseError, ye:
message = self._format_msgs(ye.value)
if message.find ("conflicts with file") != -1:
@@ -1044,16 +1049,19 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkg,inst = self._findPackage( package)
if pkg and inst:
- txmbr = self.yumbase.remove(name=pkg.name)
+ try:
+ txmbr = self.yumbase.remove(name=pkg.name)
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
if txmbr:
if allowdep != 'yes':
self._runYumTransaction(removedeps=False)
else:
self._runYumTransaction(removedeps=True)
else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+ self.error(ERROR_PACKAGE_NOT_INSTALLED,"Package %s is not installed" % package)
else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED,"Package is not installed")
+ self.error(ERROR_PACKAGE_NOT_INSTALLED,"Package %s is not installed" % package)
def get_description(self, package):
'''
@@ -1068,7 +1076,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if pkg:
self._show_description(pkg)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+ self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
def _show_description(self,pkg):
pkgver = self._get_package_ver(pkg)
@@ -1095,7 +1103,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.files(package, file_list)
else:
- self.error(ERROR_PACKAGE_NOT_FOUND,'Package was not found')
+ self.error(ERROR_PACKAGE_NOT_FOUND,'Package %s was not found' % package)
def _pkg_to_id(self,pkg):
pkgver = self._get_package_ver(pkg)
@@ -1183,7 +1191,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
fltlist = filters.split(';')
package_list = []
- ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
+ try:
+ ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
md = self.updateMetadata
for pkg in ygl.updates:
if self._do_extra_filtering(pkg, fltlist):
@@ -1219,7 +1230,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
repo.enablePersistent()
except yum.Errors.RepoError,e:
- self.error(ERROR_REPO_NOT_FOUND, "repo %s is not found" % repoid)
+ self.error(ERROR_REPO_NOT_FOUND,str(e))
def _is_development_repo(self, repo):
if repo.endswith('-debuginfo'):
@@ -1390,9 +1401,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.conf.cache = 0
self.yumbase.repos.setCache(0)
- self.yumbase.repos.populateSack(mdtype='metadata', cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='filelists', cacheonly=1)
- self.yumbase.repos.populateSack(mdtype='otherdata', cacheonly=1)
+ try:
+ self.yumbase.repos.populateSack(mdtype='metadata', cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='filelists', cacheonly=1)
+ self.yumbase.repos.populateSack(mdtype='otherdata', cacheonly=1)
+ except yum.Errors.RepoError,e:
+ self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
self.yumbase.conf.cache = old_cache_setting
self.yumbase.repos.setCache(old_cache_setting)
@@ -1403,23 +1417,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.dnlCallback = DownloadCallback(self,showNames=True) # Download callback
self.yumbase.repos.setProgressBar( self.dnlCallback ) # Setup the download callback class
- def customTracebackHandler(self,tb):
- '''
- Custom Traceback Handler
- this is called by the ExceptionHandler
- return True if the exception is handled in the method.
- return False if to do the default action an signal an error
- to packagekit.
- Overload this method if you what handle special Tracebacks
- '''
- if issubclass(tb, yum.Errors.RepoError):
- # Unhandled Repo error, can be network problems
-
- self.error(ERROR_REPO_NOT_AVAILABLE, "Problem connecting to software source. This can be caused by network problems or a misconfiguration.")
- return True
- else: # Do the default stuff
- return False
-
class DownloadCallback( BaseMeter ):
""" Customized version of urlgrabber.progress.BaseMeter class """
def __init__(self,base,showNames = False):
commit a11c940e571daf0708ac55128f658db65271834d
Merge: 6e43e63... 13c117d...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 15:26:01 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 6e43e63f614b0658f97516ad88c0016426d47c8d
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Apr 21 15:25:07 2008 +0100
correct the callback for UpdatesChanged, so the icon does the right thing
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index 2d31359..13a4d20 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -665,8 +665,7 @@ pk_control_init (PkControl *control)
dbus_g_proxy_connect_signal (control->priv->proxy, "TransactionListChanged",
G_CALLBACK(pk_control_transaction_list_changed_cb), control, NULL);
- dbus_g_proxy_add_signal (control->priv->proxy, "UpdatesChanged",
- G_TYPE_STRING, G_TYPE_INVALID);
+ dbus_g_proxy_add_signal (control->priv->proxy, "UpdatesChanged", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (control->priv->proxy, "UpdatesChanged",
G_CALLBACK (pk_control_updates_changed_cb), control, NULL);
commit 13c117d56fb050a39ac7986ac14f45e5b4d7e9ed
Author: Robin Norwood <rnorwood at redhat.com>
Date: Mon Apr 21 09:46:44 2008 -0400
Fix for bug #443341 - RefreshYumcache not defined.
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index b2b3625..2662a25 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -417,10 +417,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.status(STATUS_QUERY)
self.yumbase.doConfigSetup(errorlevel=0,debuglevel=0)# Setup Yum Config
- try:
- self._do_search(searchlist, filters, key)
- except RefreshYumCacheFailed, e:
- return
+ self._do_search(searchlist, filters, key)
def search_details(self,filters,key):
'''
@@ -433,10 +430,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
searchlist = ['name', 'summary', 'description', 'group']
self.status(STATUS_QUERY)
- try:
- self._do_search(searchlist, filters, key)
- except RefreshYumCacheFailed, e:
- return
+ self._do_search(searchlist, filters, key)
def _buildGroupDict(self):
pkgGroups= {}
commit 2840f48ffcc28ff455ec0ebe199ea361fc4e43a6
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date: Mon Apr 21 10:35:38 2008 +0200
poldek: move loading package cache from initalize to methods which really require it
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 4e2d312..a2d08de 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -41,6 +41,8 @@ static gchar* poldek_pkg_evr (const struct pkg *pkg);
static void poldek_backend_package (const struct pkg *pkg, gint status);
static long do_get_bytes_to_download (const struct poldek_ts *ts, const gchar *mark);
static gint do_get_files_to_download (const struct poldek_ts *ts, const gchar *mark);
+static void pb_load_packages (PkBackend *backend);
+static void poldek_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel, gboolean reset);
typedef enum {
TS_TYPE_ENUM_INSTALL,
@@ -949,6 +951,8 @@ search_package (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
cmd = poclidek_rcmd_new (cctx, NULL);
switch (d->mode) {
@@ -1116,6 +1120,22 @@ search_package (PkBackendThread *thread, gpointer data)
}
static void
+pb_load_packages (PkBackend *backend)
+{
+ gboolean allow_cancel = pk_backend_get_allow_cancel (backend);
+
+ /* this operation can't be cancelled, so if enabled, set allow_cancel to FALSE */
+ if (allow_cancel)
+ poldek_backend_set_allow_cancel (backend, FALSE, FALSE);
+
+ /* load information about installed and available packages */
+ poclidek_load_packages (cctx, POCLIDEK_LOAD_ALL);
+
+ if (allow_cancel)
+ poldek_backend_set_allow_cancel (backend, TRUE, FALSE);
+}
+
+static void
pb_error_show (PkBackend *backend, PkErrorCodeEnum errorcode)
{
/* Before emiting error_code try to find the most suitable PkErrorCodeEnum */
@@ -1210,9 +1230,6 @@ do_poldek_init (void) {
/* (...), but we don't need choose_equiv callback */
poldek_configure (ctx, POLDEK_CONF_OPT, POLDEK_OP_EQPKG_ASKUSER, 0);
- /* load information about installed and available packages */
- poclidek_load_packages (cctx, POCLIDEK_LOAD_ALL);
-
sigint_init ();
}
@@ -1319,6 +1336,8 @@ backend_get_depends_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
deppkgs = n_array_new (2, NULL, NULL);
installed = poldek_get_installed_packages ();
@@ -1380,6 +1399,8 @@ backend_get_description_thread (PkBackendThread *thread, gchar *package_id)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
pkg = poldek_get_pkg_from_package_id (package_id);
if (pkg)
@@ -1444,6 +1465,8 @@ backend_get_files_thread (PkBackendThread *thread, gchar *package_id)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
pkg = poldek_get_pkg_from_package_id (package_id);
if (pkg) {
@@ -1546,6 +1569,8 @@ backend_get_requires_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
reqpkgs = n_array_new (2, NULL, NULL);
pkg = poldek_get_pkg_from_package_id (d->package_id);
@@ -1607,6 +1632,8 @@ backend_get_update_detail_thread (PkBackendThread *thread, gchar *package_id)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
pi = pk_package_id_new_from_string (package_id);
rcmd = poclidek_rcmd_new (cctx, NULL);
@@ -1694,6 +1721,8 @@ backend_get_updates_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
rcmd = poclidek_rcmd_new (cctx, NULL);
if (rcmd) {
@@ -1765,6 +1794,8 @@ backend_install_package_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
/* setup callbacks */
poldek_configure (ctx, POLDEK_CONF_TSCONFIRM_CB, ts_confirm, td);
@@ -1918,6 +1949,8 @@ backend_remove_package_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
/* setup callbacks */
poldek_configure (ctx, POLDEK_CONF_TSCONFIRM_CB, ts_confirm, td);
@@ -2082,6 +2115,8 @@ backend_update_packages_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
/* setup callbacks */
poldek_configure (ctx, POLDEK_CONF_TSCONFIRM_CB, ts_confirm, td);
@@ -2189,6 +2224,8 @@ backend_update_system_thread (PkBackendThread *thread, gpointer data)
backend = pk_backend_thread_get_backend (thread);
g_return_val_if_fail (backend != NULL, FALSE);
+ pb_load_packages (backend);
+
/* setup callbacks */
poldek_configure (ctx, POLDEK_CONF_TSCONFIRM_CB, ts_confirm, td);
More information about the PackageKit-commit
mailing list