[packagekit] packagekit: Branch 'master' - 6 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Feb 10 11:20:17 PST 2008
backends/ipkg/.gitignore | 10
backends/ipkg/Makefile.am | 8
backends/ipkg/pk-backend-ipkg.c | 797 ----------------------------
backends/opkg/pk-backend-opkg.c | 12
backends/test/helpers/PackageKitDbusTest.py | 70 ++
client/pk-import-specspo.c | 1
src/pk-backend-dbus.c | 3
7 files changed, 79 insertions(+), 822 deletions(-)
New commits:
commit 7a4dbf3fdc2a53418d2efa58b7940a424f503b68
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Feb 8 10:18:10 2008 +0000
Fix build by adding missing #include
diff --git a/client/pk-import-specspo.c b/client/pk-import-specspo.c
index a5df69d..cf0b55a 100644
--- a/client/pk-import-specspo.c
+++ b/client/pk-import-specspo.c
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <libintl.h>
+#include <locale.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
commit b9879fca55a2dec661aaa09d69c09a143ae685e8
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Feb 8 10:16:51 2008 +0000
ipkg: remove ipkg backend as it has been superseded by opkg
diff --git a/backends/ipkg/.gitignore b/backends/ipkg/.gitignore
deleted file mode 100644
index c851833..0000000
--- a/backends/ipkg/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.la
-*.lo
-*.loT
-*.o
-*~
-
diff --git a/backends/ipkg/Makefile.am b/backends/ipkg/Makefile.am
deleted file mode 100644
index c2f8254..0000000
--- a/backends/ipkg/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-plugindir = @PK_PLUGIN_DIR@
-plugin_LTLIBRARIES = libpk_backend_ipkg.la
-libpk_backend_ipkg_la_SOURCES = pk-backend-ipkg.c
-libpk_backend_ipkg_la_LIBADD = @PK_PLUGIN_LIBS@ $(IPKG_LIBS)
-
-libpk_backend_ipkg_la_LDFLAGS = -module -avoid-version
-libpk_backend_ipkg_la_CFLAGS = @PK_PLUGIN_CFLAGS@ $(IPKG_CFLAGS)
-
diff --git a/backends/ipkg/pk-backend-ipkg.c b/backends/ipkg/pk-backend-ipkg.c
deleted file mode 100644
index 4db94b0..0000000
--- a/backends/ipkg/pk-backend-ipkg.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- * vi: set noexpandtab sts=8 sw=8:
- *
- * Copyright (C) 2007 OpenMoko, Inc
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <gmodule.h>
-#include <glib.h>
-#include <string.h>
-#include <pk-backend.h>
-#include <pk-debug.h>
-
-
-#define IPKG_LIB
-#include <libipkg.h>
-
-static PkBackendThread *thread;
-
-/* this is implemented in libipkg.a */
-int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old);
-
-
-enum filters {
- PKG_INSTALLED = 1,
- PKG_NOT_INSTALLED = 2,
- PKG_DEVEL = 4,
- PKG_NOT_DEVEL = 8,
- PKG_GUI = 16,
- PKG_NOT_GUI = 32
-};
-
-/* global config structures */
-static int ref = 0;
-static ipkg_conf_t global_conf;
-static args_t args;
-
-/* Ipkg message callback function */
-extern ipkg_message_callback ipkg_cb_message;
-static gchar *last_error;
-
-int
-ipkg_debug (ipkg_conf_t *conf, message_level_t level, char *msg)
-{
- if (level != 1)
- return 0;
-
- /* print messages only if in verbose mode */
- if (pk_debug_enabled ())
- printf ("IPKG: %s", msg);
-
- /* free the last error message and store the new one */
- g_free (last_error);
- last_error = g_strdup (msg);
- return 0;
-}
-
-static void
-ipkg_unknown_error (PkBackend *backend, gint error_code, gchar *failed_cmd)
-{
- gchar *msg;
-
- msg = g_strdup_printf ("%s failed with error code %d. Last message was:\n\n%s", failed_cmd, error_code, last_error);
- pk_backend_error_code (backend, PK_ERROR_ENUM_UNKNOWN, msg);
-
- g_free (msg);
-}
-
-/**
- * ipkg_is_gui_pkg:
- *
- * check an ipkg package for known GUI dependancies
- */
-static gboolean
-ipkg_is_gui_pkg (pkg_t *pkg)
-{
- gint i;
-
- for (i = 0; i < pkg->depends_count; i++)
- {
- if (g_strrstr (pkg->depends_str[i], "gtk"))
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * ipkg_is_devel_pkg:
- *
- * check an ipkg package to determine if it is a development package
- */
-static gboolean
-ipkg_is_devel_pkg (pkg_t *pkg)
-{
- if (g_strrstr (pkg->name, "-dev"))
- return TRUE;
-
- if (g_strrstr (pkg->name, "-dbg"))
- return TRUE;
-
- if (g_strrstr (pkg->section, "devel"))
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * ipkg_vec_find_latest:
- *
- * search a pkg_vec for the latest version of a package
- */
-
-static pkg_t*
-ipkg_vec_find_latest_helper (pkg_vec_t *vec, pkg_t *pkg)
-{
- gint i;
- for (i = 0; i < vec->len; i++)
- {
- /* if the version found is newer, return it */
- if (pkg_compare_versions (pkg, vec->pkgs[i]) > 0)
- return vec->pkgs[i];
- }
- /* return NULL if there is no package newer than pkg */
- return NULL;
-}
-
-static pkg_t*
-ipkg_vec_find_latest (pkg_vec_t *vec)
-{
- gint i;
- pkg_t *tmp, *ret;
-
- if (vec->len < 1)
- return NULL;
- if (vec->len == 1)
- return vec->pkgs[0];
-
- ret = tmp = vec->pkgs[0];
-
- for (i = 0; i < vec->len; i++)
- {
- tmp = ipkg_vec_find_latest_helper (vec, ret);
- if (!tmp)
- return ret;
- else
- ret = tmp;
- }
- return NULL;
-}
-
-
-/**
- * parse_filter:
- */
-static int
-parse_filter (const gchar *filter)
-{
- gchar **sections = NULL;
- gint i = 0;
- gint retval = 0;
-
- sections = g_strsplit (filter, ";", 0);
- while (sections[i]) {
- if (strcmp(sections[i], "installed") == 0)
- retval = retval | PKG_INSTALLED;
- if (strcmp(sections[i], "~installed") == 0)
- retval = retval | PKG_NOT_INSTALLED;
- if (strcmp(sections[i], "devel") == 0)
- retval = retval | PKG_DEVEL;
- if (strcmp(sections[i], "~devel") == 0)
- retval = retval | PKG_NOT_DEVEL;
- if (strcmp(sections[i], "gui") == 0)
- retval = retval | PKG_GUI;
- if (strcmp(sections[i], "~gui") == 0)
- retval = retval | PKG_NOT_GUI;
- i++;
- }
- g_strfreev (sections);
-
- return retval;
-}
-
-
-
-/**
- * backend_initalize:
- */
-static void
-backend_initalize (PkBackend *backend)
-{
- int err;
- g_return_if_fail (backend != NULL);
-
- /* we use the thread helper */
- thread = pk_backend_thread_new ();
-
- /* reference count for the global variables */
- if (++ref > 1)
- return;
-
- /* Ipkg requires the PATH env variable to be set to find wget when
- * downloading packages. PackageKit unsets all env variables as a
- * security precaution, so we need to set PATH to something sensible
- * here */
- setenv ("PATH", "/usr/sbin:/usr/bin:/sbin:/bin", 1);
-
- last_error = NULL;
- ipkg_cb_message = ipkg_debug;
-
- memset(&global_conf, 0 ,sizeof(global_conf));
- memset(&args, 0 ,sizeof(args));
-
- args_init (&args);
-
-#ifdef IPKG_OFFLINE_ROOT
- args.offline_root = IPKG_OFFLINE_ROOT;
-#endif
-
- err = ipkg_conf_init (&global_conf, &args);
- if (err) {
- ipkg_unknown_error (backend, err, "Initialization");
- }
-}
-
-/**
- * backend_destroy:
- */
-static void
-backend_destroy (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
-
- if (--ref > 0)
- return;
-
- g_object_unref (thread);
-
- /* this appears to (sometimes) be freed elsewhere, perhaps
- * by the functions in libipkg.c */
- /* ipkg_conf_deinit (&global_conf); */
- args_deinit (&args);
- g_free (last_error);
- last_error = NULL;
-}
-
-
-static gboolean
-backend_get_description_thread (PkBackendThread *thread, gchar *package_id)
-{
- pkg_t *pkg;
- PkPackageId *pi;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
- pi = pk_package_id_new_from_string (package_id);
-
- if (!pi->name || !pi->version)
- {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Package not found");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
-
- pkg = pkg_hash_fetch_by_name_version (&global_conf.pkg_hash, pi->name, pi->version);
-
- pk_backend_description (backend, pi->name,
- "unknown", PK_GROUP_ENUM_OTHER, pkg->description, pkg->url, 0);
-
- g_free (package_id);
- pk_backend_finished (backend);
- return TRUE;
-}
-
-/**
- * backend_get_description:
- */
-static void
-backend_get_description (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_get_description_thread,
- g_strdup (package_id));
-}
-
-static gboolean
-backend_refresh_cache_thread (PkBackendThread *thread, gpointer data)
-{
- int ret;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- ret = ipkg_lists_update (&args);
- if (ret) {
- ipkg_unknown_error (backend, ret, "Refreshing cache");
- }
- pk_backend_finished (backend);
-
- return (ret == 0);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
- pk_backend_no_percentage_updates (backend);
-
-
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_refresh_cache_thread,
- NULL);
-}
-
-/**
- * backend_search_name:
- */
-static gboolean
-backend_search_name_thread (PkBackendThread *thread, gchar *params[2])
-{
- int i;
- pkg_vec_t *available;
- pkg_t *pkg;
- gchar *search;
- gint filter;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- search = params[0];
- filter = GPOINTER_TO_INT (params[1]);
-
- available = pkg_vec_alloc();
- pkg_hash_fetch_available (&global_conf.pkg_hash, available);
- for (i=0; i < available->len; i++) {
- char *uid;
- gint status;
-
- pkg = available->pkgs[i];
- if (!g_strrstr (pkg->name, search))
- continue;
- if ((filter & PKG_DEVEL) && !ipkg_is_devel_pkg (pkg))
- continue;
- if ((filter & PKG_NOT_DEVEL) && ipkg_is_devel_pkg (pkg))
- continue;
- if ((filter & PKG_GUI) && !ipkg_is_gui_pkg (pkg))
- continue;
- if ((filter & PKG_NOT_GUI) && ipkg_is_gui_pkg (pkg))
- continue;
- if ((filter & PKG_INSTALLED) && (pkg->state_status == SS_NOT_INSTALLED))
- continue;
- if ((filter & PKG_NOT_INSTALLED) && (pkg->state_status != SS_NOT_INSTALLED))
- continue;
-
- uid = g_strdup_printf ("%s;%s;%s;",
- pkg->name, pkg->version, pkg->architecture);
-
- if (pkg->state_status == SS_INSTALLED)
- status = PK_INFO_ENUM_INSTALLED;
- else
- status = PK_INFO_ENUM_AVAILABLE;
-
- pk_backend_package (backend, status, uid,pkg->description);
- }
-
- pkg_vec_free(available);
- pk_backend_finished (backend);
-
- g_free (params);
- g_free (search);
- return TRUE;
-}
-
-static void
-backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- gint filter_enum;
- gpointer *params;
-
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_no_percentage_updates (backend);
-
- filter_enum = parse_filter (filter);
-
- /* params is a small array we can pack our thread parameters into */
- params = g_new0 (gpointer, 2);
- params[0] = g_strdup (search);
- params[1] = GINT_TO_POINTER (filter_enum);
-
- pk_backend_thread_create (backend,(PkBackendThreadFunc) backend_search_name_thread, params);
-}
-
-static gboolean
-backend_install_package_thread (PkBackendThread *thread, gchar *package_id)
-{
- PkPackageId *pi;
- gint err;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- pi = pk_package_id_new_from_string (package_id);
-
- err = ipkg_packages_install (&args, pi->name);
- if (err != 0)
- ipkg_unknown_error (backend, err, "Install");
-
- g_free (package_id);
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return (err == 0);
-}
-
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_INSTALL);
- pk_backend_no_percentage_updates (backend);
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_install_package_thread,
- g_strdup (package_id));
-}
-
-static gboolean
-backend_remove_package_thread (PkBackendThread *thread, gchar *package_id)
-{
- PkPackageId *pi;
- gint err;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- pi = pk_package_id_new_from_string (package_id);
-
- err = ipkg_packages_remove (&args, pi->name, 0);
- /* TODO: improve error reporting */
- if (err != 0)
- ipkg_unknown_error (backend, err, "Install");
-
- g_free (package_id);
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return (err == 0);
-}
-
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_REMOVE);
- pk_backend_no_percentage_updates (backend);
- /* TODO: allow_deps is currently ignored */
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_remove_package_thread,
- g_strdup (package_id));
-
-}
-
-/**
- * backend_get_filters:
- */
-static void
-backend_get_filters (PkBackend *backend, PkEnumList *elist)
-{
- g_return_if_fail (backend != NULL);
- pk_enum_list_append_multiple (elist,
- PK_FILTER_ENUM_INSTALLED,
- PK_FILTER_ENUM_DEVELOPMENT,
- PK_FILTER_ENUM_GUI,
- -1);
-}
-
-
-static gboolean
-backend_update_system_thread (PkBackendThread *thread, gpointer data)
-{
- gint err;
- err = ipkg_packages_upgrade (&args);
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- if (err)
- ipkg_unknown_error (backend, err, "Upgrading system");
-
- pk_backend_finished (backend);
- return (err != 0);
-}
-
-static void
-backend_update_system (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
- pk_backend_no_percentage_updates (backend);
-
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_update_system_thread,
- NULL);
-}
-
-/**
- * backend_get_depends:
- */
-
-static gboolean
-backend_get_depends_thread (PkBackendThread *thread, gchar *package_id)
-{
- PkPackageId *pi;
- pkg_t *pkg = NULL;
- gint i;
- GRegex *regex;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- pi = pk_package_id_new_from_string (package_id);
-
- if (!pi->name || !pi->version)
- {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Package not found");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
-
- pkg = pkg_hash_fetch_by_name_version (&global_conf.pkg_hash, pi->name, pi->version);
-
- if (!pkg)
- {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Package not found");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
-
- /* compile a regex expression to parse depends_str package names */
- regex = g_regex_new ("(.+) \\(([>=<]+) (.+)\\)", G_REGEX_OPTIMIZE, 0, NULL);
-
- for (i = 0; i < pkg->depends_count; i++)
- {
- pkg_t *d_pkg = NULL;
- pkg_vec_t *p_vec;
- GMatchInfo *match_info = NULL;
- gchar *uid = NULL, *pkg_name = NULL, *pkg_v = NULL, *pkg_req = NULL;
- gint status;
-
- /* find the package by name and select the package with the
- * latest version number
- */
-
- if (!g_regex_match (regex, pkg->depends_str[i], 0, &match_info))
- {
- /* we couldn't parse the depends string */
-
- /* match_info is always allocated, even if the match
- * failed */
- g_match_info_free (match_info);
- continue;
- }
-
- pkg_name = g_match_info_fetch (match_info, 1);
- pkg_req = g_match_info_fetch (match_info, 2);
- pkg_v = g_match_info_fetch (match_info, 3);
- g_match_info_free (match_info);
-
- p_vec = pkg_vec_fetch_by_name (&global_conf.pkg_hash, pkg_name);
-
- if (!p_vec || p_vec->len < 1 || !p_vec->pkgs[0])
- continue;
-
- d_pkg = ipkg_vec_find_latest (p_vec);
-
- /* TODO: check the version requirements are satisfied */
-
- g_free (pkg_name);
- g_free (pkg_req);
- g_free (pkg_v);
-
- uid = g_strdup_printf ("%s;%s;%s;",
- d_pkg->name, d_pkg->version, d_pkg->architecture);
- if (d_pkg->state_status == SS_INSTALLED)
- status = PK_INFO_ENUM_INSTALLED;
- else
- status = PK_INFO_ENUM_AVAILABLE;
- pk_backend_package (backend, status, uid, d_pkg->description);
- }
-
- g_regex_unref (regex);
- pk_backend_finished (backend);
- g_free (package_id);
-
- return TRUE;
-}
-
-static void
-backend_get_depends (PkBackend *backend, const gchar *package_id, gboolean recursive)
-{
- /* TODO: revursive is ignored */
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
- pk_backend_no_percentage_updates (backend);
-
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_get_depends_thread,
- g_strdup (package_id));
-}
-
-/**
- * backend_update_package:
- */
-static gboolean
-backend_update_package_thread (PkBackendThread *thread, gchar *package_id)
-{
- PkPackageId *pi;
- pkg_t *pkg;
- gint err = 0;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- pi = pk_package_id_new_from_string (package_id);
-
- if (!pi->name || !pi->version)
- {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Package not found");
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return FALSE;
- }
-
- pkg = pkg_hash_fetch_by_name_version (&global_conf.pkg_hash, pi->name, pi->version);
-
- if (!pkg) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND,
- "Packge not found");
- err = -1;
- } else {
- /* TODO: determine if package is already latest? */
- err = ipkg_upgrade_pkg (&global_conf, pkg);
- if (err != 0)
- ipkg_unknown_error (backend, err, "Update package");
- }
-
- g_free (package_id);
- pk_package_id_free (pi);
- pk_backend_finished (backend);
- return (err != 0);
-}
-
-static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
- pk_backend_no_percentage_updates (backend);
-
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_update_package_thread,
- g_strdup (package_id));
-}
-
-/**
- * backend_get_updates:
- */
-
-static gboolean
-backend_get_updates_thread (PkBackendThread *thread, gpointer data)
-{
- pkg_vec_t *installed;
- gint i;
- PkBackend *backend;
-
- /* get current backend */
- backend = pk_backend_thread_get_backend (thread);
-
- installed = pkg_vec_alloc();
-
- pkg_hash_fetch_all_installed (&global_conf.pkg_hash, installed);
-
- for (i=0; i < installed->len; i++) {
-
- gchar *uid;
- pkg_t *pkg, *best_pkg;
- gint status;
-
- pkg = installed->pkgs[i];
- best_pkg = pkg_hash_fetch_best_installation_candidate_by_name (&global_conf, pkg->name);
-
- /* couldn't find an install candidate?! */
- if (!best_pkg)
- continue;
-
- /* check to see if the best candidate is actually newer */
- if (pkg_compare_versions (best_pkg, pkg) <= 0)
- continue;
-
- uid = g_strdup_printf ("%s;%s;%s;",
- pkg->name, pkg->version, pkg->architecture);
-
- if (pkg->state_status == SS_INSTALLED)
- status = PK_INFO_ENUM_INSTALLED;
- else
- status = PK_INFO_ENUM_AVAILABLE;
-
- pk_backend_package (backend, status, uid, pkg->description);
- }
- pk_backend_finished (backend);
- return TRUE;
-}
-
-static void
-backend_get_updates (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
-
- pk_backend_set_status (backend, PK_STATUS_ENUM_UPDATE);
- pk_backend_no_percentage_updates (backend);
-
- pk_backend_thread_create (backend,
- (PkBackendThreadFunc) backend_get_updates_thread,
- NULL);
-}
-
-
-PK_BACKEND_OPTIONS (
- "ipkg", /* description */
- "Thomas Wood <thomas at openedhand.com>", /* author */
- backend_initalize, /* initalize */
- backend_destroy, /* destroy */
- NULL, /* get_groups */
- backend_get_filters, /* get_filters */
- NULL, /* cancel */
- backend_get_depends, /* get_depends */
- backend_get_description, /* get_description */
- NULL, /* get_files */
- NULL, /* get_requires */
- NULL, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_package, /* install_package */
- NULL, /* install_file */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_package, /* remove_package */
- NULL, /* resolve */
- NULL, /* rollback */
- NULL, /* search_details */
- NULL, /* search_file */
- NULL, /* search_group */
- backend_search_name, /* search_name */
- backend_update_package, /* update_package */
- backend_update_system, /* update_system */
- NULL, /* get_repo_list */
- NULL, /* repo_enable */
- NULL /* repo_set_data */
-);
-
commit ee158b1b273cd67b3e4144059f020921db73bdc4
Merge: 3998754... 960447b...
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Feb 8 10:12:21 2008 +0000
Merge branch 'master' of git+ssh://thos@git.packagekit.org/srv/git/PackageKit
commit 3998754fa36eedfdb19a90460e0069682077a457
Author: Thomas Wood <thomas at openedhand.com>
Date: Fri Feb 8 10:10:54 2008 +0000
opkg: store last error message rather than just last message
diff --git a/backends/opkg/pk-backend-opkg.c b/backends/opkg/pk-backend-opkg.c
index ff8f3a4..e8c7406 100644
--- a/backends/opkg/pk-backend-opkg.c
+++ b/backends/opkg/pk-backend-opkg.c
@@ -69,16 +69,16 @@ opkg_debug (opkg_conf_t *conf, message_level_t level, char *msg)
if (level == OPKG_ERROR)
pk_backend_message (backend, PK_MESSAGE_ENUM_WARNING, msg);
- if (level != 1)
- return 0;
-
/* print messages only if in verbose mode */
- if (pk_debug_enabled ())
+ if (level <= OPKG_NOTICE && pk_debug_enabled ())
printf ("OPKG: %s", msg);
/* free the last error message and store the new one */
- g_free (last_error);
- last_error = g_strdup (msg);
+ if (level == OPKG_ERROR)
+ {
+ g_free (last_error);
+ last_error = g_strdup (msg);
+ }
return 0;
}
commit 960447bdfc48f7fd7fe30e3948965cf12b9f2233
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 7 22:59:02 2008 +0000
add the other sigals to the dbus test backend
diff --git a/backends/test/helpers/PackageKitDbusTest.py b/backends/test/helpers/PackageKitDbusTest.py
index 4c1b701..589b7d9 100755
--- a/backends/test/helpers/PackageKitDbusTest.py
+++ b/backends/test/helpers/PackageKitDbusTest.py
@@ -55,6 +55,76 @@ class PackageKitTestBackendService(dbus.service.Object):
def Finished(self, exit):
print "Finished (%d)" % (exit)
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='ssb')
+ def RepoDetail(self, repo_id, description, enabled):
+ print "RepoDetail (%s, %s, %i)" % (repo_id, description, enabled)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='u')
+ def StatusChanged(self, status):
+ print "StatusChanged (%i)" % (status)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='u')
+ def PercentageChanged(self, percentage):
+ print "PercentageChanged (%i)" % (percentage)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='u')
+ def SubPercentageChanged(self, percentage):
+ print "SubPercentageChanged (%i)" % (percentage)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='')
+ def NoPercentageChanged(self):
+ print "NoPercentageChanged"
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='uss')
+ def Package(self, percentage, package_id, summary):
+ print "Package (%s, %s)" % (package_id, summary)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='ssussu')
+ def Description(self, package_id, licence, group, detail, url, size):
+ print "Description (%s, %s, %u, %s, %s, %u)" % (package_id, licence, group, detail, url, size)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='ssussu')
+ def Files(self, package_id, file_list):
+ print "Files (%s, %s)" % (package_id, file_list)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='sssssssu')
+ def UpdateDetail(self, package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text):
+ print "UpdateDetail (%s, %s, %s, %s, %s, %s, %s, %u)" % (package_id, updates, obsoletes, vendor_url, bugzilla_url, cve_url, restart, update_text)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='b')
+ def AllowCancel(self, allow_cancel):
+ print "AllowCancel (%i)" % (allow_cancel)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='us')
+ def ErrorCode(self, code, description):
+ print "ErrorCode (%i, %s)" % (code, description)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='us')
+ def RequireRestart(self, restart, description):
+ print "RequireRestart (%i, %s)" % (restart, description)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='us')
+ def Message(self, message, description):
+ print "Message (%i, %s)" % (message, description)
+
+ @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
+ signature='ssssssu')
+ def RepoSignatureRequired(self, repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type):
+ print "RepoSignatureRequired (%s, %s, %s, %s, %s, %s, %i)" % (repository_name, key_url, key_userid, key_id, key_fingerprint, key_timestamp, sig_type)
+
bus = dbus.SystemBus()
bus_name = dbus.service.BusName(PACKAGEKIT_DBUS_SERVICE, bus=bus)
manager = PackageKitTestBackendService(bus_name, PACKAGEKIT_DBUS_PATH)
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index 9c4a4be..051a397 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -323,7 +323,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
dbus_g_proxy_add_signal (proxy, "UpdateDetail",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_INVALID);
+ G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "Finished",
G_TYPE_UINT, G_TYPE_INVALID);
dbus_g_proxy_add_signal (proxy, "AllowCancel",
commit 5867185b32f54d26573bf1bde8122c17cff5ffef
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Feb 6 00:09:29 2008 +0000
add a little debugging
diff --git a/src/pk-backend-dbus.c b/src/pk-backend-dbus.c
index a43b812..9c4a4be 100644
--- a/src/pk-backend-dbus.c
+++ b/src/pk-backend-dbus.c
@@ -300,6 +300,7 @@ pk_backend_dbus_set_name (PkBackendDbus *backend_dbus, const gchar *service,
}
/* grab this */
+ pk_debug ("trying to activate %s", service);
proxy = dbus_g_proxy_new_for_name (backend_dbus->priv->connection,
service, path, interface);
More information about the PackageKit
mailing list