[packagekit] packagekit: Branch 'master' - 9 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sat Jan 26 08:48:48 PST 2008
TODO | 4 ++++
backends/dummy/pk-backend-dummy.c | 18 ++++++++++++++----
backends/yum/helpers/Makefile.am | 9 +++++++++
backends/yum/helpers/yumBackend.py | 2 +-
backends/yum/helpers/yumDBUSBackend.py | 2 +-
libpackagekit/pk-enum.c | 2 +-
libpackagekit/pk-enum.h | 2 +-
python/packagekit/daemonBackend.py | 6 +++---
src/pk-backend-spawn.c | 2 +-
src/pk-backend.c | 10 ++++++----
src/pk-engine.c | 16 ++++++++++++----
src/pk-runner.c | 3 ++-
12 files changed, 55 insertions(+), 21 deletions(-)
New commits:
commit bf800d761f840c1f5ed5fab1456b1e5da2e5f620
Author: Richard Hughes <richard at hughsie.com>
Date: Sat Jan 26 16:42:28 2008 +0000
as we can't use the backend in a cached update list (we don't assign it ever) we should do the signals raw, the old fashioned way
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 718effb..2c8c5eb 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -922,21 +922,29 @@ pk_engine_get_updates (PkEngine *engine, const gchar *tid, DBusGMethodInvocation
pk_engine_item_commit (engine, item);
/* try and reuse cache */
- if (FALSE && engine->priv->updates_cache != NULL) {
+ if (engine->priv->updates_cache != NULL) {
PkPackageItem *package;
+ const gchar *info_text;
+ const gchar *exit_text;
guint i;
guint length;
length = pk_package_list_get_size (engine->priv->updates_cache);
- pk_debug ("we have cached data (%i) we could use!", length);
+ pk_debug ("we have cached data (%i) we should use!", length);
/* emulate the backend */
pk_runner_set_role (item->runner, PK_ROLE_ENUM_GET_UPDATES);
for (i=0; i<length; i++) {
package = pk_package_list_get_item (engine->priv->updates_cache, i);
- pk_engine_package_cb (engine->priv->backend, package->info, package->package_id, package->summary, engine);
+ info_text = pk_info_enum_to_text (package->info);
+ g_signal_emit (engine, signals [PK_ENGINE_PACKAGE], 0, tid, info_text, package->package_id, package->summary);
}
- pk_engine_finished_cb (engine->priv->backend, PK_EXIT_ENUM_SUCCESS, engine);
+
+ /* we are done */
+ exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
+ pk_debug ("emitting finished transaction:%s, '%s'", tid, exit_text);
+ g_signal_emit (engine, signals [PK_ENGINE_FINISHED], 0, tid, exit_text, 0);
+
pk_engine_item_delete (engine, item);
dbus_g_method_return (context);
return;
commit 3493356ac9a54a954c2f72f4a70b83a5e7313eae
Author: Tim Lauridsen <tim at naboo.local>
Date: Sat Jan 26 13:27:05 2008 +0100
yum: use pkg.repo.id, instead of pkg.repoid, because of some changes in upstream yum
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index da00640..d53f8a5 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -310,7 +310,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
count = 1
for (pkg,values) in res:
# are we installed?
- if pkg.repoid == 'installed':
+ if pkg.repo.id == 'installed':
if FILTER_NOT_INSTALLED not in fltlist:
if self._do_extra_filtering(pkg,fltlist):
count+=1
diff --git a/backends/yum/helpers/yumDBUSBackend.py b/backends/yum/helpers/yumDBUSBackend.py
index bd72286..1995569 100755
--- a/backends/yum/helpers/yumDBUSBackend.py
+++ b/backends/yum/helpers/yumDBUSBackend.py
@@ -312,7 +312,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
count = 1
for (pkg,values) in res:
# are we installed?
- if pkg.repoid == 'installed':
+ if pkg.repo.id == 'installed':
if FILTER_NOT_INSTALLED not in fltlist:
if self._do_extra_filtering(pkg,fltlist):
count+=1
commit 70f5a90e5907c691fbd5dfaeb5aebbb2f0164284
Merge: 3fa8125... 3d6768a...
Author: Robin Norwood <rnorwood at redhat.com>
Date: Fri Jan 25 14:26:46 2008 -0500
Merge branch 'master' of git+ssh://rnorwood@git.packagekit.org/srv/git/PackageKit
commit 3fa8125840d510ee23889870b49ea2dbb29dd7d9
Author: Robin Norwood <rnorwood at redhat.com>
Date: Fri Jan 25 14:25:36 2008 -0500
I *think* these are the correct names.
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 82de3f3..7d838e3 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -40,9 +40,9 @@ class PackageKitBaseBackend(PackageKitDbusInterface):
self.daemonize()
PackageKitDbusInterface.__init__(self,
- 'org.freedesktop.PackageKitDbus',
- 'org.freedesktop.PackageKitDbus',
- '/org/freedesktop/PackageKitDbus')
+ 'org.freedesktop.PackageKitYumBackend',
+ 'org.freedesktop.PackageKitYumBackend',
+ '/org/freedesktop/PackageKitYumBackend')
self._locked = False
self.loop = gobject.MainLoop()
commit f6a218e029437a256c473b244680fc23555cc09d
Author: Robin Norwood <rnorwood at redhat.com>
Date: Fri Jan 25 14:24:21 2008 -0500
Put yumDBUSBackend.py in the right place.
diff --git a/backends/yum/helpers/Makefile.am b/backends/yum/helpers/Makefile.am
index aefc764..50d92c4 100644
--- a/backends/yum/helpers/Makefile.am
+++ b/backends/yum/helpers/Makefile.am
@@ -3,6 +3,11 @@ helperdir = $(datadir)/PackageKit/helpers/yum
NULL =
+dbusinstancedir = $(LIBEXECDIR)
+dbusinstance_DATA = \
+ yumDBUSBackend.py \
+ $(NULL)
+
dist_helper_DATA = \
search-name.py \
search-details.py \
@@ -27,6 +32,10 @@ dist_helper_DATA = \
yumBackend.py \
$(NULL)
+EXTRA_DIST = \
+ $(dbusinstance_DATA) \
+ $(NULL)
+
install-data-hook:
chmod a+rx $(DESTDIR)$(helperdir)/*.py
commit 3d6768ab0f497be1634a2d7b8cb7072bb0953dd6
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 25 15:50:21 2008 +0000
rename PK_ERROR_ENUM_PROCESS_QUIT, to PK_ERROR_ENUM_TRANSACTION_CANCELLED
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 2a720dc..18dd942 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -87,7 +87,7 @@ backend_cancel (PkBackend *backend)
g_source_remove (signal_timeout);
signal_timeout = 0;
/* now mark as finished */
- pk_backend_error_code (backend, PK_ERROR_ENUM_GPG_FAILURE,
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED,
"The task was stopped successfully");
pk_backend_finished (backend);
}
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index fb83347..e3760df 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -106,6 +106,7 @@ static PkEnumMatch enum_error[] = {
{PK_ERROR_ENUM_FILTER_INVALID, "filter-invalid"},
{PK_ERROR_ENUM_PACKAGE_ID_INVALID, "package-id-invalid"},
{PK_ERROR_ENUM_TRANSACTION_ERROR, "transaction-error"},
+ {PK_ERROR_ENUM_TRANSACTION_CANCELLED, "transaction-cancelled"},
{PK_ERROR_ENUM_PACKAGE_NOT_INSTALLED, "package-not-installed"},
{PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "package-not-found"},
{PK_ERROR_ENUM_PACKAGE_ALREADY_INSTALLED, "package-already-installed"},
@@ -115,7 +116,6 @@ static PkEnumMatch enum_error[] = {
{PK_ERROR_ENUM_CREATE_THREAD_FAILED, "create-thread-failed"},
{PK_ERROR_ENUM_REPO_NOT_FOUND, "repo-not-found"},
{PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, "cannot-remove-system-package"},
- {PK_ERROR_ENUM_PROCESS_QUIT, "process-quit"},
{PK_ERROR_ENUM_PROCESS_KILL, "process-kill"},
{PK_ERROR_ENUM_FAILED_INITIALIZATION, "failed-initialization"},
{PK_ERROR_ENUM_FAILED_FINALISE, "failed-finalise"},
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 01d3c7f..0074691 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -179,10 +179,10 @@ typedef enum {
PK_ERROR_ENUM_FILTER_INVALID,
PK_ERROR_ENUM_CREATE_THREAD_FAILED,
PK_ERROR_ENUM_TRANSACTION_ERROR,
+ PK_ERROR_ENUM_TRANSACTION_CANCELLED,
PK_ERROR_ENUM_NO_CACHE,
PK_ERROR_ENUM_REPO_NOT_FOUND,
PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE,
- PK_ERROR_ENUM_PROCESS_QUIT,
PK_ERROR_ENUM_PROCESS_KILL,
PK_ERROR_ENUM_FAILED_INITIALIZATION,
PK_ERROR_ENUM_FAILED_FINALISE,
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 7da5f34..1c1f22c 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -376,7 +376,7 @@ pk_backend_spawn_finished_cb (PkSpawn *spawn, PkExitEnum exit, PkBackendSpawn *b
/* if we quit the process, set an error */
if (exit == PK_EXIT_ENUM_QUIT) {
/* we just call this failed, and set an error */
- pk_backend_error_code (backend_spawn->priv->backend, PK_ERROR_ENUM_PROCESS_QUIT,
+ pk_backend_error_code (backend_spawn->priv->backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED,
"Transaction was cancelled");
}
commit 696fd8a21cf8c999ae6915d9ce3dc6234f66a891
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 25 15:40:47 2008 +0000
allow cancelling the dummy backend
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 4c41099..2a720dc 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -26,6 +26,7 @@
#include <pk-backend.h>
static guint progress_percentage;
+static gulong signal_timeout = 0;
/**
* backend_initalize:
@@ -74,7 +75,6 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
-1);
}
-#if 0
/**
* backend_cancel:
*/
@@ -82,8 +82,16 @@ static void
backend_cancel (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
+ /* cancel the timeout */
+ if (signal_timeout != 0) {
+ g_source_remove (signal_timeout);
+ signal_timeout = 0;
+ /* now mark as finished */
+ pk_backend_error_code (backend, PK_ERROR_ENUM_GPG_FAILURE,
+ "The task was stopped successfully");
+ pk_backend_finished (backend);
+ }
}
-#endif
/**
* backend_get_depends:
@@ -257,7 +265,7 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
pk_backend_package (backend, PK_INFO_ENUM_DOWNLOADING,
"gtkhtml2;2.19.1-4.fc8;i386;fedora",
"An HTML widget for GTK+ 2.0");
- g_timeout_add (1000, backend_install_timeout, backend);
+ signal_timeout = g_timeout_add (1000, backend_install_timeout, backend);
}
/**
@@ -295,7 +303,7 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
g_return_if_fail (backend != NULL);
progress_percentage = 0;
pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- g_timeout_add (500, backend_refresh_cache_timeout, backend);
+ signal_timeout = g_timeout_add (500, backend_refresh_cache_timeout, backend);
}
/**
@@ -410,7 +418,7 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
g_return_if_fail (backend != NULL);
pk_backend_no_percentage_updates (backend);
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- g_timeout_add (2000, backend_search_name_timeout, backend);
+ signal_timeout = g_timeout_add (2000, backend_search_name_timeout, backend);
}
/**
@@ -476,7 +484,7 @@ backend_update_system (PkBackend *backend)
pk_backend_set_allow_cancel (backend, TRUE);
progress_percentage = 0;
pk_backend_require_restart (backend, PK_RESTART_ENUM_SYSTEM, NULL);
- g_timeout_add (1000, backend_update_system_timeout, backend);
+ signal_timeout = g_timeout_add (1000, backend_update_system_timeout, backend);
}
/**
@@ -534,7 +542,7 @@ PK_BACKEND_OPTIONS (
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
- NULL, /* cancel */
+ backend_cancel, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
backend_get_files, /* get_files */
commit 01ed61f3c7fd967f586ea2e3ebffb7ab9f23b2ca
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 25 15:27:55 2008 +0000
add an assert if we have no cancel action and get a allow-cancel signal
diff --git a/src/pk-runner.c b/src/pk-runner.c
index 74b8a2f..506db6e 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -1028,6 +1028,7 @@ pk_runner_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkRunner *
{
g_return_if_fail (runner != NULL);
g_return_if_fail (PK_IS_RUNNER (runner));
+ g_return_if_fail (runner->priv->backend->desc->cancel != NULL);
pk_debug ("AllowCancel now %i", allow_cancel);
runner->priv->allow_cancel = allow_cancel;
commit df8d62c4798c1af2e9f3b4b8befe1407eb19dff7
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 25 15:24:56 2008 +0000
by default we cannot cancel the runner
diff --git a/TODO b/TODO
index c77cbf4..fabb1fa 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,9 @@
Order of no particular importance:
+* Add cancelling (present tense) as a status and assign it from ->cancel
+
+* Find out why yum doesn't output some package status calls.
+
* Lots of the functions are not well commented with gtk-doc. Most
important is to get the libpackagekit/*.c annotated as it's used in
other projects. This is probably quite a boring job but is a good way to
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index f2b5534..4c41099 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -74,6 +74,7 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
-1);
}
+#if 0
/**
* backend_cancel:
*/
@@ -82,6 +83,7 @@ backend_cancel (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
}
+#endif
/**
* backend_get_depends:
@@ -532,7 +534,7 @@ PK_BACKEND_OPTIONS (
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
- backend_cancel, /* cancel */
+ NULL, /* cancel */
backend_get_depends, /* get_depends */
backend_get_description, /* get_description */
backend_get_files, /* get_files */
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 4f975ef..5124c75 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -602,9 +602,6 @@ pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- pk_debug ("emit allow-cancel %i", allow_cancel);
- backend->priv->allow_cancel = allow_cancel;
-
/* remove or add the hal inhibit */
if (allow_cancel == TRUE) {
pk_inhibit_remove (backend->priv->inhibit, backend);
@@ -612,7 +609,12 @@ pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
pk_inhibit_add (backend->priv->inhibit, backend);
}
- g_signal_emit (backend, signals [PK_BACKEND_ALLOW_CANCEL], 0, allow_cancel);
+ /* can we do the action? */
+ if (backend->desc->cancel != NULL) {
+ backend->priv->allow_cancel = allow_cancel;
+ pk_debug ("emit allow-cancel %i", allow_cancel);
+ g_signal_emit (backend, signals [PK_BACKEND_ALLOW_CANCEL], 0, allow_cancel);
+ }
return TRUE;
}
diff --git a/src/pk-runner.c b/src/pk-runner.c
index 1ddf131..74b8a2f 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -1129,7 +1129,7 @@ pk_runner_init (PkRunner *runner)
{
runner->priv = PK_RUNNER_GET_PRIVATE (runner);
runner->priv->finished = FALSE;
- runner->priv->allow_cancel = TRUE;
+ runner->priv->allow_cancel = FALSE;
runner->priv->dbus_name = NULL;
runner->priv->cached_enabled = FALSE;
runner->priv->cached_package_id = NULL;
More information about the PackageKit
mailing list