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

Richard Hughes hughsient at kemper.freedesktop.org
Sun Apr 27 16:59:37 PDT 2008


 backends/conary/helpers/conaryBackend.py |    2 ++
 backends/yum/helpers/yumBackend.py       |   17 ++++++++++++-----
 backends/zypp/zypp-events.h              |    7 +++++--
 libpackagekit/pk-client.c                |    8 ++++++++
 libpackagekit/pk-client.h                |    1 +
 5 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 9d4babeba7bb844889c3f5663901dd26730257f8
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Apr 28 01:09:38 2008 +0100

    when we find a package by it's repo id, make sure we take into account the NEVRA _and_ the repo_id. Fixes rh#443976

diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index ab7c1db..387ee9e 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -630,7 +630,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             e = v = r = a = None
         # search the rpmdb for the nevra
         pkgs = self.yumbase.rpmdb.searchNevra(name=n,epoch=e,ver=v,rel=r,arch=a)
-        # if the package is found, then return it
+        # if the package is found, then return it (do not have to match the repo_id)
         if len(pkgs) != 0:
             return pkgs[0],True
         # search the pkgSack for the nevra
@@ -638,11 +638,18 @@ class PackageKitYumBackend(PackageKitBaseBackend):
             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
-        else:
+        # nothing found
+        if len(pkgs) == 0:
             return None,False
+        # one NEVRA in a single repo
+        if len(pkgs) == 1:
+            return pkgs[0],False
+        # we might have the same NEVRA in multiple repos, match by repo name
+        for pkg in pkgs:
+            if d == pkg.repoid:
+                return pkg,False
+        # repo id did not match
+        return None,False
 
     def _get_pkg_requirements(self,pkg,reqlist=[]):
         pkgs = self.yumbase.rpmdb.searchRequires(pkg.name)
commit 7aae8dad9473c15251b54a8ad202d49abda18f78
Author: Scott Reeves <sreeves at novell.com>
Date:   Sun Apr 27 09:56:45 2008 -0600

    add download location

diff --git a/backends/zypp/zypp-events.h b/backends/zypp/zypp-events.h
index 3243821..2955d98 100644
--- a/backends/zypp/zypp-events.h
+++ b/backends/zypp/zypp-events.h
@@ -274,10 +274,13 @@ struct DownloadProgressReportReceiver : public zypp::callback::ReceiveReport<zyp
 		clear_package_id ();
 		_package_id = build_package_id_from_url (&file);
 
-		//fprintf (stderr, "\n\n----> DownloadProgressReportReceiver::start(): %s\n", _package_id == NULL ? "unknown" : _package_id);
+		//pk_debug ("DownloadProgressReportReceiver::start():%s --%s\n",
+		//		g_strdup (file.asString().c_str()),	g_strdup (localfile.asString().c_str()) );
 		if (_package_id != NULL) {
+			gchar* summary = g_strdup (file.asString().c_str());
 			pk_backend_set_status (_backend, PK_STATUS_ENUM_DOWNLOAD);
-			pk_backend_package (_backend, PK_INFO_ENUM_DOWNLOADING, _package_id, "TODO: Put the package summary here if possible");
+			pk_backend_package (_backend, PK_INFO_ENUM_DOWNLOADING, _package_id, summary);
+			g_free (summary);
 			reset_sub_percentage ();
 		}
 	}
commit 7fd8f231f8d13a0d2916e83406bc6203f16e13d3
Author: Ken VanDine <ken at vandine.org>
Date:   Sun Apr 27 09:10:01 2008 -0400

    Use the new style get_package_update for install and remove

diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index b7ef3e1..822d913 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -403,6 +403,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
                     'Package already installed')
 
             self.status(STATUS_INSTALL)
+            self._get_package_update(name, version, flavor)
             self._do_package_update(name, version, flavor)
         else:
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
@@ -424,6 +425,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
 
             self.status(STATUS_REMOVE)
             name = '-%s' % name
+            self._get_package_update(name, version, flavor)
             self._do_package_update(name, version, flavor)
         else:
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED,
commit ef4c2d59397061ae594cd064b5ff6f12f7a11689
Author: Richard Hughes <richard at hughsie.com>
Date:   Sat Apr 26 13:47:49 2008 +0100

    return a specific error code when we fail to get auth. fixes rh#443551

diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index ba46404..e943cc4 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -147,6 +147,7 @@ pk_client_error_get_type (void)
 		static const GEnumValue values[] =
 		{
 			ENUM_ENTRY (PK_CLIENT_ERROR_FAILED, "Failed"),
+			ENUM_ENTRY (PK_CLIENT_ERROR_FAILED_AUTH, "FailedAuth"),
 			ENUM_ENTRY (PK_CLIENT_ERROR_NO_TID, "NoTid"),
 			ENUM_ENTRY (PK_CLIENT_ERROR_ALREADY_TID, "AlreadyTid"),
 			ENUM_ENTRY (PK_CLIENT_ERROR_ROLE_UNKNOWN, "RoleUnkown"),
@@ -1097,6 +1098,13 @@ pk_client_update_system (PkClient *client, GError **error)
 			/* retry the action now we have got auth */
 			ret = pk_client_update_system_action (client, &error_pk);
 		}
+		if (pk_polkit_client_error_denied_by_policy (error_pk)) {
+			/* we failed to get an auth */
+			pk_client_error_set (error, PK_CLIENT_ERROR_FAILED_AUTH, error_pk->message);
+			/* clear old error */
+			g_clear_error (&error_pk);
+			return FALSE;
+		}
 	}
 	/* we failed one of these, return the error to the user */
 	if (!ret) {
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index af8d471..f99d973 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -57,6 +57,7 @@ G_BEGIN_DECLS
 typedef enum
 {
 	PK_CLIENT_ERROR_FAILED,
+	PK_CLIENT_ERROR_FAILED_AUTH,
 	PK_CLIENT_ERROR_NO_TID,
 	PK_CLIENT_ERROR_ALREADY_TID,
 	PK_CLIENT_ERROR_ROLE_UNKNOWN,


More information about the PackageKit-commit mailing list