[packagekit] packagekit: Branch 'master' - 10 commits

Richard Hughes hughsient at kemper.freedesktop.org
Sat Nov 17 04:24:24 PST 2007


 backends/conary/helpers/conaryBackend.py |   18 +++
 backends/zypp/pk-backend-zypp.cpp        |  164 ++++++++++++++++++++++++++++++-
 configure.ac                             |    6 -
 html/pk-faq.html                         |    8 +
 src/Makefile.am                          |    1 
 src/pk-transaction-list.c                |    2 
 src/wscript_build                        |    4 
 7 files changed, 194 insertions(+), 9 deletions(-)

New commits:
commit d9cdf35432392eae605c0a720227b58dda8ded9c
Author: Boyd Timothy <btimothy at gmail.com>
Date:   Fri Nov 16 22:04:06 2007 -0700

    Use AC_DEFINE_UNQUOTED for DEFAULT_BACKEND and security_framework so they appear correctly in config.h

diff --git a/configure.ac b/configure.ac
index 17c6175..c566a71 100755
--- a/configure.ac
+++ b/configure.ac
@@ -235,7 +235,7 @@ if test x$with_security_framework = x; then
 	fi
 fi
 
-AC_DEFINE(security_framework, "$with_security_framework", [default security framework])
+AC_DEFINE_UNQUOTED(security_framework, "$with_security_framework", [default security framework])
 AC_SUBST(security_framework, "$with_security_framework")
 
 if test x$with_security_framework = xpolkit; then
@@ -286,7 +286,7 @@ if test x$with_default_backend = x; then
 	fi
 fi
 
-AC_DEFINE(DEFAULT_BACKEND, "$with_default_backend", [default backend prefix])
+AC_DEFINE_UNQUOTED(DEFAULT_BACKEND, "$with_default_backend", [default backend prefix])
 AC_SUBST(DEFAULT_BACKEND, "$with_default_backend")
 
 AC_DEFUN([APT_BACKEND],
commit 7ec69c7bf81814cc7dacb6fb79ae20a17b592407
Author: Boyd Timothy <btimothy at gmail.com>
Date:   Fri Nov 16 21:53:22 2007 -0700

    Removed AC_DEFINE_UNQUOTED for PK_DB_DIR and replaced with src/Makefile.am -DPK_DB_DIR so the DB file gets opened properly when building from source and installing to a prefix like /usr/local

diff --git a/configure.ac b/configure.ac
index 956b6e2..17c6175 100755
--- a/configure.ac
+++ b/configure.ac
@@ -437,8 +437,6 @@ AC_SUBST(PK_PLUGIN_DIR, "\$(libdir)/packagekit-backend")
 AC_SUBST(PK_PLUGIN_CFLAGS, "-I\$(top_srcdir)/src -I\$(top_srcdir)/libpackagekit $GLIB_CFLAGS $DBUS_CFLAGS $GMODULE_CFLAGS")
 AC_SUBST(PK_PLUGIN_LIBS, "$GLIB_LIBS $DBUS_LIBS $GMODULE_LIBS")
 
-AC_DEFINE_UNQUOTED(PK_DB_DIR, "${localstatedir}/lib/PackageKit", [database dir])
-
 AM_CONDITIONAL(BACKEND_TYPE_DUMMY, [test x$with_default_backend = xdummy], [using dummy backend])
 AM_CONDITIONAL(BACKEND_TYPE_APT, [test x$with_default_backend = xapt], [using APT backend])
 AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$with_default_backend = xyum], [using YUM backend])
diff --git a/src/Makefile.am b/src/Makefile.am
index 6d9de76..c1e5573 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,6 +24,7 @@ INCLUDES =						\
 	-DVERSION="\"$(VERSION)\"" 			\
 	-DPK_DATA=\"$(pkgdatadir)\"			\
 	-DLOCALSTATEDIR=\""$(localstatedir)"\" 		\
+	-DPK_DB_DIR=\""$(PK_DB_DIR)"\" 			\
 	-I$(top_srcdir)/libpackagekit			\
 	-I$(top_srcdir)/libselftest			\
 	-I$(top_srcdir)/libgbus				\
commit 60fe7b19bbd539bbd1c0bd3d5b30376ecfa60615
Author: Boyd Timothy <btimothy at gmail.com>
Date:   Fri Nov 16 20:45:03 2007 -0700

    Applied patch from JP Rosevear to prevent crash from not allocating enough memory in pk_transaction_list_get_array ().

diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 37ba2ec..04bb541 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -315,7 +315,7 @@ pk_transaction_list_get_array (PkTransactionList *tlist)
 	length = tlist->priv->array->len;
 
 	/* create new strv list */
-	array = g_new0 (gchar *, length);
+	array = g_new0 (gchar *, length + 1);
 
 	pk_debug ("%i active transactions", length);
 	for (i=0; i<length; i++) {
commit 8870320e03186705153213aac4a670d1acd7e504
Author: Boyd Timothy <btimothy at gmail.com>
Date:   Fri Nov 16 18:02:43 2007 -0700

    Stubbing out backend_search_name in zypp backend (using some code from pk-backend-box.c).

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 6252c1c..c21307a 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -39,6 +39,19 @@
 #include <zypp/Repository.h>
 #include <zypp/RepoManager.h>
 
+enum PkgSearchType {
+	SEARCH_TYPE_NAME = 0,
+	SEARCH_TYPE_DETAILS = 1,
+	SEARCH_TYPE_FILE = 2,
+	SEARCH_TYPE_RESOLVE = 3
+};
+
+typedef struct {
+	gchar *search;
+	gchar *filter;
+	gint mode;
+} FindData;
+
 typedef struct {
 	gchar *package_id;
 	gint type;
@@ -118,7 +131,134 @@ backend_get_description (PkBackend *backend, const gchar *package_id)
 	}
 }
 
+/* TODO: this was taken directly from pk-backend-box.c.  Perhaps this
+ * ought to be part of libpackagekit? */
+static void
+parse_filter (const gchar *filter, gboolean *installed, gboolean *available,
+	      gboolean *devel, gboolean *nondevel, gboolean *gui, gboolean *text)
+{
+	gchar **sections = NULL;
+	gint i = 0;
+
+	*installed = TRUE;
+	*available = TRUE;
+	*devel = TRUE;
+	*nondevel = TRUE;
+	*gui = TRUE;
+	*text = TRUE;
+
+	sections = g_strsplit (filter, ";", 0);
+	while (sections[i]) {
+		if (strcmp(sections[i], "installed") == 0)
+			*available = FALSE;
+		if (strcmp(sections[i], "~installed") == 0)
+			*installed = FALSE;
+		if (strcmp(sections[i], "devel") == 0)
+			*nondevel = FALSE;
+		if (strcmp(sections[i], "~devel") == 0)
+			*devel = FALSE;
+		if (strcmp(sections[i], "gui") == 0)
+			*text = FALSE;
+		if (strcmp(sections[i], "~gui") == 0)
+			*gui = FALSE;
+		i++;
+	}
+	g_strfreev (sections);
+}
+
+static void
+find_packages_real (PkBackend *backend, const gchar *search, const gchar *filter, gint mode)
+{
+	//GList *list = NULL;
+	gboolean installed;
+	gboolean available;
+	gboolean devel;
+	gboolean nondevel;
+	gboolean gui;
+	gboolean text;
+
+	g_return_if_fail (backend != NULL);
+
+	pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
+
+	parse_filter (filter, &installed, &available, &devel, &nondevel, &gui, &text);
+
+	pk_backend_no_percentage_updates (backend);
+
+/*
+	if (mode == SEARCH_TYPE_FILE) {
+		if (installed == FALSE && available == FALSE) {
+			pk_backend_error_code (backend, PK_ERROR_ENUM_UNKNOWN, "invalid search mode");
+		} else	{
+			list = box_db_repos_search_file_with_filter (db, search, search_filter);
+			add_packages_from_list (backend, list, FALSE);
+			box_db_repos_package_list_free (list);
+		}
+	} else if (mode == SEARCH_TYPE_RESOLVE) {
+		list = box_db_repos_packages_search_one (db, (gchar *)search);
+		add_packages_from_list (backend, list, FALSE);
+		box_db_repos_package_list_free (list);
+	} else {
+		if (installed == FALSE && available == FALSE) {
+			pk_backend_error_code (backend, PK_ERROR_ENUM_UNKNOWN, "invalid search mode");
+		} else	{
+			if (installed == TRUE && available == TRUE) {
+				list = box_db_repos_packages_search_all(db, (gchar *)search, search_filter);
+			} else if (installed == TRUE) {
+				list = box_db_repos_packages_search_installed(db, (gchar *)search, search_filter);
+			} else if (available == TRUE) {
+				list = box_db_repos_packages_search_available(db, (gchar *)search, search_filter);
+			}
+			add_packages_from_list (backend, list, FALSE);
+			box_db_repos_package_list_free (list);
+		}
+	}
+*/
+}
+
+static gboolean
+backend_find_packages_thread (PkBackend *backend, gpointer data)
+{
+	FindData *d = (FindData*) data;
+
+	g_return_val_if_fail (backend != NULL, FALSE);
+
+	find_packages_real (backend, d->search, d->filter, d->mode);
+
+	g_free(d->search);
+	g_free(d->filter);
+	g_free(d);
+
+	return TRUE;
+}
+
+static void
+find_packages (PkBackend *backend, const gchar *search, const gchar *filter, gint mode)
+{
+	FindData *data = g_new0(FindData, 1);
+
+	g_return_if_fail (backend != NULL);
+
+	if (data == NULL) {
+		pk_backend_error_code(backend, PK_ERROR_ENUM_OOM, "Failed to allocate memory");
+		pk_backend_finished (backend);
+	} else {
+		data->search = g_strdup(search);
+		data->filter = g_strdup(filter);
+		data->mode = mode;
+		pk_backend_thread_helper (backend, backend_find_packages_thread, data);
+	}
+}
 
