[packagekit] packagekit: Branch 'master' - 12 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Feb 17 15:38:30 PST 2008
backends/alpm/pk-backend-alpm.c | 4 -
backends/apt/pk-backend-apt.c | 8 +-
backends/apt2/pk-backend-apt2.c | 8 +-
backends/box/pk-backend-box.c | 6 +-
backends/conary/pk-backend-conary.c | 8 +-
backends/dummy/pk-backend-dummy.c | 6 +-
backends/opkg/pk-backend-opkg.c | 6 +-
backends/pisi/pk-backend-pisi.c | 8 +-
backends/smart/pk-backend-smart.c | 2
backends/test/helpers/search-name.sh | 4 -
backends/test/pk-backend-test-dbus.c | 8 +-
backends/test/pk-backend-test-fail.c | 4 -
backends/test/pk-backend-test-nop.c | 2
backends/test/pk-backend-test-spawn.c | 8 +-
backends/test/pk-backend-test-succeed.c | 6 +-
backends/test/pk-backend-test-thread.c | 8 +-
backends/yum/pk-backend-yum.c | 8 +-
backends/yum2/pk-backend-yum2.c | 8 +-
backends/zypp/pk-backend-zypp.cpp | 4 -
data/.gitignore | 2
data/tests/pk-spawn-test.sh | 8 +-
docs/spec/pk-introduction.xml | 7 ++
libpackagekit/pk-common.c | 3 -
libpackagekit/pk-enum.c | 2
libpackagekit/pk-enum.h | 2
libpackagekit/pk-extra-obj.c | 2
src/pk-backend-dbus.c | 6 +-
src/pk-backend-spawn.c | 87 ++++++++++++++++++++++++++++++--
src/pk-backend-thread.c | 23 ++++++--
src/pk-backend.c | 41 ++++++++++++---
src/pk-conf.c | 2
src/pk-spawn.c | 5 -
tools/add-error-enum.sh | 2
33 files changed, 223 insertions(+), 85 deletions(-)
New commits:
commit 4e02e024bb06d1ac4bac32040aea81be5d6c20ba
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 23:35:50 2008 +0000
fix the unref problems that stopped the self check working properly
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index e96cccd..5ce5316 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -682,6 +682,10 @@ libst_backend_spawn (LibSelfTest *test)
libst_failed (test, "invalid name %s", text);
}
+ /* needed to avoid an error */
+ pk_backend_set_name (backend_spawn->priv->backend, "test_spawn");
+ pk_backend_lock (backend_spawn->priv->backend);
+
/************************************************************
********** Check parsing common error ***********
************************************************************/
@@ -823,6 +827,7 @@ libst_backend_spawn (LibSelfTest *test)
/* needed to avoid an error */
pk_backend_spawn_set_name (backend_spawn, "test_spawn");
pk_backend_set_name (backend_spawn->priv->backend, "test_spawn");
+ pk_backend_lock (backend_spawn->priv->backend);
/* so we can spin until we finish */
g_signal_connect (backend_spawn->priv->backend, "finished",
diff --git a/src/pk-backend-thread.c b/src/pk-backend-thread.c
index 447904a..389af37 100644
--- a/src/pk-backend-thread.c
+++ b/src/pk-backend-thread.c
@@ -216,6 +216,10 @@ libst_backend_thread (LibSelfTest *test)
libst_failed (test, NULL);
}
+ /* needed to call initialize and destroy */
+ pk_backend_set_name (backend, "dummy");
+ pk_backend_lock (backend);
+
/************************************************************/
libst_title (test, "wait for a thread to return true");
g_timer_start (timer);
@@ -239,8 +243,13 @@ libst_backend_thread (LibSelfTest *test)
}
/* reset the backend */
- g_object_unref (backend);
- backend = pk_backend_new ();
+ g_object_unref (backend_thread);
+ backend_thread = pk_backend_thread_new ();
+ backend = pk_backend_thread_get_backend (backend_thread);
+
+ /* needed to call initialize and destroy */
+ pk_backend_set_name (backend, "dummy");
+ pk_backend_lock (backend);
/************************************************************/
libst_title (test, "wait for a thread to return false");
@@ -265,8 +274,13 @@ libst_backend_thread (LibSelfTest *test)
}
/* reset the backend */
- g_object_unref (backend);
- backend = pk_backend_new ();
+ g_object_unref (backend_thread);
+ backend_thread = pk_backend_thread_new ();
+ backend = pk_backend_thread_get_backend (backend_thread);
+
+ /* needed to call initialize and destroy */
+ pk_backend_set_name (backend, "dummy");
+ pk_backend_lock (backend);
/************************************************************/
libst_title (test, "wait for a thread to return false (straight away)");
@@ -288,7 +302,6 @@ libst_backend_thread (LibSelfTest *test)
}
g_object_unref (backend_thread);
- g_object_unref (backend);
g_timer_destroy (timer);
libst_end (test);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 43df9ab..71fae8e 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -189,13 +189,16 @@ pk_backend_unlock (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
- g_return_val_if_fail (backend->desc != NULL, FALSE);
if (backend->priv->locked == FALSE) {
pk_warning ("already unlocked");
return FALSE;
}
- if (backend->desc->destroy) {
+ if (backend->desc == NULL) {
+ pk_warning ("not yet loaded backend, try pk_backend_lock()");
+ return FALSE;
+ }
+ if (backend->desc->destroy != NULL) {
backend->desc->destroy (backend);
}
backend->priv->locked = FALSE;
@@ -246,6 +249,7 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* set the same twice? */
if (backend->priv->last_percentage == percentage) {
@@ -286,6 +290,7 @@ guint
pk_backend_get_runtime (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, 0);
+ g_return_val_if_fail (backend->priv->locked != FALSE, 0);
return pk_time_get_elapsed (backend->priv->time);
}
@@ -297,6 +302,7 @@ pk_backend_set_sub_percentage (PkBackend *backend, guint percentage)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* set the same twice? */
if (backend->priv->last_subpercentage == percentage) {
@@ -326,6 +332,7 @@ pk_backend_no_percentage_updates (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* invalidate previous percentage */
backend->priv->last_percentage = PK_BACKEND_PERCENTAGE_INVALID;
@@ -343,6 +350,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* already this? */
if (backend->priv->status == status) {
@@ -364,6 +372,7 @@ pk_backend_get_status (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
return backend->priv->status;
}
@@ -377,6 +386,7 @@ pk_backend_package (PkBackend *backend, PkInfoEnum info, const gchar *package, c
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* we automatically set the transaction status for some infos */
if (info == PK_INFO_ENUM_DOWNLOADING) {
@@ -416,6 +426,7 @@ pk_backend_update_detail (PkBackend *backend, const gchar *package_id,
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* replace unsafe chars */
update_text_safe = pk_strsafe (update_text);
@@ -438,6 +449,7 @@ pk_backend_get_progress (PkBackend *backend,
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
*percentage = backend->priv->last_percentage;
*subpercentage = backend->priv->last_subpercentage;
@@ -454,6 +466,7 @@ pk_backend_require_restart (PkBackend *backend, PkRestartEnum restart, const gch
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit require-restart %i, %s", restart, details);
g_signal_emit (backend, signals [PK_BACKEND_REQUIRE_RESTART], 0, restart, details);
@@ -472,6 +485,7 @@ pk_backend_message (PkBackend *backend, PkMessageEnum message, const gchar *form
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
va_start (args, format);
g_vasprintf (&buffer, format, args);
@@ -492,6 +506,7 @@ pk_backend_set_transaction_data (PkBackend *backend, const gchar *data)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit change-transaction-data %s", data);
g_signal_emit (backend, signals [PK_BACKEND_CHANGE_TRANSACTION_DATA], 0, data);
@@ -510,6 +525,7 @@ pk_backend_description (PkBackend *backend, const gchar *package_id,
gchar *description_safe;
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* replace unsafe chars */
description_safe = pk_strsafe (description);
@@ -533,6 +549,7 @@ pk_backend_files (PkBackend *backend, const gchar *package_id,
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit files %s, %s", package_id, filelist);
g_signal_emit (backend, signals [PK_BACKEND_FILES], 0,
@@ -549,6 +566,7 @@ pk_backend_updates_changed (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit updates-changed");
g_signal_emit (backend, signals [PK_BACKEND_UPDATES_CHANGED], 0);
@@ -565,6 +583,7 @@ pk_backend_repo_signature_required (PkBackend *backend, const gchar *repository_
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit repo-signature-required %s, %s, %s, %s, %s, %s, %i",
repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, type);
@@ -582,6 +601,7 @@ pk_backend_repo_detail (PkBackend *backend, const gchar *repo_id,
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("emit repo-detail %s, %s, %i", repo_id, description, enabled);
g_signal_emit (backend, signals [PK_BACKEND_REPO_DETAIL], 0, repo_id, description, enabled);
@@ -599,6 +619,7 @@ pk_backend_error_code (PkBackend *backend, PkErrorCodeEnum code, const gchar *fo
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
va_start (args, format);
g_vsnprintf (buffer, 1024, format, args);
@@ -630,6 +651,7 @@ 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);
g_return_val_if_fail (backend->desc != NULL, FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* remove or add the hal inhibit */
if (allow_cancel == TRUE) {
@@ -655,6 +677,7 @@ pk_backend_get_allow_cancel (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
return backend->priv->allow_cancel;
}
@@ -666,6 +689,7 @@ pk_backend_set_role (PkBackend *backend, PkRoleEnum role)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* Should only be called once... */
if (backend->priv->role != PK_ROLE_ENUM_UNKNOWN) {
@@ -691,6 +715,7 @@ pk_backend_get_role (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, PK_ROLE_ENUM_UNKNOWN);
g_return_val_if_fail (PK_IS_BACKEND (backend), PK_ROLE_ENUM_UNKNOWN);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
return backend->priv->role;
}
@@ -718,6 +743,7 @@ pk_backend_finished (PkBackend *backend)
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* find out what we just did */
role_text = pk_role_enum_to_text (backend->priv->role);
@@ -778,6 +804,7 @@ pk_backend_not_implemented_yet (PkBackend *backend, const gchar *method)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* this function is only valid when we have a running transaction */
if (backend->priv->c_tid != NULL) {
@@ -800,6 +827,7 @@ pk_backend_get_backend_detail (PkBackend *backend, gchar **name, gchar **author)
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (backend->desc != NULL, FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
if (name != NULL && backend->desc->description != NULL) {
*name = g_strdup (backend->desc->description);
@@ -818,6 +846,7 @@ pk_backend_get_current_tid (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, NULL);
g_return_val_if_fail (PK_IS_BACKEND (backend), NULL);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
return backend->priv->c_tid;
}
@@ -829,6 +858,7 @@ pk_backend_set_current_tid (PkBackend *backend, const gchar *tid)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+ g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
pk_debug ("setting backend tid as %s", tid);
g_free (backend->priv->c_tid);
@@ -856,11 +886,8 @@ pk_backend_finalize (GObject *object)
pk_backend_finished_delay (backend);
}
- if (backend->desc != NULL) {
- if (backend->desc->destroy != NULL) {
- backend->desc->destroy (backend);
- }
- }
+ /* unlock the backend to call destroy */
+ pk_backend_unlock (backend);
g_free (backend->priv->name);
g_free (backend->priv->c_tid);
commit daa9f7ae710e963febb6b2c800e2d203843d9a03
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 23:19:01 2008 +0000
we might not have actually set a name when we unref the PkBackendDbus object, don't throw a warning
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 6079d58..582f58d 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -1049,7 +1049,11 @@ pk_backend_dbus_finalize (GObject *object)
backend_dbus = PK_BACKEND_DBUS (object);
g_free (backend_dbus->priv->service);
- g_object_unref (backend_dbus->priv->proxy);
+
+ /* we might not have actually set a name yet */
+ if (backend_dbus->priv->proxy != NULL) {
+ g_object_unref (backend_dbus->priv->proxy);
+ }
g_object_unref (backend_dbus->priv->backend);
G_OBJECT_CLASS (pk_backend_dbus_parent_class)->finalize (object);
commit 8c861abd79ded7a445430b8a619f99e5d66577f4
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 22:53:39 2008 +0000
correct the spelling of initialize (from initalize)
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 12a830e..81b5197 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -348,7 +348,7 @@ backend_destroy (PkBackend *backend)
}
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
backend_initialize (PkBackend *backend)
@@ -780,7 +780,7 @@ backend_get_repo_list (PkBackend *backend)
PK_BACKEND_OPTIONS (
"alpm", /* description */
"Andreas Obergrusberger <tradiaz at yahoo.de>", /* author */
- backend_initialize, /* initalize */
+ backend_initialize, /* initialize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 2f8311b..51d80b9 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -33,14 +33,14 @@ PkBackendSpawn *spawn;
static PkNetwork *network;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "apt");
@@ -245,7 +245,7 @@ backend_get_repo_list (PkBackend *backend)
PK_BACKEND_OPTIONS (
"Apt (with " APT_SEARCH " searching)", /* description */
"Ali Sabil <ali.sabil at gmail.com>; Tom Parker <palfrey at tevp.net>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/apt2/pk-backend-apt2.c b/backends/apt2/pk-backend-apt2.c
index cea5b39..e04381c 100644
--- a/backends/apt2/pk-backend-apt2.c
+++ b/backends/apt2/pk-backend-apt2.c
@@ -30,14 +30,14 @@ static PkNetwork *network;
#define PK_DBUS_BACKEND_SERVICE_APT "org.freedesktop.PackageKitAptBackend"
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_APT);
@@ -252,7 +252,7 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
PK_BACKEND_OPTIONS (
"Apt", /* description */
"Ali Sabil <ali.sabil at gmail.com>; Tom Parker <palfrey at tevp.net>; Sebastian Heinlein <glatzor at ubuntu.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 7138e3a..6930de1 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -546,10 +546,10 @@ backend_refresh_cache_thread (PkBackendThread *thread, gpointer data)
/* ===================================================================== */
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
@@ -889,7 +889,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Box", /* description */
"Grzegorz DÄ
browski <gdx at o2.pl>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
NULL, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index f21790e..6c67d04 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -28,15 +28,15 @@ static PkBackendSpawn *spawn;
static PkNetwork *network;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "conary");
@@ -383,7 +383,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Conary", /* description */
"Ken VanDine <ken at vandine.org>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 8e6ad7d..376998f 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -29,10 +29,10 @@ static guint progress_percentage;
static gulong signal_timeout = 0;
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
progress_percentage = 0;
@@ -553,7 +553,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Dummy", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c
index 9176670..4d7ee0e 100644
--- a/backends/opkg/pk-backend-opkg.c
+++ b/backends/opkg/pk-backend-opkg.c
@@ -240,10 +240,10 @@ parse_filter (const gchar *filter)
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
int err;
g_return_if_fail (backend != NULL);
@@ -913,7 +913,7 @@ backend_get_groups (PkBackend *backend, PkEnumList *elist)
PK_BACKEND_OPTIONS (
"opkg", /* description */
"Thomas Wood <thomas at openedhand.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 45cf2f4..ce971e7 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -28,14 +28,14 @@ static PkBackendSpawn *spawn;
static PkNetwork *network;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "pisi");
@@ -353,7 +353,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"PiSi", /* description */
"S.ÃaÄlar Onur <caglar at pardus.org.tr>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 1cec462..91e88f8 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -27,7 +27,7 @@
PK_BACKEND_OPTIONS (
"SMART", /* description */
"James Bowes <jbowes at dangerouslyinc.com>", /* author */
- NULL, /* initalize */
+ NULL, /* initialize */
NULL, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c
index 0d7b532..f5433a5 100644
--- a/backends/test/pk-backend-test-dbus.c
+++ b/backends/test/pk-backend-test-dbus.c
@@ -42,14 +42,14 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
}
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_TEST);
}
@@ -70,7 +70,7 @@ backend_destroy (PkBackend *backend)
PK_BACKEND_OPTIONS (
"Test Dbus", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index 49ce16e..39c18a9 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -25,7 +25,7 @@
#include <pk-backend.h>
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
backend_initialize (PkBackend *backend)
@@ -273,7 +273,7 @@ backend_update_system (PkBackend *backend)
PK_BACKEND_OPTIONS (
"Test Fail", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initialize, /* initalize */
+ backend_initialize, /* initialize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index 862fe2e..5b0b814 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -26,7 +26,7 @@
PK_BACKEND_OPTIONS (
"Test NOP", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- NULL, /* initalize */
+ NULL, /* initialize */
NULL, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index b7e10ab..7b7e157 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -40,14 +40,14 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
}
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "test");
}
@@ -67,7 +67,7 @@ backend_destroy (PkBackend *backend)
PK_BACKEND_OPTIONS (
"Test Spawn", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index 29cbdd5..5b52ecb 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -25,10 +25,10 @@
#include <pk-backend.h>
/**
- * backend_initalize:
+ * backend_initialize:
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
}
@@ -308,7 +308,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Test Succeed", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index f6ec03c..398f41a 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -28,14 +28,14 @@
static PkBackendThread *thread;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
/* we use the thread helper */
thread = pk_backend_thread_new ();
@@ -134,7 +134,7 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
PK_BACKEND_OPTIONS (
"Test Thread", /* description */
"Richard Hughes <richard at hughsie.com>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
NULL, /* get_groups */
NULL, /* get_filters */
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index c47b415..b858e30 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -27,14 +27,14 @@ static PkBackendSpawn *spawn;
static PkNetwork *network;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "yum");
@@ -375,7 +375,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"YUM", /* description */
"Tim Lauridsen <timlau at fedoraproject.org>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/yum2/pk-backend-yum2.c b/backends/yum2/pk-backend-yum2.c
index b0f2e62..9dea670 100644
--- a/backends/yum2/pk-backend-yum2.c
+++ b/backends/yum2/pk-backend-yum2.c
@@ -29,14 +29,14 @@ static PkNetwork *network;
#define PK_DBUS_BACKEND_SERVICE_YUM "org.freedesktop.PackageKitYumBackend"
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
-backend_initalize (PkBackend *backend)
+backend_initialize (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_debug ("FILTER: initalize");
+ pk_debug ("FILTER: initialize");
network = pk_network_new ();
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_YUM);
@@ -362,7 +362,7 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"YUM", /* description */
"Tim Lauridsen <timlau at fedoraproject.org>", /* author */
- backend_initalize, /* initalize */
+ backend_initialize, /* initalize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index bc3e70e..bea3f95 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -106,7 +106,7 @@ static std::map<PkBackend *, EventDirector *> _eventDirectors;
static PkBackendThread *thread;
/**
- * backend_initalize:
+ * backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
static void
@@ -1167,7 +1167,7 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
extern "C" PK_BACKEND_OPTIONS (
"Zypp", /* description */
"Boyd Timothy <btimothy at gmail.com>, Scott Reeves <sreeves at novell.com>", /* author */
- backend_initialize, /* initalize */
+ backend_initialize, /* initialize */
backend_destroy, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
commit 2c6fca80372d264df431c07e0ddb99a68fdc823d
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 22:25:23 2008 +0000
fix some more memory leaks in the self test code
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 9f0558e..6752123 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -1144,9 +1144,9 @@ libst_common (LibSelfTest *test)
} else {
libst_failed (test, "failed the padd '%s', extra %i", text_safe, length);
}
+ g_free (text_safe);
/************************************************************/
- g_free (text_safe);
libst_title (test, "pad smaller, 1 extra");
length = 1;
text_safe = pk_strpad_extra ("richard", 10, &length);
@@ -1166,6 +1166,7 @@ libst_common (LibSelfTest *test)
} else {
libst_failed (test, "failed the padd '%s', extra %i", text_safe, length);
}
+ g_free (text_safe);
/************************************************************
**************** REPLACE CHARS ******************
diff --git a/libpackagekit/pk-extra-obj.c b/libpackagekit/pk-extra-obj.c
index ba17253..61d67c1 100644
--- a/libpackagekit/pk-extra-obj.c
+++ b/libpackagekit/pk-extra-obj.c
@@ -212,6 +212,7 @@ libst_extra_obj (LibSelfTest *test)
} else {
libst_failed (test, "got %s", eobj->summary);
}
+ pk_extra_obj_free (eobj);
/************************************************************/
libst_title (test, "get an wrong object");
@@ -229,7 +230,6 @@ libst_extra_obj (LibSelfTest *test)
} else {
libst_failed (test, "got %s", eobj->summary);
}
-
pk_extra_obj_free (eobj);
libst_end (test);
commit f877db0272862ef5258fe28d22676ce1290bf7b5
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 22:14:20 2008 +0000
fix a memory leak in the self test code
diff --git a/src/pk-conf.c b/src/pk-conf.c
index bc9109b..b9b2669 100644
--- a/src/pk-conf.c
+++ b/src/pk-conf.c
@@ -198,6 +198,7 @@ libst_conf (LibSelfTest *test)
} else {
libst_failed (test, "got NULL!");
}
+ g_free (text);
/************************************************************/
libst_title (test, "get a string that doesn't exist");
@@ -207,6 +208,7 @@ libst_conf (LibSelfTest *test)
} else {
libst_failed (test, "got return value '%s'", text);
}
+ g_free (text);
/************************************************************/
libst_title (test, "get the shutdown timeout");
commit 019fe9502a29aa4c877ccfc991708496474e94a5
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 21:57:35 2008 +0000
don't leak a loop object in PkSpawn
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index d556bec..d848cc8 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -527,6 +527,7 @@ libst_spawn (LibSelfTest *test)
/* get new object */
new_spawn_object (test, &spawn);
+ loop = g_main_loop_new (NULL, FALSE);
/************************************************************/
libst_title (test, "make sure return error for missing file");
@@ -558,7 +559,6 @@ libst_spawn (LibSelfTest *test)
}
/* spin for a bit, todo add timer to break out if we fail */
- loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
/************************************************************/
@@ -608,7 +608,6 @@ libst_spawn (LibSelfTest *test)
g_timeout_add_seconds (1, cancel_cb, spawn);
/* spin for a bit, todo add timer to break out if we fail */
- loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
/************************************************************/
@@ -636,7 +635,6 @@ libst_spawn (LibSelfTest *test)
g_timeout_add_seconds (1, cancel_cb, spawn);
/* spin for a bit, todo add timer to break out if we fail */
- loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
/************************************************************/
@@ -661,6 +659,7 @@ libst_spawn (LibSelfTest *test)
g_object_unref (spawn);
g_free (path);
+ g_main_loop_unref (loop);
libst_end (test);
}
commit 6feaf4e2db3df0f12140f9cd491610096cb38152
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 21:54:08 2008 +0000
add another more involved test for the packages in the PkBackendSpawn class
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 9d55cd5..e96cccd 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -121,7 +121,6 @@ pk_backend_spawn_parse_common_output (PkBackendSpawn *backend_spawn, const gchar
goto out;
}
pk_backend_package (backend_spawn->priv->backend, info, sections[2], sections[3]);
-pk_error ("moo");
} else if (pk_strequal (command, "description") == TRUE) {
if (size != 7) {
pk_warning ("invalid command '%s'", command);
@@ -537,6 +536,7 @@ pk_backend_spawn_helper (PkBackendSpawn *backend_spawn, const gchar *script, con
gchar *arguments;
g_return_val_if_fail (backend_spawn != NULL, FALSE);
+ g_return_val_if_fail (backend_spawn->priv->name != NULL, FALSE);
/* get the argument list */
va_start (args, first_element);
@@ -608,6 +608,29 @@ pk_backend_spawn_new (void)
#ifdef PK_BUILD_TESTS
#include <libselftest.h>
+static GMainLoop *loop;
+static guint number_packages = 0;
+
+/**
+ * pk_backend_spawn_test_finished_cb:
+ **/
+static void
+pk_backend_spawn_test_finished_cb (PkBackend *backend, PkExitEnum exit, PkBackendSpawn *backend_spawn)
+{
+ g_main_loop_quit (loop);
+}
+
+/**
+ * pk_backend_spawn_test_package_cb:
+ **/
+static void
+pk_backend_spawn_test_package_cb (PkBackend *backend, PkInfoEnum info,
+ const gchar *package_id, const gchar *summary,
+ PkBackendSpawn *backend_spawn)
+{
+ number_packages++;
+}
+
void
libst_backend_spawn (LibSelfTest *test)
{
@@ -617,6 +640,7 @@ libst_backend_spawn (LibSelfTest *test)
GTimer *timer;
timer = g_timer_new ();
+ loop = g_main_loop_new (NULL, FALSE);
if (libst_start (test, "PkBackendSpawn", CLASS_AUTO) == FALSE) {
return;
@@ -642,7 +666,7 @@ libst_backend_spawn (LibSelfTest *test)
/************************************************************/
libst_title (test, "set backend name");
- ret = pk_backend_spawn_set_name (backend_spawn, "dummy");
+ ret = pk_backend_spawn_set_name (backend_spawn, "test_spawn");
if (ret == TRUE) {
libst_success (test, NULL);
} else {
@@ -652,7 +676,7 @@ libst_backend_spawn (LibSelfTest *test)
/************************************************************/
libst_title (test, "get backend name");
text = pk_backend_spawn_get_name (backend_spawn);
- if (pk_strequal(text, "dummy") == TRUE) {
+ if (pk_strequal(text, "test_spawn") == TRUE) {
libst_success (test, NULL);
} else {
libst_failed (test, "invalid name %s", text);
@@ -760,7 +784,7 @@ libst_backend_spawn (LibSelfTest *test)
}
/* needed to avoid an error */
- pk_backend_set_name (backend_spawn->priv->backend, "dummy");
+ pk_backend_set_name (backend_spawn->priv->backend, "test_spawn");
/************************************************************/
libst_title (test, "test pk_backend_spawn_parse_common_error AllowUpdate1");
@@ -792,8 +816,47 @@ libst_backend_spawn (LibSelfTest *test)
libst_failed (test, "did not validate correctly");
}
+ /* reset */
+ g_object_unref (backend_spawn);
+ backend_spawn = pk_backend_spawn_new ();
+
+ /* needed to avoid an error */
+ pk_backend_spawn_set_name (backend_spawn, "test_spawn");
+ pk_backend_set_name (backend_spawn->priv->backend, "test_spawn");
+
+ /* so we can spin until we finish */
+ g_signal_connect (backend_spawn->priv->backend, "finished",
+ G_CALLBACK (pk_backend_spawn_test_finished_cb), backend_spawn);
+ /* so we can count the returned packages */
+ g_signal_connect (backend_spawn->priv->backend, "package",
+ G_CALLBACK (pk_backend_spawn_test_package_cb), backend_spawn);
+
+ /************************************************************
+ ********** Use a spawned helper ***********
+ ************************************************************/
+ libst_title (test, "test search-name.sh running");
+ ret = pk_backend_spawn_helper (backend_spawn, "search-name.sh", "none", "bar", NULL);
+ if (ret == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "cannot spawn search-name.sh");
+ }
+
+ /* wait for finished */
+ g_main_loop_run (loop);
+
+ /************************************************************/
+ libst_title (test, "test number of packages");
+ if (number_packages == 2) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "wrong number of packages %s", number_packages);
+ }
+
+ /* done */
g_timer_destroy (timer);
g_object_unref (backend_spawn);
+ g_main_loop_unref (loop);
libst_end (test);
}
commit cbee677eae0cdd5f821299c74202298e42c0e133
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 21:19:41 2008 +0000
more representative test output
diff --git a/backends/test/helpers/search-name.sh b/backends/test/helpers/search-name.sh
index 5a48bfe..6866608 100644
--- a/backends/test/helpers/search-name.sh
+++ b/backends/test/helpers/search-name.sh
@@ -12,8 +12,8 @@
echo "no-percentage-updates" > /dev/stderr
echo "status query" > /dev/stderr
sleep 1
-echo "package 1 glib2;2.14.0;i386;fedora The GLib library"
+echo "package available glib2;2.14.0;i386;fedora The GLib library"
sleep 1
-echo "package 1 gtk2;gtk2-2.11.6-6.fc8;i386;fedora GTK+ Libraries for GIMP"
+echo "package installed gtk2;gtk2-2.11.6-6.fc8;i386;fedora GTK+ Libraries for GIMP"
exit 0
commit 7f496e4f6a988c4cb559df612034c7c0dceb732f
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 20:53:52 2008 +0000
add a stdout test for PkBackendSpawn
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index 04afc74..9d55cd5 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -121,6 +121,7 @@ pk_backend_spawn_parse_common_output (PkBackendSpawn *backend_spawn, const gchar
goto out;
}
pk_backend_package (backend_spawn->priv->backend, info, sections[2], sections[3]);
+pk_error ("moo");
} else if (pk_strequal (command, "description") == TRUE) {
if (size != 7) {
pk_warning ("invalid command '%s'", command);
@@ -779,6 +780,18 @@ libst_backend_spawn (LibSelfTest *test)
libst_failed (test, "did not validate correctly");
}
+ /************************************************************
+ ********** Check parsing common out ***********
+ ************************************************************/
+ libst_title (test, "test pk_backend_spawn_parse_common_out Package");
+ ret = pk_backend_spawn_parse_common_output (backend_spawn,
+ "package\tinstalled\tgnome-power-manager;0.0.1;i386;data\tMore useless software");
+ if (ret == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "did not validate correctly");
+ }
+
g_timer_destroy (timer);
g_object_unref (backend_spawn);
commit 846d28049fec8f7b214afe41c3647c4471d6815b
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 20:37:03 2008 +0000
update gitignore
diff --git a/data/.gitignore b/data/.gitignore
index c07654d..3152d6e 100644
--- a/data/.gitignore
+++ b/data/.gitignore
@@ -3,4 +3,6 @@ org.freedesktop.PackageKitTestBackend.conf
org.freedesktop.PackageKitTestBackend.service
org.freedesktop.PackageKitYumBackend.conf
org.freedesktop.PackageKitYumBackend.service
+org.freedesktop.PackageKitAptBackend.conf
+org.freedesktop.PackageKitAptBackend.service
commit 0665495f6fd6730a6479d6d281caaebed5ad8207
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 20:36:21 2008 +0000
make output more like what we send
diff --git a/data/tests/pk-spawn-test.sh b/data/tests/pk-spawn-test.sh
index 29561be..dfba273 100755
--- a/data/tests/pk-spawn-test.sh
+++ b/data/tests/pk-spawn-test.sh
@@ -17,10 +17,10 @@ echo -e "percentage\t30" > /dev/stderr
sleep ${time}
echo -e "percentage\t40" > /dev/stderr
sleep ${time}
-echo -e "package:1\tpolkit\tPolicyKit daemon"
-echo -e "package:0\tpolkit-gnome\tPolicyKit helper for GNOME"
+echo -e "package\tavailable\tpolkit;0.0.1;i386;data\tPolicyKit daemon"
+echo -e "package\tinstalled\tpolkit-gnome;0.0.1;i386;data\tPolicyKit helper for GNOME"
sleep ${time}
-echo -e -n "package:0\tConsoleKit"
+echo -e -n "package\tavailable\tConsoleKit"
sleep ${time}
echo -e "\tSystem console checker"
echo -e "percentage\t50" > /dev/stderr
@@ -32,7 +32,7 @@ sleep ${time}
echo -e "percentage\t80" > /dev/stderr
sleep ${time}
echo -e "percentage\t90" > /dev/stderr
-echo -e "package:0\tgnome-power-manager\tMore useless software"
+echo -e "package\tinstalled\tgnome-power-manager;0.0.1;i386;data\tMore useless software"
sleep ${time}
echo -e "percentage\t100" > /dev/stderr
commit 35758f7cd21aa4f2f87c1d3487cd038b509bc60d
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Feb 17 19:09:32 2008 +0000
add the supported filter
diff --git a/docs/spec/pk-introduction.xml b/docs/spec/pk-introduction.xml
index 866d510..c8869ca 100644
--- a/docs/spec/pk-introduction.xml
+++ b/docs/spec/pk-introduction.xml
@@ -186,7 +186,6 @@
</row>
<row>
<entry><literal>free</literal> or <literal>~free</literal></entry>
-
<entry>
Free software. The package contains only software and
other content that is available under a free license.
@@ -204,6 +203,12 @@
in an application chooser.
</entry>
</row>
+ <row>
+ <entry><literal>supported</literal> or <literal>~supported</literal></entry>
+ <entry>
+ If the package is supported or is a third party addon.
+ </entry>
+ </row>
</tbody>
</tgroup>
</informaltable>
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 585f1aa..e89479f 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -149,11 +149,13 @@ static PkEnumMatch enum_filter[] = {
{PK_FILTER_ENUM_GUI, "gui"},
{PK_FILTER_ENUM_FREE, "free"},
{PK_FILTER_ENUM_VISIBLE, "visible"},
+ {PK_FILTER_ENUM_SUPPORTED, "supported"},
{PK_FILTER_ENUM_NOT_DEVELOPMENT, "~devel"},
{PK_FILTER_ENUM_NOT_INSTALLED, "~installed"},
{PK_FILTER_ENUM_NOT_GUI, "~gui"},
{PK_FILTER_ENUM_NOT_FREE, "~free"},
{PK_FILTER_ENUM_NOT_VISIBLE, "~visible"},
+ {PK_FILTER_ENUM_NOT_SUPPORTED, "~supported"},
{0, NULL},
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 9839d33..b9c7f9d 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -125,11 +125,13 @@ typedef enum {
PK_FILTER_ENUM_GUI,
PK_FILTER_ENUM_FREE,
PK_FILTER_ENUM_VISIBLE,
+ PK_FILTER_ENUM_SUPPORTED,
PK_FILTER_ENUM_NOT_DEVELOPMENT,
PK_FILTER_ENUM_NOT_INSTALLED,
PK_FILTER_ENUM_NOT_GUI,
PK_FILTER_ENUM_NOT_FREE,
PK_FILTER_ENUM_NOT_VISIBLE,
+ PK_FILTER_ENUM_NOT_SUPPORTED,
PK_FILTER_ENUM_NONE,
PK_FILTER_ENUM_UNKNOWN
} PkFilterEnum;
diff --git a/tools/add-error-enum.sh b/tools/add-error-enum.sh
index a5c0ade..a643237 100755
--- a/tools/add-error-enum.sh
+++ b/tools/add-error-enum.sh
@@ -1,4 +1,4 @@
#!/bin/sh
-$EDITOR docs/pk-introduction.xml libpackagekit/pk-enum.h libpackagekit/pk-enum.c ../gnome-packagekit/src/pk-common-gui.c python/packagekit/backend.py
+$EDITOR docs/spec/pk-introduction.xml libpackagekit/pk-enum.h libpackagekit/pk-enum.c ../gnome-packagekit/src/pk-common-gui.c python/packagekit/backend.py
More information about the PackageKit
mailing list