[packagekit] packagekit: Branch 'master' - 8 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Jan 13 02:31:40 PST 2008
backends/ipkg/pk-backend-ipkg.c | 15 +++++++++++++--
backends/test/pk-backend-test-thread.c | 26 ++++++++++++++++++++++++--
client/pk-console.c | 10 +++++++++-
client/pk-monitor.c | 13 +++++++++++++
src/pk-transaction-list.c | 23 -----------------------
5 files changed, 59 insertions(+), 28 deletions(-)
New commits:
commit 8af0c61a5408f8fac4e697b8050a76c22878ed78
Merge: e947fa9... 3a0e218...
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Jan 11 15:52:48 2008 +0000
Merge branch 'master' of git+ssh://thos@git.packagekit.org/srv/git/PackageKit
commit e947fa9dd2fa974a22b7c993f1711eb191fbbbba
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Jan 11 15:51:27 2008 +0000
ipkg: do not run init and destroy functions more times than required
diff --git a/backends/ipkg/pk-backend-ipkg.c b/backends/ipkg/pk-backend-ipkg.c
index 754094b..28610bf 100644
--- a/backends/ipkg/pk-backend-ipkg.c
+++ b/backends/ipkg/pk-backend-ipkg.c
@@ -44,6 +44,7 @@ enum filters {
};
/* global config structures */
+static int ref = 0;
static ipkg_conf_t global_conf;
static args_t args;
@@ -203,6 +204,10 @@ backend_initalize (PkBackend *backend)
int err;
g_return_if_fail (backend != NULL);
+ /* reference count for the global variables */
+ if (++ref > 1)
+ return;
+
/* Ipkg requires the PATH env variable to be set to find wget when
* downloading packages. PackageKit unsets all env variables as a
* security precaution, so we need to set PATH to something sensible
@@ -234,10 +239,16 @@ static void
backend_destroy (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- /* this appears to (sometimes) be freed elsewhere ... */
+
+ if (--ref > 0)
+ return;
+
+ /* this appears to (sometimes) be freed elsewhere, perhaps
+ * by the functions in libipkg.c */
/* ipkg_conf_deinit (&global_conf); */
args_deinit (&args);
g_free (last_error);
+ last_error = NULL;
}
commit 3a0e218dc9d23542422e4aa76782d2e98fe058b4
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 11 15:38:12 2008 +0000
init/destroy test in the thread test
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index 0493c20..b7a0711 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -25,6 +25,28 @@
#include <pk-backend.h>
/**
+ * backend_initalize:
+ * This should only be run once per backend load, i.e. not every transaction
+ */
+static void
+backend_initalize (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_debug ("FILTER: initalize");
+}
+
+/**
+ * backend_destroy:
+ * This should only be run once per backend load, i.e. not every transaction
+ */
+static void
+backend_destroy (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_debug ("FILTER: destroy");
+}
+
+/**
* backend_search_group_thread:
*/
static gboolean
@@ -93,8 +115,8 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
PK_BACKEND_OPTIONS (
"Test Thread", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- NULL, /* initalize */
- NULL, /* destroy */
+ backend_initalize, /* initalize */
+ backend_destroy, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
NULL, /* cancel */
commit 6a8166766c5ef12a5fed20c35db95b6c4be5b225
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 11 15:23:37 2008 +0000
don't allow searches to be done in parallel anymore - it's too racey
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 04bb541..30f97e7 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -249,9 +249,6 @@ pk_transaction_list_number_running (PkTransactionList *tlist)
gboolean
pk_transaction_list_commit (PkTransactionList *tlist, PkTransactionItem *item)
{
- PkRoleEnum role;
- gboolean search_okay = TRUE;
-
g_return_val_if_fail (tlist != NULL, FALSE);
g_return_val_if_fail (PK_IS_TRANSACTION_LIST (tlist), FALSE);
@@ -266,26 +263,6 @@ pk_transaction_list_commit (PkTransactionList *tlist, PkTransactionItem *item)
g_signal_connect (item->backend, "finished",
G_CALLBACK (pk_transaction_list_backend_finished_cb), tlist);
- /* if we are refreshing the cache then nothing is sacred */
- if (pk_transaction_list_role_present (tlist, PK_ROLE_ENUM_REFRESH_CACHE) == TRUE) {
- search_okay = FALSE;
- /* TODO: other backends might be different, need to abstract */
- }
-
- /* if it's a query then just do the action (if safe) */
- if (search_okay == TRUE) {
- pk_backend_get_role (item->backend, &role, NULL);
- if (role == PK_ROLE_ENUM_SEARCH_NAME ||
- role == PK_ROLE_ENUM_SEARCH_FILE ||
- role == PK_ROLE_ENUM_SEARCH_GROUP ||
- role == PK_ROLE_ENUM_SEARCH_DETAILS) {
- pk_debug ("running %s", item->tid);
- item->running = TRUE;
- pk_backend_run (item->backend);
- return TRUE;
- }
- }
-
/* do the transaction now if we have no other in progress */
if (pk_transaction_list_number_running (tlist) == 0) {
pk_debug ("running %s", item->tid);
commit baad687dc1c54df8559eacf02d8601600ef07b5f
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Jan 11 11:42:33 2008 +0000
ipkg: clean up verbose output
diff --git a/backends/ipkg/pk-backend-ipkg.c b/backends/ipkg/pk-backend-ipkg.c
index fed995d..754094b 100644
--- a/backends/ipkg/pk-backend-ipkg.c
+++ b/backends/ipkg/pk-backend-ipkg.c
@@ -59,7 +59,7 @@ ipkg_debug (ipkg_conf_t *conf, message_level_t level, char *msg)
/* print messages only if in verbose mode */
if (pk_debug_enabled ())
- printf ("IPKG <%d>: %s", level, msg);
+ printf ("IPKG: %s", msg);
/* free the last error message and store the new one */
g_free (last_error);
commit 353e4168229eb6744d4f76dfec2828ca10b7998e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 10 21:28:04 2008 +0000
load the cached restart type to present to the user in pkcon after a transaction has finished
diff --git a/client/pk-console.c b/client/pk-console.c
index 7afff25..4c1d169 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -371,6 +371,7 @@ pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
gchar *blanking;
const gchar *role_text;
gfloat time;
+ PkRestartEnum restart;
/* cancel the spinning */
if (timer_id != 0) {
@@ -390,6 +391,13 @@ pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
role_text = pk_role_enum_to_text (role);
time = (gfloat) runtime / 1000.0;
g_print ("%s runtime was %.1f seconds\n", role_text, time);
+
+ /* is there any restart to notify the user? */
+ restart = pk_client_get_require_restart (client);
+ if (restart != PK_RESTART_ENUM_NONE) {
+ g_print ("Requires restart: %s\n", pk_restart_enum_to_text (restart));
+ }
+
if (loop != NULL) {
g_main_loop_quit (loop);
}
commit 11d15092c5dfffeba6ce01ed72087be16c8ccfd1
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 10 21:23:18 2008 +0000
connect up RequireRestart for pkmon
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index cc4f9c7..d7f118a 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -66,6 +66,17 @@ pk_monitor_message_cb (PkClient *client, PkMessageEnum message, const gchar *det
}
/**
+ * pk_monitor_require_restart_cb:
+ **/
+static void
+pk_monitor_require_restart_cb (PkClient *client, PkRestartEnum restart, const gchar *details, gpointer data)
+{
+ gchar *tid = pk_client_get_tid (client);
+ g_print ("%s\tRequireRestart: %s, %s\n", tid, pk_restart_enum_to_text (restart), details);
+ g_free (tid);
+}
+
+/**
* pk_monitor_finished_cb:
**/
static void
@@ -144,6 +155,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_monitor_error_code_cb), NULL);
g_signal_connect (client, "message",
G_CALLBACK (pk_monitor_message_cb), NULL);
+ g_signal_connect (client, "require-restart",
+ G_CALLBACK (pk_monitor_require_restart_cb), NULL);
tlist = pk_task_list_new ();
g_signal_connect (tlist, "task-list-changed",
commit 5e1139b084867192fc1d8e0ad44a220d173a933b
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 10 21:12:55 2008 +0000
use the correct exit enum on finished for pk-client.c
diff --git a/client/pk-console.c b/client/pk-console.c
index 98595a8..7afff25 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -365,7 +365,7 @@ pk_client_wait (void)
* pk_console_finished_cb:
**/
static void
-pk_console_finished_cb (PkClient *client, PkStatusEnum status, guint runtime, gpointer data)
+pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpointer data)
{
PkRoleEnum role;
gchar *blanking;
More information about the PackageKit
mailing list