+/**
+ * backend_search_name:
+ */
+static void
+backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+	g_return_if_fail (backend != NULL);
+	find_packages (backend, search, filter, SEARCH_TYPE_NAME);
+}
 
 /**
  * backend_get_repo_list:
@@ -205,7 +345,7 @@ extern "C" PK_BACKEND_OPTIONS (
 	NULL,					/* search_details */
 	NULL,					/* search_file */
 	NULL,					/* search_group */
-	NULL,					/* search_name */
+	backend_search_name,			/* search_name */
 	NULL,					/* update_package */
 	NULL,					/* update_system */
 	backend_get_repo_list,			/* get_repo_list */
commit a254dacdb5943acc3a7b4210aa7690791b137078
Author: Ken VanDine <ken at vandine.org>
Date:   Fri Nov 16 11:14:36 2007 -0500

    send STATUS_REFRESH_CACHE

diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index fd1e0e4..18f789f 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -209,6 +209,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
 
     def refresh_cache(self):
         self.percentage()
+        self.status(STATUS_REFRESH_CACHE)
         cache = Cache()
         cache.populate_database()
 
commit ec3a61f9640aa6ddd7e8cd77ae93011924a4fe09
Author: Ken VanDine <ken at vandine.org>
Date:   Fri Nov 16 09:43:45 2007 -0500

    emit status for more methods

diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index c5e2fa3..fd1e0e4 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -122,6 +122,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
 
     def resolve(self, filter, package):
         self.allow_interrupt(True)
+        self.percentage(None)
+        self.status(STATUS_INFO)
         self._do_search(package, filter)
 
     def check_installed(self, troveTuple):
@@ -140,6 +142,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
         '''
         self.allow_interrupt(True)
         self.percentage(None)
+        self.status(STATUS_QUERY)
 
         self._do_search(searchlist, options)
 
@@ -173,6 +176,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
                 'Package was not found')
 
     def get_files(self, package_id):
+        self.allow_interrupt(True)
+        self.percentage(None)
+        self.status(STATUS_INFO)
         def _get_files(troveSource, n, v, f):
             files = []
             troves = [(n, v, f)]
@@ -213,6 +219,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
         name, version, flavor, installed = self._findPackage(package_id)
 
         self.allow_interrupt(True)
+        self.percentage(None)
+        self.status(STATUS_INSTALL)
 
         if name:
             if installed == INFO_INSTALLED:
@@ -262,6 +270,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
                 longDesc
                 categories
         '''
