[PackageKit-commit] packagekit: Branch 'master' - 12 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Jul 2 00:53:58 PDT 2008
backends/apt.deprecated/pk-backend-apt.c | 4 -
backends/apt/pk-backend-apt.c | 4 -
backends/conary/pk-backend-conary.c | 4 -
backends/pisi/pk-backend-pisi.c | 4 -
backends/razor/pk-backend-razor.c | 40 ++++++++++++----
backends/smart/pk-backend-smart.c | 4 -
backends/test/pk-backend-test-dbus.c | 4 -
backends/test/pk-backend-test-spawn.c | 4 -
backends/test/pk-backend-test-thread.c | 4 -
backends/urpmi/pk-backend-urpmi.c | 4 -
backends/yum/pk-backend-yum.c | 4 -
backends/yum2/pk-backend-yum2.c | 4 -
contrib/pk-completion.bash | 1
libpackagekit/pk-catalog.c | 2
libpackagekit/pk-client.c | 73 ++++++++++++++++++++++++++++++-
libpackagekit/pk-client.h | 5 ++
libpackagekit/pk-common.c | 12 +----
libpackagekit/pk-control.c | 8 +--
libpackagekit/pk-details-obj.c | 2
libpackagekit/pk-extra.c | 3 -
libpackagekit/pk-package-id.c | 34 ++++++++++++++
libpackagekit/pk-package-ids.c | 16 +-----
libpackagekit/pk-package-list.c | 4 -
libpackagekit/pk-task-list.c | 13 ++---
libpackagekit/pk-update-detail-list.c | 2
python/packagekit/daemonBackend.py | 19 +++++++-
src/pk-backend-dbus.c | 32 +++++++++++++
src/pk-backend-dbus.h | 3 +
src/pk-backend.c | 4 -
src/pk-engine.c | 2
src/pk-inhibit.c | 2
src/pk-network-nm.c | 2
src/pk-spawn.c | 1
src/pk-transaction-db.c | 8 ---
src/pk-transaction.c | 28 -----------
35 files changed, 236 insertions(+), 124 deletions(-)
New commits:
commit a5226d3360b577ad413b107d82527b1aabd1a93e
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 1 15:11:09 2008 +0100
razor: convert to latest upstream API
diff --git a/backends/razor/pk-backend-razor.c b/backends/razor/pk-backend-razor.c
index cbc236e..5d9c780 100644
--- a/backends/razor/pk-backend-razor.c
+++ b/backends/razor/pk-backend-razor.c
@@ -117,10 +117,14 @@ backend_resolve_thread (PkBackend *backend)
length = g_strv_length (package_ids);
pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package, &name, &version, &arch)) {
+ while (razor_package_iterator_next (pi, &package,
+ RAZOR_DETAIL_NAME, &name,
+ RAZOR_DETAIL_VERSION, &version,
+ RAZOR_DETAIL_ARCH, &arch,
+ RAZOR_DETAIL_SUMMARY, &summary,
+ RAZOR_DETAIL_LAST)) {
for (i=0; i<length; i++) {
if (pk_strequal (name, package_ids[i])) {
- razor_package_get_details (set, package, &summary, NULL, NULL, NULL);
pk_razor_emit_package (backend, name, version, arch, summary);
}
}
@@ -161,13 +165,22 @@ backend_get_details_thread (PkBackend *backend)
length = g_strv_length (package_ids);
pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package, &name, &version, &arch)) {
+ while (razor_package_iterator_next (pi, &package,
+ RAZOR_DETAIL_NAME, &name,
+ RAZOR_DETAIL_VERSION, &version,
+ RAZOR_DETAIL_ARCH, &arch,
+ RAZOR_DETAIL_LAST)) {
for (i=0; i<length; i++) {
/* TODO: we should cache this */
ident = pk_package_id_new_from_string (package_ids[i]);
if (pk_strequal (name, ident->name)) {
package_id = pk_package_id_build (name, version, arch, "installed");
- razor_package_get_details (set, package, &summary, &description, &url, &license);
+ razor_package_get_details (set, package,
+ RAZOR_DETAIL_SUMMARY, &summary,
+ RAZOR_DETAIL_DESCRIPTION, &description,
+ RAZOR_DETAIL_URL, &url,
+ RAZOR_DETAIL_LICENSE, &license,
+ RAZOR_DETAIL_LAST);
pk_backend_details (backend, package_ids[i], license, PK_GROUP_ENUM_UNKNOWN, description, url, 0);
g_free (package_id);
}
@@ -219,8 +232,12 @@ backend_get_packages_thread (PkBackend *backend)
const gchar *name, *version, *arch, *summary;
pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package, &name, &version, &arch)) {
- razor_package_get_details (set, package, &summary, NULL, NULL, NULL);
+ while (razor_package_iterator_next (pi, &package,
+ RAZOR_DETAIL_NAME, &name,
+ RAZOR_DETAIL_VERSION, &version,
+ RAZOR_DETAIL_ARCH, &arch,
+ RAZOR_DETAIL_SUMMARY, &summary,
+ RAZOR_DETAIL_LAST)) {
pk_razor_emit_package (backend, name, version, arch, summary);
}
@@ -286,10 +303,13 @@ backend_search_thread (PkBackend *backend)
search = pk_backend_get_string (backend, "search");
pi = razor_package_iterator_create (set);
- while (razor_package_iterator_next (pi, &package, &name, &version, &arch)) {
-
- /* we need the summary just for ::Package */
- razor_package_get_details (set, package, &summary, &description, NULL, NULL);
+ while (razor_package_iterator_next (pi, &package,
+ RAZOR_DETAIL_NAME, &name,
+ RAZOR_DETAIL_VERSION, &version,
+ RAZOR_DETAIL_ARCH, &arch,
+ RAZOR_DETAIL_SUMMARY, &summary,
+ RAZOR_DETAIL_DESCRIPTION, &description,
+ RAZOR_DETAIL_LAST)) {
/* find in the name */
found = pk_str_case_contains (name, search);
commit ed313d871717e01b7997e3c00db2770a34a4561b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 15:13:36 2008 +0100
trivial: allow NULL version, arch and data fields in pk_package_id_new_from_list()
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index 5b9111d..c5392ef 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -141,9 +141,6 @@ pk_package_id_new_from_list (const gchar *name, const gchar *version, const gcha
PkPackageId *id = NULL;
g_return_val_if_fail (name != NULL, NULL);
- g_return_val_if_fail (version != NULL, NULL);
- g_return_val_if_fail (arch != NULL, NULL);
- g_return_val_if_fail (data != NULL, NULL);
/* create new object */
id = pk_package_id_new ();
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index f207355..5f8affb 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1817,7 +1817,7 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
pk_restart_enum_to_text (detail->restart), detail->update_text);
g_free (package_id);
} else {
- pk_warning ("not got %s", package_ids[i]);
+ pk_debug ("not got %s", package_ids[i]);
g_ptr_array_add (array, g_strdup (package_ids[i]));
}
}
commit 82ef266199b2b1f6aa32886e7d11a9c825dca846
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:59:41 2008 +0100
trivial: remove the FILTER prefix from the backends, it was from 0.1.0 timeframe...
diff --git a/backends/apt.deprecated/pk-backend-apt.c b/backends/apt.deprecated/pk-backend-apt.c
index a8a9389..e7849e6 100644
--- a/backends/apt.deprecated/pk-backend-apt.c
+++ b/backends/apt.deprecated/pk-backend-apt.c
@@ -38,7 +38,7 @@ PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "apt");
backend_init_search (backend);
@@ -51,7 +51,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
backend_finish_search (backend);
g_object_unref (spawn);
}
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 759e636..cb53e0f 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -34,7 +34,7 @@ static PkBackendDbus *dbus;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_APT);
}
@@ -46,7 +46,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
pk_backend_dbus_kill (dbus);
g_object_unref (dbus);
}
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 54c6405..b130813 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -34,7 +34,7 @@ static PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "conary");
}
@@ -46,7 +46,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index dc4f7fc..74d2c31 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -33,7 +33,7 @@ static PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "pisi");
}
@@ -45,7 +45,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 73f83a0..c67612f 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -34,7 +34,7 @@ static PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "smart");
}
@@ -46,7 +46,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/test/pk-backend-test-dbus.c b/backends/test/pk-backend-test-dbus.c
index 28e2969..208fc80 100644
--- a/backends/test/pk-backend-test-dbus.c
+++ b/backends/test/pk-backend-test-dbus.c
@@ -56,7 +56,7 @@ backend_cancel (PkBackend *backend)
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_TEST);
}
@@ -68,7 +68,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
pk_backend_dbus_kill (dbus);
g_object_unref (dbus);
}
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index fd4cc0b..fdb4772 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -48,7 +48,7 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "test");
}
@@ -60,7 +60,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index 9442313..257c9ed 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -33,7 +33,7 @@ static gboolean is_cancelled = FALSE;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
}
/**
@@ -43,7 +43,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
}
/**
diff --git a/backends/urpmi/pk-backend-urpmi.c b/backends/urpmi/pk-backend-urpmi.c
index 8698555..4261fa4 100644
--- a/backends/urpmi/pk-backend-urpmi.c
+++ b/backends/urpmi/pk-backend-urpmi.c
@@ -32,7 +32,7 @@ static PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "urpmi");
}
@@ -44,7 +44,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 1acdbad..0b16cb2 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -32,7 +32,7 @@ static PkBackendSpawn *spawn;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "yum");
}
@@ -44,7 +44,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
g_object_unref (spawn);
}
diff --git a/backends/yum2/pk-backend-yum2.c b/backends/yum2/pk-backend-yum2.c
index 82af287..f7cd39c 100644
--- a/backends/yum2/pk-backend-yum2.c
+++ b/backends/yum2/pk-backend-yum2.c
@@ -33,7 +33,7 @@ static PkBackendDbus *dbus;
static void
backend_initialize (PkBackend *backend)
{
- pk_debug ("FILTER: initialize");
+ pk_debug ("backend: initialize");
dbus = pk_backend_dbus_new ();
pk_backend_dbus_set_name (dbus, PK_DBUS_BACKEND_SERVICE_YUM);
}
@@ -45,7 +45,7 @@ backend_initialize (PkBackend *backend)
static void
backend_destroy (PkBackend *backend)
{
- pk_debug ("FILTER: destroy");
+ pk_debug ("backend: destroy");
pk_backend_dbus_kill (dbus);
g_object_unref (dbus);
}
commit e94067f63d142e8ede45b417699e9f737592e862
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:56:07 2008 +0100
trivial: remove some debugging text that is no longer needed
diff --git a/libpackagekit/pk-catalog.c b/libpackagekit/pk-catalog.c
index 598b3d0..2062960 100644
--- a/libpackagekit/pk-catalog.c
+++ b/libpackagekit/pk-catalog.c
@@ -82,7 +82,6 @@ pk_catalog_process_type_part (PkCatalog *catalog, GPtrArray *array, const gchar
} else {
key = g_strdup_printf ("%s(%s)", catalog->priv->type, distro_id_part);
}
- pk_debug ("key=%s", key);
list = g_key_file_get_string_list (catalog->priv->file, PK_CATALOG_FILE_HEADER, key, NULL, NULL);
g_free (key);
@@ -94,7 +93,6 @@ pk_catalog_process_type_part (PkCatalog *catalog, GPtrArray *array, const gchar
/* add to array */
len = g_strv_length (list);
for (i=0; i<len; i++) {
- pk_debug ("add to array %i=%s", i, list[i]);
g_ptr_array_add (array, g_strdup (list[i]));
}
g_strfreev (list);
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 492cec0..ddc0562 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -313,14 +313,14 @@ pk_client_error_auth_obtain (GError *error)
/* get PolKitAction */
ret = polkit_dbus_error_parse_from_strings ("org.freedesktop.PolicyKit.Error.NotAuthorized", error->message, &action, &result);
if (!ret) {
- pk_debug ("Not a polkit auth failure: %s", error->message);
+ pk_warning ("Not a polkit auth failure: %s", error->message);
return FALSE;
}
/* get action_id from PolKitAction */
ret = polkit_action_get_action_id (action, &action_id);
if (!ret) {
- pk_debug ("Unable to get an action ID");
+ pk_warning ("Unable to get an action ID");
return FALSE;
}
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 4099d51..e502477 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -151,7 +151,6 @@ pk_iso8601_present (void)
/* get current time */
g_get_current_time (&timeval);
timespec = g_time_val_to_iso8601 (&timeval);
- pk_debug ("timespec=%s", timespec);
return timespec;
}
@@ -182,7 +181,6 @@ pk_iso8601_difference (const gchar *isodate)
/* work out difference */
time = timeval_now.tv_sec - timeval_then.tv_sec;
- pk_debug ("difference=%i", time);
return time;
}
@@ -274,7 +272,7 @@ pk_strnumber (const gchar *text)
/* max length is 10 */
length = pk_strlen (text, 10);
if (length == 10) {
- pk_debug ("input too long!");
+ pk_warning ("input too long: %s", text);
return FALSE;
}
@@ -282,7 +280,7 @@ pk_strnumber (const gchar *text)
if (i == 0 && text[i] == '-') {
/* negative sign */
} else if (g_ascii_isdigit (text[i]) == FALSE) {
- pk_debug ("not a number '%c' in text!", text[i]);
+ pk_warning ("not a number '%c' in text!", text[i]);
return FALSE;
}
}
@@ -404,13 +402,13 @@ pk_strvalidate (const gchar *text)
/* maximum size is 1024 */
length = pk_strlen (text, 1024);
if (length > 1024) {
- pk_debug ("input too long!");
+ pk_warning ("input too long: %u", length);
return FALSE;
}
for (i=0; i<length; i++) {
if (pk_strvalidate_char (text[i]) == FALSE) {
- pk_debug ("invalid char '%c' in text!", text[i]);
+ pk_warning ("invalid char '%c' in text!", text[i]);
return FALSE;
}
}
@@ -512,7 +510,6 @@ pk_strcmp_sections (const gchar *id1, const gchar *id2, guint parts, guint compa
return FALSE;
}
if (compare == parts) {
- pk_debug ("optimize to strcmp");
return pk_strequal (id1, id2);
}
@@ -735,7 +732,6 @@ pk_va_list_to_argv (const gchar *string_first, va_list *args)
/* split the string up by spaces */
pk_va_list_to_argv_string (ptr_array, value_temp);
}
- pk_debug ("number of strings=%i", i+1);
/* convert the array to a strv type */
array = pk_ptr_array_to_argv (ptr_array);
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index f5960e2..c243f94 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -539,7 +539,7 @@ pk_control_transaction_list_refresh (PkControl *control)
G_TYPE_STRV, &control->priv->array,
G_TYPE_INVALID);
if (error != NULL) {
- pk_debug ("ERROR: %s", error->message);
+ pk_warning ("ERROR: %s", error->message);
g_error_free (error);
}
if (ret == FALSE) {
@@ -584,7 +584,6 @@ pk_control_transaction_list_changed_cb (DBusGProxy *proxy, gchar **array, PkCont
static void
pk_control_connection_changed_cb (PkConnection *pconnection, gboolean connected, PkControl *control)
{
- pk_debug ("connected=%i", connected);
/* force a refresh so we have valid data*/
if (connected) {
pk_control_transaction_list_refresh (control);
diff --git a/libpackagekit/pk-extra.c b/libpackagekit/pk-extra.c
index ce1ec02..8e29e0c 100644
--- a/libpackagekit/pk-extra.c
+++ b/libpackagekit/pk-extra.c
@@ -119,7 +119,6 @@ pk_extra_populate_package_cache_callback (void *data, gint argc, gchar **argv, g
/* check we are not already added */
obj = g_hash_table_lookup (extra->priv->hash_package, package);
if (obj != NULL) {
- pk_debug ("not adding duplicate %s, %s", package, icon_name);
g_free (exec);
g_free (package);
g_free (icon_name);
@@ -170,7 +169,6 @@ pk_extra_populate_locale_cache_callback (void *data, gint argc, gchar **argv, gc
/* check we are not already added */
obj = g_hash_table_lookup (extra->priv->hash_locale, package);
if (obj != NULL) {
- pk_debug ("not adding duplicate %s, %s", package, summary);
g_free (package);
g_free (summary);
goto out;
@@ -437,7 +435,6 @@ pk_extra_set_data_locale (PkExtra *extra, const gchar *package, const gchar *sum
}
/* add to cache */
- pk_debug ("adding summary:%s", package);
obj = g_new (PkExtraLocaleObj, 1);
obj->summary = g_strdup (summary);
g_hash_table_insert (extra->priv->hash_locale, g_strdup (package), (gpointer) obj);
diff --git a/libpackagekit/pk-package-ids.c b/libpackagekit/pk-package-ids.c
index 4ede766..108c151 100644
--- a/libpackagekit/pk-package-ids.c
+++ b/libpackagekit/pk-package-ids.c
@@ -130,11 +130,8 @@ pk_package_ids_print (gchar **package_ids)
g_return_val_if_fail (package_ids != NULL, FALSE);
- /* get size once */
- size = g_strv_length (package_ids);
- pk_debug ("size = %i", size);
-
/* print all */
+ size = g_strv_length (package_ids);
for (i=0; i<size; i++) {
pk_debug ("package_id[%i] = %s", i, package_ids[i]);
}
@@ -197,7 +194,6 @@ pk_package_ids_to_text (gchar **package_ids, const gchar *delimiter)
}
string_ret = g_string_free (string, FALSE);
- pk_debug ("package_ids = %s", string_ret);
return string_ret;
}
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index 82baae5..b25c7f7 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -297,7 +297,7 @@ pk_package_list_get_obj (PkPackageList *plist, guint item)
{
g_return_val_if_fail (PK_IS_PACKAGE_LIST (plist), NULL);
if (item >= plist->priv->array->len) {
- pk_debug ("item too large!");
+ pk_warning ("item too large!");
return NULL;
}
return g_ptr_array_index (plist->priv->array, item);
diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 14d1371..e22b226 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -161,14 +161,13 @@ pk_task_list_status_changed_cb (PkClient *client, PkStatusEnum status, PkTaskLis
g_return_if_fail (PK_IS_TASK_LIST (tlist));
tid = pk_client_get_tid (client);
- pk_debug ("tid %s is now %s", tid, pk_status_enum_to_text (status));
/* get correct item */
item = pk_task_list_find_existing_tid (tlist, tid);
item->status = status;
g_free (tid);
- pk_debug ("emit status-changed");
+ pk_debug ("emit status-changed(%s) for %s", pk_status_enum_to_text (status), tid);
g_signal_emit (tlist, signals [PK_TASK_LIST_STATUS_CHANGED], 0);
}
@@ -273,7 +272,6 @@ pk_task_list_refresh (PkTaskList *tlist)
for (i=0; i<tlist->priv->task_list->len; i++) {
item = g_ptr_array_index (tlist->priv->task_list, i);
if (!item->valid) {
- pk_debug ("remove %s", item->tid);
g_object_unref (item->monitor);
g_ptr_array_remove (tlist->priv->task_list, item);
g_free (item->tid);
@@ -303,7 +301,7 @@ pk_task_list_get_item (PkTaskList *tlist, guint item)
{
g_return_val_if_fail (PK_IS_TASK_LIST (tlist), NULL);
if (item >= tlist->priv->task_list->len) {
- pk_debug ("item too large!");
+ pk_warning ("item too large!");
return NULL;
}
return g_ptr_array_index (tlist->priv->task_list, item);
@@ -466,7 +464,6 @@ pk_task_list_finalize (GObject *object)
/* remove all watches */
for (i=0; i<tlist->priv->task_list->len; i++) {
item = g_ptr_array_index (tlist->priv->task_list, i);
- pk_debug ("remove %s", item->tid);
g_object_unref (item->monitor);
g_free (item->package_id);
g_ptr_array_remove (tlist->priv->task_list, item);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index d77c72e..3a57589 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1449,7 +1449,6 @@ pk_backend_finished_delay (gpointer data)
pk_backend_set_exit_code (backend, PK_EXIT_ENUM_SUCCESS);
}
- pk_debug ("resetting hash tables to blank");
g_hash_table_remove_all (backend->priv->hash_pointer);
g_hash_table_remove_all (backend->priv->hash_string);
g_hash_table_remove_all (backend->priv->hash_strv);
@@ -1727,8 +1726,6 @@ pk_backend_finalize (GObject *object)
g_return_if_fail (PK_IS_BACKEND (object));
backend = PK_BACKEND (object);
- pk_debug ("backend finalise");
-
pk_backend_reset (backend);
g_free (backend->priv->proxy_http);
g_free (backend->priv->proxy_ftp);
@@ -1930,7 +1927,6 @@ pk_backend_init (PkBackend *backend)
PkBackend *
pk_backend_new (void)
{
- pk_debug ("new object");
if (pk_backend_object != NULL) {
g_object_ref (pk_backend_object);
} else {
diff --git a/src/pk-engine.c b/src/pk-engine.c
index fc7235c..c85b0b9 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -476,7 +476,6 @@ pk_engine_get_seconds_idle (PkEngine *engine)
}
idle = (guint) g_timer_elapsed (engine->priv->timer, NULL);
- pk_debug ("engine idle=%i", idle);
return idle;
}
@@ -726,7 +725,6 @@ pk_engine_finalize (GObject *object)
engine = PK_ENGINE (object);
g_return_if_fail (engine->priv != NULL);
- pk_debug ("engine finalise");
/* unlock if we locked this */
ret = pk_backend_unlock (engine->priv->backend);
diff --git a/src/pk-inhibit.c b/src/pk-inhibit.c
index 1b93670..b92cb18 100644
--- a/src/pk-inhibit.c
+++ b/src/pk-inhibit.c
@@ -81,7 +81,6 @@ pk_inhibit_lock (PkInhibit *inhibit)
g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
- pk_debug ("Trying to AcquireInterfaceLock");
if (inhibit->priv->proxy == NULL) {
pk_warning ("not connected to HAL");
return FALSE;
@@ -121,7 +120,6 @@ pk_inhibit_unlock (PkInhibit *inhibit)
g_return_val_if_fail (PK_IS_INHIBIT (inhibit), FALSE);
- pk_debug ("Trying to ReleaseInterfaceLock");
if (inhibit->priv->proxy == NULL) {
pk_warning ("not connected to HAL");
return FALSE;
diff --git a/src/pk-network-nm.c b/src/pk-network-nm.c
index ae17b8e..6a39f41 100644
--- a/src/pk-network-nm.c
+++ b/src/pk-network-nm.c
@@ -142,7 +142,6 @@ pk_network_nm_init (PkNetworkNm *network_nm)
libnm_glib_register_callback (network_nm->priv->ctx,
pk_network_nm_nm_changed_cb,
network_nm, context);
- pk_debug ("ctx=%p, id=%i", network_nm->priv->ctx, network_nm->priv->callback_id);
}
/**
@@ -159,7 +158,6 @@ pk_network_nm_finalize (GObject *object)
g_return_if_fail (network_nm->priv != NULL);
- pk_debug ("ctx=%p, id=%i", network_nm->priv->ctx, network_nm->priv->callback_id);
libnm_glib_unregister_callback (network_nm->priv->ctx, network_nm->priv->callback_id);
libnm_glib_shutdown (network_nm->priv->ctx);
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index c794078..3cc9c2f 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -167,7 +167,6 @@ pk_spawn_check_child (PkSpawn *spawn)
spawn->priv->exit = PK_EXIT_ENUM_FAILED;
}
} else {
- pk_debug ("Running fork successful");
if (spawn->priv->exit == PK_EXIT_ENUM_UNKNOWN) {
spawn->priv->exit = PK_EXIT_ENUM_SUCCESS;
}
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 597df38..36a1d0c 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -191,7 +191,6 @@ pk_transaction_db_sql_statement (PkTransactionDb *tdb, const gchar *sql)
g_return_val_if_fail (PK_IS_TRANSACTION_DB (tdb), FALSE);
g_return_val_if_fail (tdb->priv->db != NULL, FALSE);
- pk_debug ("statement=%s", sql);
rc = sqlite3_exec (tdb->priv->db, sql, pk_transaction_sqlite_callback, tdb, &error_msg);
if (rc != SQLITE_OK) {
pk_warning ("SQL error: %s\n", error_msg);
commit 3054c0cf2ff8f975bd22f033c6ba09570936c2a6
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:40:06 2008 +0100
trivial: remove some g_print statements in the daemon and library
diff --git a/libpackagekit/pk-control.c b/libpackagekit/pk-control.c
index 7e151ec..f5960e2 100644
--- a/libpackagekit/pk-control.c
+++ b/libpackagekit/pk-control.c
@@ -505,13 +505,12 @@ pk_control_transaction_list_print (PkControl *control)
length = g_strv_length (control->priv->array);
if (length == 0) {
- g_print ("no jobs...\n");
return TRUE;
}
- g_print ("jobs: ");
+ pk_debug ("jobs:");
for (i=0; i<length; i++) {
tid = control->priv->array[i];
- g_print ("%s\n", tid);
+ pk_debug ("%s", tid);
}
return TRUE;
}
diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index 3dc1db0..14d1371 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -93,14 +93,14 @@ pk_task_list_print (PkTaskList *tlist)
g_return_val_if_fail (PK_IS_TASK_LIST (tlist), FALSE);
length = tlist->priv->task_list->len;
- g_print ("Tasks:\n");
+ pk_debug ("Tasks:");
if (length == 0) {
- g_print ("[none]...\n");
+ pk_debug ("[none]...");
return TRUE;
}
for (i=0; i<length; i++) {
item = g_ptr_array_index (tlist->priv->task_list, i);
- g_print ("%s\t%s:%s %s\n", item->tid, pk_role_enum_to_text (item->role),
+ pk_debug ("%s\t%s:%s %s", item->tid, pk_role_enum_to_text (item->role),
pk_status_enum_to_text (item->status), item->package_id);
}
return TRUE;
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index d42bc7a..597df38 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -170,13 +170,6 @@ pk_transaction_sqlite_callback (void *data, gint argc, gchar **argv, gchar **col
}
}
- g_print ("tid : %s\n", item.tid);
- g_print (" timespec : %s\n", item.timespec);
- g_print (" succeeded : %i\n", item.succeeded);
- g_print (" role : %s\n", pk_role_enum_to_text (item.role));
- g_print (" duration : %i (seconds)\n", item.duration);
- g_print (" data : %s\n", item.data);
-
/* emit signal */
g_signal_emit (tdb, signals [PK_TRANSACTION_DB_TRANSACTION], 0,
item.tid, item.timespec, item.succeeded, item.role,
commit 0ed8644f4d179f877cc7ab86cbd00c5fe0c0fbe7
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:39:40 2008 +0100
trivial: only pk_transaction_list_remove() in one place if the commit failed
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 3c47ba0..f207355 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -945,6 +945,7 @@ pk_transaction_commit (PkTransaction *transaction)
/* commit, so it appears in the JobList */
ret = pk_transaction_list_commit (transaction->priv->transaction_list, transaction);
if (!ret) {
+ pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
pk_warning ("failed to commit (job not run?)");
return FALSE;
}
@@ -1350,7 +1351,6 @@ pk_transaction_get_depends (PkTransaction *transaction, const gchar *filter, gch
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1408,7 +1408,6 @@ pk_transaction_get_details (PkTransaction *transaction, gchar **package_ids, DBu
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1466,7 +1465,6 @@ pk_transaction_get_files (PkTransaction *transaction, gchar **package_ids, DBusG
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1517,7 +1515,6 @@ pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DB
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1634,7 +1631,6 @@ pk_transaction_get_repo_list (PkTransaction *transaction, const gchar *filter, D
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1702,7 +1698,6 @@ pk_transaction_get_requires (PkTransaction *transaction, const gchar *filter, gc
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1814,7 +1809,6 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
detail = pk_update_detail_list_get_obj (transaction->priv->update_detail_list, id);
pk_package_id_free (id);
if (detail != NULL) {
- pk_warning ("got %s", package_ids[i]);
package_id = pk_package_id_to_string (detail->id);
/* emulate the backend */
g_signal_emit (transaction, signals [PK_TRANSACTION_UPDATE_DETAIL], 0,
@@ -1850,7 +1844,6 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -1936,7 +1929,6 @@ pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBu
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2009,7 +2001,6 @@ pk_transaction_install_files (PkTransaction *transaction, gboolean trusted,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2078,7 +2069,6 @@ pk_transaction_install_packages (PkTransaction *transaction, gchar **package_ids
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2153,7 +2143,6 @@ pk_transaction_install_signature (PkTransaction *transaction, const gchar *sig_t
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2225,7 +2214,6 @@ pk_transaction_refresh_cache (PkTransaction *transaction, gboolean force, DBusGM
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2296,7 +2284,6 @@ pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2362,7 +2349,6 @@ pk_transaction_repo_enable (PkTransaction *transaction, const gchar *repo_id, gb
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2429,7 +2415,6 @@ pk_transaction_repo_set_data (PkTransaction *transaction, const gchar *repo_id,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2499,7 +2484,6 @@ pk_transaction_resolve (PkTransaction *transaction, const gchar *filter,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2563,7 +2547,6 @@ pk_transaction_rollback (PkTransaction *transaction, const gchar *transaction_id
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2623,7 +2606,6 @@ pk_transaction_search_details (PkTransaction *transaction, const gchar *filter,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2683,7 +2665,6 @@ pk_transaction_search_file (PkTransaction *transaction, const gchar *filter,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2743,7 +2724,6 @@ pk_transaction_search_group (PkTransaction *transaction, const gchar *filter,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2803,7 +2783,6 @@ pk_transaction_search_name (PkTransaction *transaction, const gchar *filter,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2893,7 +2872,6 @@ pk_transaction_update_packages (PkTransaction *transaction, gchar **package_ids,
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -2953,7 +2931,6 @@ pk_transaction_update_system (PkTransaction *transaction, DBusGMethodInvocation
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
@@ -3016,7 +2993,6 @@ pk_transaction_what_provides (PkTransaction *transaction, const gchar *filter, c
if (!ret) {
error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
"Could not commit to a transaction object");
- pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
dbus_g_method_return_error (context, error);
return;
}
commit 261aa88213dab59c890b46b41626b4d3d5b6da07
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:14:42 2008 +0100
trivial: remove a couple of debugging statements
diff --git a/libpackagekit/pk-package-ids.c b/libpackagekit/pk-package-ids.c
index 1f09ff2..4ede766 100644
--- a/libpackagekit/pk-package-ids.c
+++ b/libpackagekit/pk-package-ids.c
@@ -102,11 +102,8 @@ pk_package_ids_check (gchar **package_ids)
g_return_val_if_fail (package_ids != NULL, FALSE);
- /* get size once */
- size = g_strv_length (package_ids);
- pk_debug ("size = %i", size);
-
/* check all */
+ size = g_strv_length (package_ids);
for (i=0; i<size; i++) {
package_id = package_ids[i];
ret = pk_package_id_check (package_id);
@@ -184,11 +181,8 @@ pk_package_ids_to_text (gchar **package_ids, const gchar *delimiter)
string = g_string_new ("");
- /* get size once */
- size = g_strv_length (package_ids);
- pk_debug ("size = %i", size);
-
/* print all */
+ size = g_strv_length (package_ids);
for (i=0; i<size; i++) {
g_string_append (string, package_ids[i]);
g_string_append (string, delimiter);
commit 383d60b56a8385a9611320aec124a53f2fd2ee0f
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 14:14:30 2008 +0100
bugfix: copy the string when we do pk_package_list_to_argv() else we get memory corruption.
This stops the auto-update-detail cache from working in gpk-update-viewer
diff --git a/libpackagekit/pk-package-list.c b/libpackagekit/pk-package-list.c
index 00d3cb0..82baae5 100644
--- a/libpackagekit/pk-package-list.c
+++ b/libpackagekit/pk-package-list.c
@@ -184,7 +184,7 @@ pk_package_list_to_argv (PkPackageList *plist)
for (i=0; i<length; i++) {
obj = g_ptr_array_index (plist->priv->array, i);
package_id = pk_package_id_to_string (obj->id);
- g_ptr_array_add (array, package_id);
+ g_ptr_array_add (array, g_strdup (package_id));
g_free (package_id);
}
commit 4244ac523b9a2fbd778b9f80fd85870d95b4e453
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 13:28:47 2008 +0100
fix up changes in the last commit
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index aa5b2ef..492cec0 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -3759,8 +3759,8 @@ pk_client_finalize (GObject *object)
g_free (client->priv->cached_transaction_id);
g_free (client->priv->cached_full_path);
g_free (client->priv->cached_search);
+ g_free (client->priv->cached_directory);
g_free (client->priv->tid);
- g_free (client->priv->directory);
g_strfreev (client->priv->cached_package_ids);
g_strfreev (client->priv->cached_full_paths);
diff --git a/libpackagekit/pk-details-obj.c b/libpackagekit/pk-details-obj.c
index e5e5c93..8813adf 100644
--- a/libpackagekit/pk-details-obj.c
+++ b/libpackagekit/pk-details-obj.c
@@ -99,7 +99,7 @@ pk_details_obj_copy (const PkDetailsObj *obj)
/**
* pk_details_obj_free:
- * @detail: the #PkDetailsObj object
+ * @obj: the #PkDetailsObj object
*
* Return value: %TRUE if the #PkDetailsObj object was freed.
**/
diff --git a/libpackagekit/pk-update-detail-list.c b/libpackagekit/pk-update-detail-list.c
index 2767c32..99de8bf 100644
--- a/libpackagekit/pk-update-detail-list.c
+++ b/libpackagekit/pk-update-detail-list.c
@@ -90,7 +90,7 @@ pk_update_detail_list_add_obj (PkUpdateDetailList *list, const PkUpdateDetailObj
/**
* pk_update_detail_list_get_obj:
* @list: a valid #PkUpdateDetailList instance
- * @package_id: A %package_id such as "gnome-power-manager;0.0.1;i386;fedora"
+ * @id: A #PkPackageId of the item to match
*
* Gets an object from the list
**/
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 0bb1bb3..9256faa 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -1066,11 +1066,11 @@ pk_backend_dbus_download_packages (PkBackendDbus *backend_dbus, gchar **package_
g_return_val_if_fail (PK_IS_BACKEND_DBUS (backend_dbus), FALSE);
g_return_val_if_fail (backend_dbus->priv->proxy != NULL, FALSE);
- g_return_val_if_fail (package_ids != NULL, FALSE)
+ g_return_val_if_fail (package_ids != NULL, FALSE);
/* new sync method call */
pk_backend_dbus_time_reset (backend_dbus);
- ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "DownloadPackages", &error
+ ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "DownloadPackages", &error,
G_TYPE_STRV, package_ids,
G_TYPE_STRING, directory,
G_TYPE_INVALID, G_TYPE_INVALID);
commit 02bcc9a62b43167631355708e1bfa15698e35aa6
Merge: c28f334... c7302c7...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 13:14:36 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit c7302c70b1b9a321039b2857bf0b77a0b04e0a75
Author: Shishir Goel <crazyontheedge at gmail.com>
Date: Mon Jun 30 17:45:15 2008 +0530
Complete the addition of the method DownloadPackages()
diff --git a/contrib/pk-completion.bash b/contrib/pk-completion.bash
index cee522e..4561791 100755
--- a/contrib/pk-completion.bash
+++ b/contrib/pk-completion.bash
@@ -25,6 +25,7 @@ __pkcon_commandlist="
get-filters
get-groups
get-packages
+ download-packages
get-requires
get-time
get-transactions
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 753805f..aa5b2ef 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -96,6 +96,7 @@ struct _PkClientPrivate
gchar *cached_full_path;
gchar **cached_full_paths;
gchar *cached_search;
+ gchar *cached_directory;
PkProvidesEnum cached_provides;
PkFilterEnum cached_filters;
};
@@ -1494,6 +1495,68 @@ pk_client_get_depends (PkClient *client, PkFilterEnum filters, gchar **package_i
}
/**
+ * pk_client_download_packages:
+ * @client: a valid #PkClient instance
+ * @package_ids: an array of package_id structures such as "gnome-power-manager;0.0.1;i386;fedora"
+ * @directory: the location where packages are to be downloaded
+ * @error: a %GError to put the error code and message in, or %NULL
+ * Get the packages that depend this one, i.e. child->parent.
+ * Return value: %TRUE if the daemon queued the transaction
+ **/
+gboolean
+pk_client_download_packages (PkClient *client, gchar **package_ids, const gchar *directory, GError **error)
+{
+ gboolean ret;
+ gchar *package_ids_temp;
+
+ g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
+ g_return_val_if_fail (package_ids != NULL, FALSE);
+
+ /* check the PackageIDs here to avoid a round trip if invalid */
+ ret = pk_package_ids_check (package_ids);
+ if (!ret) {
+ package_ids_temp = pk_package_ids_to_text (package_ids, ", ");
+ pk_client_error_set (error, PK_CLIENT_ERROR_INVALID_PACKAGEID,
+ "package_ids '%s' are not valid", package_ids_temp);
+ g_free (package_ids_temp);
+ return FALSE;
+ }
+
+ /* get and set a new ID */
+ ret = pk_client_allocate_transaction_id (client, error);
+ if (!ret) {
+ return FALSE;
+ }
+
+ /* save this so we can re-issue it */
+ client->priv->role = PK_ROLE_ENUM_DOWNLOAD_PACKAGES;
+ client->priv->cached_package_ids = g_strdupv (package_ids);
+ client->priv->cached_directory = g_strdup (directory);
+
+ /* check to see if we have a valid proxy */
+ if (client->priv->proxy == NULL) {
+ pk_client_error_set (error, PK_CLIENT_ERROR_NO_TID, "No proxy for transaction");
+ return FALSE;
+ }
+ ret = dbus_g_proxy_call (client->priv->proxy, "DownloadPackages", error,
+ G_TYPE_STRV, package_ids,
+ G_TYPE_STRING, directory,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (ret && !client->priv->is_finished) {
+ /* allow clients to respond in the status changed callback */
+ pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
+
+ /* spin until finished */
+ if (client->priv->synchronous) {
+ g_main_loop_run (client->priv->loop);
+ }
+ }
+ pk_client_error_fixup (error);
+ return ret;
+}
+
+
+/**
* pk_client_get_packages:
* @client: a valid #PkClient instance
* @filters: a %PkFilterEnum such as %PK_FILTER_ENUM_GUI | %PK_FILTER_ENUM_FREE or %PK_FILTER_ENUM_NONE
@@ -3016,6 +3079,8 @@ pk_client_requeue (PkClient *client, GError **error)
ret = pk_client_get_details (client, priv->cached_package_ids, error);
} else if (priv->role == PK_ROLE_ENUM_GET_FILES) {
ret = pk_client_get_files (client, priv->cached_package_ids, error);
+ } else if (priv->role == PK_ROLE_ENUM_DOWNLOAD_PACKAGES) {
+ ret = pk_client_download_packages (client, priv->cached_package_ids, priv->cached_directory, error);
} else if (priv->role == PK_ROLE_ENUM_GET_REQUIRES) {
ret = pk_client_get_requires (client, priv->cached_filters, priv->cached_package_ids, priv->cached_force, error);
} else if (priv->role == PK_ROLE_ENUM_GET_UPDATES) {
@@ -3535,6 +3600,7 @@ pk_client_reset (PkClient *client, GError **error)
g_free (client->priv->cached_transaction_id);
g_free (client->priv->cached_full_path);
g_free (client->priv->cached_search);
+ g_free (client->priv->cached_directory);
g_strfreev (client->priv->cached_package_ids);
g_strfreev (client->priv->cached_full_paths);
@@ -3549,6 +3615,7 @@ pk_client_reset (PkClient *client, GError **error)
client->priv->cached_full_paths = NULL;
client->priv->cached_search = NULL;
client->priv->cached_package_ids = NULL;
+ client->priv->cached_directory = NULL;
client->priv->cached_filters = PK_FILTER_ENUM_UNKNOWN;
client->priv->last_status = PK_STATUS_ENUM_UNKNOWN;
client->priv->role = PK_ROLE_ENUM_UNKNOWN;
@@ -3583,6 +3650,7 @@ pk_client_init (PkClient *client)
client->priv->cached_full_path = NULL;
client->priv->cached_full_paths = NULL;
client->priv->cached_search = NULL;
+ client->priv->cached_directory = NULL;
client->priv->cached_provides = PK_PROVIDES_ENUM_UNKNOWN;
client->priv->cached_filters = PK_FILTER_ENUM_UNKNOWN;
client->priv->proxy = NULL;
@@ -3692,6 +3760,7 @@ pk_client_finalize (GObject *object)
g_free (client->priv->cached_full_path);
g_free (client->priv->cached_search);
g_free (client->priv->tid);
+ g_free (client->priv->directory);
g_strfreev (client->priv->cached_package_ids);
g_strfreev (client->priv->cached_full_paths);
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 4ac50b7..24e680d 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -189,6 +189,11 @@ gboolean pk_client_get_package (PkClient *client,
gboolean pk_client_cancel (PkClient *client,
GError **error)
G_GNUC_WARN_UNUSED_RESULT;
+gboolean pk_download_packages (PkClient *client,
+ gchar **package_ids,
+ const gchar *directory,
+ GError **error)
+ G_GNUC_WARN_UNUSED_RESULT;
gboolean pk_client_get_updates (PkClient *client,
PkFilterEnum filters,
GError **error)
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 5632ae4..b0062e7 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -430,6 +430,23 @@ class PackageKitBaseBackend(dbus.service.Object):
self.Finished(EXIT_FAILED)
@dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
+ in_signature='ss',out_signature='')
+ def DownloadPackages(self,package_ids,directory)
+ '''
+ Implement the (backend)-download-packages functionality
+ '''
+ pklog.info("DownloadPackages(%s%s)" % (packages,directory))
+ self.doDownloadPackages(packages,directory)
+
+ def doDownloadPackages(self,package_ids,directory)
+ '''
+ Should be replaced in the corresponding backend sub class
+ '''
+ self.ErrorCode(ERROR_NOT_SUPPORTED,
+ "This function is not implemented in this backend")
+ self.Finished(EXIT_FAILED)
+
+ @dbus.service.method(PACKAGEKIT_DBUS_INTERFACE,
in_signature='ss',out_signature='')
def SearchDetails(self,filters,key):
'''
@@ -557,7 +574,7 @@ class PackageKitBaseBackend(dbus.service.Object):
pklog.info("RefreshCache(%s)" % force)
self.doRefreshCache( force)
- def doRefreshCash(self):
+ def doRefreshCache(self):
'''
Should be replaced in the corresponding backend sub class
'''
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index cf2222e..0bb1bb3 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -1056,6 +1056,38 @@ pk_backend_dbus_get_packages (PkBackendDbus *backend_dbus, PkFilterEnum filters)
}
/**
+ * pk_backend_dbus_download_packages:
+ **/
+gboolean
+pk_backend_dbus_download_packages (PkBackendDbus *backend_dbus, gchar **package_ids, const gchar *directory)
+{
+ gboolean ret;
+ GError *error = NULL;
+
+ g_return_val_if_fail (PK_IS_BACKEND_DBUS (backend_dbus), FALSE);
+ g_return_val_if_fail (backend_dbus->priv->proxy != NULL, FALSE);
+ g_return_val_if_fail (package_ids != NULL, FALSE)
+
+ /* new sync method call */
+ pk_backend_dbus_time_reset (backend_dbus);
+ ret = dbus_g_proxy_call (backend_dbus->priv->proxy, "DownloadPackages", &error
+ G_TYPE_STRV, package_ids,
+ G_TYPE_STRING, directory,
+ G_TYPE_INVALID, G_TYPE_INVALID);
+ if (error != NULL) {
+ pk_warning ("%s", error->message);
+ pk_backend_error_code (backend_dbus->priv->backend, PK_ERROR_ENUM_INTERNAL_ERROR, error->message);
+ pk_backend_finished (backend_dbus->priv->backend);
+ g_error_free (error);
+ }
+ if (ret) {
+ pk_backend_dbus_time_check (backend_dbus);
+ }
+ return ret;
+}
+
+
+/**
* pk_backend_dbus_get_update_detail:
**/
gboolean
diff --git a/src/pk-backend-dbus.h b/src/pk-backend-dbus.h
index 7820890..c4c13b1 100644
--- a/src/pk-backend-dbus.h
+++ b/src/pk-backend-dbus.h
@@ -85,6 +85,9 @@ gboolean pk_backend_dbus_search_file (PkBackendDbus *backend_dbus,
const gchar *search);
gboolean pk_backend_dbus_get_packages (PkBackendDbus *backend_dbus,
PkFilterEnum filters);
+gboolean pk_backend_dbus_download_packages (PkBackendDbus *backend_dbus,
+ gchar **package_ids,
+ const gchar *directory);
gboolean pk_backend_dbus_get_depends (PkBackendDbus *backend_dbus,
PkFilterEnum filters,
gchar **package_ids,
commit c28f334d89fb0241fcc44725a48b2bad7e03dc75
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jun 30 13:03:17 2008 +0100
add another couple of unit tests
diff --git a/libpackagekit/pk-package-id.c b/libpackagekit/pk-package-id.c
index c7a1d6c..5b9111d 100644
--- a/libpackagekit/pk-package-id.c
+++ b/libpackagekit/pk-package-id.c
@@ -69,6 +69,9 @@ pk_package_id_check (const gchar *package_id)
gchar **sections;
gboolean ret;
+ if (package_id == NULL) {
+ return FALSE;
+ }
ret = g_utf8_validate (package_id, -1, NULL);
if (!ret) {
pk_warning ("invalid UTF8!");
@@ -96,6 +99,8 @@ pk_package_id_new_from_string (const gchar *package_id)
gchar **sections;
PkPackageId *id = NULL;
+ g_return_val_if_fail (package_id != NULL, NULL);
+
sections = pk_strsplit (package_id, 4);
if (sections == NULL) {
return NULL;
@@ -135,6 +140,11 @@ pk_package_id_new_from_list (const gchar *name, const gchar *version, const gcha
{
PkPackageId *id = NULL;
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (version != NULL, NULL);
+ g_return_val_if_fail (arch != NULL, NULL);
+ g_return_val_if_fail (data != NULL, NULL);
+
/* create new object */
id = pk_package_id_new ();
id->name = g_strdup (name);
@@ -185,6 +195,11 @@ gchar *
pk_package_id_build (const gchar *name, const gchar *version,
const gchar *arch, const gchar *data)
{
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (version != NULL, NULL);
+ g_return_val_if_fail (arch != NULL, NULL);
+ g_return_val_if_fail (data != NULL, NULL);
+
return g_strdup_printf ("%s;%s;%s;%s", name, version, arch, data);
}
@@ -255,6 +270,7 @@ libst_package_id (LibSelfTest *test)
gchar *text;
const gchar *temp;
PkPackageId *id;
+ PkPackageId *id2;
if (libst_start (test, "PkPackageId", CLASS_AUTO) == FALSE) {
return;
@@ -264,6 +280,15 @@ libst_package_id (LibSelfTest *test)
**************** id ******************
************************************************************/
+ libst_title (test, "id build");
+ text = pk_package_id_build ("moo", "0.0.1", "i386", "fedora");
+ if (pk_strequal (text, "moo;0.0.1;i386;fedora")) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+ g_free (text);
+
libst_title (test, "pid equal pass (same)");
ret = pk_package_id_equal_strings ("moo;0.0.1;i386;fedora", "moo;0.0.1;i386;fedora");
if (ret) {
@@ -343,8 +368,17 @@ libst_package_id (LibSelfTest *test)
}
/************************************************************/
+ libst_title (test, "test copying");
+ id2 = pk_package_id_copy (id);
+ if (id2 != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
libst_title (test, "test id building with valid data");
- text = pk_package_id_to_string (id);
+ text = pk_package_id_to_string (id2);
if (pk_strequal (text, "moo;0.0.1;i386;fedora")) {
libst_success (test, NULL);
} else {
@@ -352,6 +386,7 @@ libst_package_id (LibSelfTest *test)
}
g_free (text);
pk_package_id_free (id);
+ pk_package_id_free (id2);
/************************************************************/
libst_title (test, "parse short package_id from string");
More information about the PackageKit-commit
mailing list