+
+        self.allow_interrupt(True)
+        self.percentage(None)
+        self.status(STATUS_QUERY)
+
         n, v, f = self.get_package_from_id(id)
 
         trvList = self.client.repos.findTrove(self.cfg.installLabelPath,
@@ -278,6 +291,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
         '''
         Print a detailed description for a given package
         '''
+        self.allow_interrupt(True)
+        self.percentage(None)
+        self.status(STATUS_INFO)
+
         name, version, flavor, installed = self._findPackage(id)
 
         if name:
commit df3f78e8512265b5689a5ebf0be810c9d689f9e3
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 16 14:38:35 2007 +0000

    add a faq entry about hughsie's law

diff --git a/html/pk-faq.html b/html/pk-faq.html
index ea22229..d71d503 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -175,6 +175,14 @@ No more fighting over <code>yum</code>, <code>yum-updatesd</code>,
 <code>pup</code> and <code>pirut</code>.
 </p>
 
+<h3>What is Hughsie's law?</h3>
+<p>
+A joke that started on IRC late one night in '07.
+Put formally it is: <i>Authentication or licence prompts can only be done before the
+transaction has started, and messages or notices about the transaction
+can only be shown after the transaction has completed.</i>
+</p>
+
 <h3>Is there an organization or corporation sponsoring development of PackageKit?</h3>
 <p>
 PackageKit is not sponsored by anyone.
commit ee350d4dd673c9ef8eef9aa6ae57ab819e0aa4d6
Merge: 28d26f9... 2d59962...
Author: Scott Reeves <sreeves at novell.com>
Date:   Thu Nov 15 15:34:17 2007 -0700

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

commit 2d5996214123752d2d4f1b55f5f005a0087dae57
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 16 00:42:04 2007 +0000

    fix waf build

diff --git a/src/wscript_build b/src/wscript_build
index 8194649..630cd53 100644
--- a/src/wscript_build
+++ b/src/wscript_build
@@ -13,7 +13,7 @@ env = bld.env()
 
 # Build the objects that are to be a part of both packagekitd and the testsuite
 obj = bld.create_obj('gnome', 'objects')
-obj.includes = '. ../libpackagekit ../libselftest'
+obj.includes = '. ../libpackagekit ../libselftest ../libgbus'
 obj.target = 'pkgkitd_common_source'
 obj.uselib = 'DBUS_GLIB GMODULE SQLITE GTHREAD'
 obj.add_marshal_file('pk-marshal.list', 'pk_marshal', '--header')
@@ -46,7 +46,7 @@ if env['SECURITY_TYPE_POLKIT']:
 obj = bld.create_obj('gnome', 'program')
 obj.target = 'packagekitd'
 obj.source = 'pk-main.c'
-obj.includes = '. ../libpackagekit ../libselftest'
+obj.includes = '. ../libpackagekit ../libselftest ../libgbus'
 obj.add_objects = 'pkgkitd_common_source'
 obj.uselib = 'DBUS_GLIB GMODULE SQLITE GTHREAD'
 obj.uselib_local = 'libpackagekit'
commit 28d26f913e0bc422e0db83b920821bac2da4ac40
Author: Scott Reeves <sreeves at novell.com>
Date:   Thu Nov 15 15:33:53 2007 -0700

    add exception handling and start fleshing out refresh

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index eb1fdef..6252c1c 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -75,6 +75,14 @@ backend_get_description_thread (PkBackend *backend, gpointer data)
 	pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
 
 	// FIXME: Call libzypp here to get the "Selectable"
+	try
+	{
+		zypp::RepoManager manager;
+		//zypp::Repository repository(manager.createFromCach(repo));
+	}
+	catch ( const zypp::Exception &e)
+	{
+	}
 
 	pk_backend_description (backend,
 				pi->name,		// package_id
@@ -123,7 +131,19 @@ backend_get_repo_list (PkBackend *backend)
 	pk_backend_change_status (backend, PK_STATUS_ENUM_QUERY);
 
 	zypp::RepoManager manager;
-	std::list <zypp::RepoInfo> repos = manager.knownRepositories();
+	std::list <zypp::RepoInfo> repos;
+	try
+	{
+		repos = manager.knownRepositories();
+	}
+	catch ( const zypp::Exception &e)
+	{
+		// FIXME: make sure this dumps out the right sring.
+		pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, e.asUserString().c_str() );
+		pk_backend_finished (backend);
+		return;
+	}
+
 	for (std::list <zypp::RepoInfo>::iterator it = repos.begin(); it != repos.end(); it++) {
 		// RepoInfo::alias - Unique identifier for this source.
 		// RepoInfo::name - Short label or description of the



More information about the PackageKit mailing list