[PackageKit-commit] packagekit: Branch 'master' - 19 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Jan 8 01:53:07 PST 2010
RELEASE | 4
backends/alpm/pk-backend-alpm.c | 122 +++++++++++----
backends/urpmi/pk-backend-urpmi.c | 26 +--
backends/yum/yumBackend.py | 5
configure.ac | 2
lib/packagekit-glib2/Makefile.am | 3
lib/packagekit-glib2/pk-catalog.c | 2
lib/packagekit-glib2/pk-category.c | 2
lib/packagekit-glib2/pk-category.h | 6
lib/packagekit-glib2/pk-client.c | 53 +++++-
lib/packagekit-glib2/pk-client.h | 1
lib/packagekit-glib2/pk-common.h | 7
lib/packagekit-glib2/pk-details.c | 2
lib/packagekit-glib2/pk-details.h | 6
lib/packagekit-glib2/pk-distro-upgrade.c | 2
lib/packagekit-glib2/pk-distro-upgrade.h | 6
lib/packagekit-glib2/pk-enum.c | 1
lib/packagekit-glib2/pk-enum.h | 1
lib/packagekit-glib2/pk-error.c | 2
lib/packagekit-glib2/pk-error.h | 6
lib/packagekit-glib2/pk-eula-required.c | 2
lib/packagekit-glib2/pk-eula-required.h | 6
lib/packagekit-glib2/pk-files.c | 2
lib/packagekit-glib2/pk-files.h | 6
lib/packagekit-glib2/pk-media-change-required.c | 2
lib/packagekit-glib2/pk-media-change-required.h | 6
lib/packagekit-glib2/pk-message.c | 2
lib/packagekit-glib2/pk-message.h | 6
lib/packagekit-glib2/pk-package.c | 2
lib/packagekit-glib2/pk-package.h | 6
lib/packagekit-glib2/pk-repo-detail.c | 2
lib/packagekit-glib2/pk-repo-detail.h | 6
lib/packagekit-glib2/pk-repo-signature-required.c | 2
lib/packagekit-glib2/pk-repo-signature-required.h | 6
lib/packagekit-glib2/pk-require-restart.c | 2
lib/packagekit-glib2/pk-require-restart.h | 6
lib/packagekit-glib2/pk-results.c | 2
lib/packagekit-glib2/pk-source.c | 174 ++++++++++++++++++++++
lib/packagekit-glib2/pk-source.h | 67 ++++++++
lib/packagekit-glib2/pk-task.c | 18 --
lib/packagekit-glib2/pk-transaction-past.c | 2
lib/packagekit-glib2/pk-transaction-past.h | 6
lib/packagekit-glib2/pk-update-detail.c | 2
lib/packagekit-glib2/pk-update-detail.h | 6
lib/python/packagekit/backend.py | 8 +
po/de.po | 2
src/pk-backend-spawn.c | 26 ++-
src/pk-backend.c | 47 ++++-
src/pk-backend.h | 2
src/pk-shared.c | 29 +++
src/pk-shared.h | 11 +
src/pk-transaction.c | 59 ++++---
tools/add-error-enum.sh | 2
53 files changed, 621 insertions(+), 165 deletions(-)
New commits:
commit 663cb489e20132964301cdf3fb8c69e66074583d
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 8 09:17:08 2010 +0000
trivial: be more resilient to internal errors and simply warn instead
diff --git a/lib/packagekit-glib2/pk-catalog.c b/lib/packagekit-glib2/pk-catalog.c
index ed7cf80..31de19d 100644
--- a/lib/packagekit-glib2/pk-catalog.c
+++ b/lib/packagekit-glib2/pk-catalog.c
@@ -625,7 +625,7 @@ pk_catalog_init (PkCatalog *catalog)
NULL);
if (catalog->priv->distro_id == NULL)
- egg_error ("no distro_id, your distro needs to implement this in pk-engine.c!");
+ egg_warning ("no distro_id, your distro needs to implement this in pk-engine.c!");
}
/**
diff --git a/lib/packagekit-glib2/pk-client.c b/lib/packagekit-glib2/pk-client.c
index 1b26d6a..549a115 100644
--- a/lib/packagekit-glib2/pk-client.c
+++ b/lib/packagekit-glib2/pk-client.c
@@ -663,8 +663,10 @@ pk_client_copy_finished_remove_old_files (PkClientState *state)
/* get the data */
array = pk_results_get_files_array (state->results);
- if (array == NULL)
- egg_error ("internal error");
+ if (array == NULL) {
+ egg_warning ("internal error, no files in array");
+ goto out;
+ }
/* remove any without dest path */
for (i=0; i < array->len; ) {
@@ -678,9 +680,9 @@ pk_client_copy_finished_remove_old_files (PkClientState *state)
i++;
g_strfreev (files);
}
-
- /* we're done modifying the data */
- g_ptr_array_unref (array);
+out:
+ if (array != NULL)
+ g_ptr_array_unref (array);
}
/**
@@ -804,8 +806,11 @@ pk_client_copy_downloaded (PkClientState *state)
/* get data */
array = pk_results_get_files_array (state->results);
- if (array == NULL)
- egg_error ("internal error");
+ if (array == NULL) {
+ egg_warning ("internal error, no files in array");
+ goto out;
+ }
+
/* get the number of files to copy */
for (i=0; i < array->len; i++) {
item = g_ptr_array_index (array, i);
@@ -837,7 +842,9 @@ pk_client_copy_downloaded (PkClientState *state)
g_free (package_id);
g_strfreev (files);
}
- g_ptr_array_unref (array);
+out:
+ if (array != NULL)
+ g_ptr_array_unref (array);
}
/**
diff --git a/lib/packagekit-glib2/pk-results.c b/lib/packagekit-glib2/pk-results.c
index 98b5715..85848a6 100644
--- a/lib/packagekit-glib2/pk-results.c
+++ b/lib/packagekit-glib2/pk-results.c
@@ -478,7 +478,7 @@ pk_results_get_error_code (PkResults *results)
/* failed, but no exit code? */
if (results->priv->error_code == NULL && results->priv->exit_enum != PK_EXIT_ENUM_SUCCESS)
- egg_error ("internal error: failed, but no exit code");
+ egg_warning ("internal error: failed, but no exit code: %s", pk_exit_enum_to_text (results->priv->exit_enum));
if (results->priv->error_code == NULL)
return NULL;
diff --git a/lib/packagekit-glib2/pk-task.c b/lib/packagekit-glib2/pk-task.c
index 5afb76c..44f80c3 100644
--- a/lib/packagekit-glib2/pk-task.c
+++ b/lib/packagekit-glib2/pk-task.c
@@ -418,11 +418,7 @@ pk_task_install_signatures (PkTaskState *state)
/* get results */
array = pk_results_get_repo_signature_required_array (state->results);
- if (array == NULL)
- egg_error ("failed to get signatures, fatal error");
-
- /* did we get no results? */
- if (array->len == 0) {
+ if (array == NULL || array->len == 0) {
error = g_error_new (PK_CLIENT_ERROR, PK_CLIENT_ERROR_FAILED, "no signatures to install");
pk_task_generic_state_finish (state, error);
g_error_free (error);
@@ -453,7 +449,8 @@ pk_task_install_signatures (PkTaskState *state)
out:
g_free (package_id);
g_free (key_id);
- g_ptr_array_unref (array);
+ if (array != NULL)
+ g_ptr_array_unref (array);
}
/**
@@ -517,11 +514,7 @@ pk_task_accept_eulas (PkTaskState *state)
/* get results */
array = pk_results_get_eula_required_array (state->results);
- if (array == NULL)
- egg_error ("failed to get eulas, fatal error");
-
- /* did we get no results? */
- if (array->len == 0) {
+ if (array == NULL || array->len == 0) {
error = g_error_new (PK_CLIENT_ERROR, PK_CLIENT_ERROR_FAILED, "no eulas to accept");
pk_task_generic_state_finish (state, error);
g_error_free (error);
@@ -549,7 +542,8 @@ pk_task_accept_eulas (PkTaskState *state)
(GAsyncReadyCallback) pk_task_accept_eulas_ready_cb, state);
out:
g_free (eula_id);
- g_ptr_array_unref (array);
+ if (array != NULL)
+ g_ptr_array_unref (array);
}
/**
commit c32a26c8997962ac21d1937b1b7bcf0357a7fc1b
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Jan 8 09:16:39 2010 +0000
bugfix: Ensure we set an error when the transaction is cancelled
This fixes a bug where old versions of the glib2 library would assert when
the transaction does not exit with success and an error is expected
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 202caed..465ca4f 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -2531,7 +2531,13 @@ void
pk_backend_cancel (PkBackend *backend)
{
g_return_if_fail (PK_IS_BACKEND (backend));
+
+ /* call into the backend */
backend->priv->desc->cancel (backend);
+
+ /* set an error if the backend didn't do it for us */
+ if (!backend->priv->set_error)
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_CANCELLED, "transaction was cancelled");
}
/**
commit cc995557f05520a97ea7b195b4c2765227780d00
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Fri Jan 8 03:44:22 2010 +0200
alpm: added autoremove and HoldPkg functionality (thanks to PirateJonno); changed search functions to allow multiple search values
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index e0b7ce1..48b5587 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -1061,6 +1061,17 @@ backend_search (PkBackend *backend, pmdb_t *repo, const gchar *needle, PkAlpmSea
}
/**
+ * backend_search_values:
+ */
+static void
+backend_search_values (PkBackend *backend, pmdb_t *repo, gchar **values, PkAlpmSearchType search_type) {
+ unsigned int iterator;
+
+ for (iterator = 0; iterator < g_strv_length (values); ++iterator)
+ backend_search (backend, repo, values[iterator], search_type);
+}
+
+/**
* backend_get_packages_thread:
*/
static gboolean
@@ -1350,14 +1361,19 @@ static gboolean
backend_remove_packages_thread (PkBackend *backend)
{
unsigned int iterator;
+ alpm_list_t *list_iterator = NULL;
alpm_list_t *data = NULL;
+ gchar *holdpkgs = NULL;
gchar **package_ids = pk_backend_get_strv (backend, "package_ids");
gboolean allow_deps = pk_backend_get_bool (backend, "allow_deps");
+ gboolean autoremove = pk_backend_get_bool (backend, "autoremove");
pmtransflag_t flags = 0;
if (allow_deps)
flags |= PM_TRANS_FLAG_CASCADE;
+ if (autoremove)
+ flags |= PM_TRANS_FLAG_RECURSE;
/* create a new transaction */
if (alpm_trans_init (PM_TRANS_TYPE_REMOVE, flags, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) {
@@ -1380,8 +1396,41 @@ backend_remove_packages_thread (PkBackend *backend)
g_strfreev (package_id_data);
}
- /* prepare and commit transaction */
- if (alpm_trans_prepare (&data) != 0 || alpm_trans_commit (&data) != 0) {
+ /* prepare transaction */
+ if (alpm_trans_prepare (&data) != 0) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerrorlast ());
+ alpm_trans_release ();
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+
+ /* search for HoldPkg's in target list */
+ for (list_iterator = alpm_trans_get_pkgs (); list_iterator; list_iterator = alpm_list_next (list_iterator)) {
+ pmpkg_t *pkg = alpm_list_getdata (list_iterator);
+ const gchar *pkgname = alpm_pkg_get_name (pkg);
+
+ if (alpm_list_find_str (holdpkg, pkgname) != NULL) {
+ if (holdpkgs == NULL)
+ holdpkgs = g_strdup (pkgname);
+ else {
+ gchar *new_holdpkgs = g_strdup_printf ("%s, %s", holdpkgs, pkgname);
+ g_free (holdpkgs);
+ holdpkgs = new_holdpkgs;
+ }
+ }
+ }
+
+ /* pacman just asks for confirmation, but here we fail to be safe */
+ if (holdpkgs != NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_CANNOT_REMOVE_SYSTEM_PACKAGE, "The following packages are designated HoldPkg: %s", holdpkgs);
+ free (holdpkgs);
+ alpm_trans_release ();
+ pk_backend_finished (backend);
+ return FALSE;
+ }
+
+ /* commit transaction */
+ if (alpm_trans_commit (&data) != 0) {
pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerrorlast ());
alpm_trans_release ();
pk_backend_finished (backend);
@@ -1438,6 +1487,7 @@ backend_resolve_thread (PkBackend *backend)
}
} else {
/* good old way with backend_search */
+ /* TODO: check, is it still needed? */
if (!search_not_installed) {
/* search in local db */
backend_search (backend, alpm_option_get_localdb (), package_ids[iterator], PK_ALPM_SEARCH_TYPE_RESOLVE);
@@ -1475,7 +1525,7 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
static gboolean
backend_search_thread (PkBackend *backend)
{
- const gchar *search = pk_backend_get_string (backend, "search");
+ gchar **values = pk_backend_get_strv (backend, "values");
PkBitfield filters = pk_backend_get_uint (backend, "filters");
PkAlpmSearchType search_type = pk_backend_get_uint (backend, "search-type");
@@ -1484,7 +1534,7 @@ backend_search_thread (PkBackend *backend)
if (!search_not_installed) {
/* search in local db */
- backend_search (backend, alpm_option_get_localdb (), search, search_type);
+ backend_search_values (backend, alpm_option_get_localdb (), values, search_type);
}
if (!search_installed) {
@@ -1492,7 +1542,7 @@ backend_search_thread (PkBackend *backend)
alpm_list_t *repos;
/* iterate repos */
for (repos = alpm_option_get_syncdbs (); repos; repos = alpm_list_next (repos))
- backend_search (backend, alpm_list_getdata (repos), search, search_type);
+ backend_search_values (backend, alpm_list_getdata (repos), values, search_type);
}
pk_backend_finished (backend);
@@ -1503,37 +1553,40 @@ backend_search_thread (PkBackend *backend)
* backend_search_details:
*/
static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_uint (backend, "search-type", PK_ALPM_SEARCH_TYPE_DETAILS);
+ pk_backend_set_strv (backend, "values", values);
pk_backend_thread_create (backend, backend_search_thread);
}
/**
- * backend_search_group:
+ * backend_search_groups:
*/
static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_uint (backend, "search-type", PK_ALPM_SEARCH_TYPE_GROUP);
+ pk_backend_set_strv (backend, "values", values);
pk_backend_thread_create (backend, backend_search_thread);
}
/**
- * backend_search_name:
+ * backend_search_names:
*/
static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_uint (backend, "search-type", PK_ALPM_SEARCH_TYPE_NAME);
+ pk_backend_set_strv (backend, "values", values);
pk_backend_thread_create (backend, backend_search_thread);
}
@@ -1596,11 +1649,12 @@ backend_update_system (PkBackend *backend, gboolean only_trusted)
* backend_what_provides:
*/
static void
-backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, const gchar *search)
+backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_percentage (backend, PK_BACKEND_PERCENTAGE_INVALID);
pk_backend_set_uint (backend, "search-type", PK_ALPM_SEARCH_TYPE_PROVIDES);
+ pk_backend_set_strv (backend, "values", values);
pk_backend_thread_create (backend, backend_search_thread);
}
@@ -1636,9 +1690,9 @@ PK_BACKEND_OPTIONS (
backend_resolve, /* resolve */
NULL, /* rollback */
backend_search_details, /* search_details */
- NULL, /* search_file */
- backend_search_group, /* search_group */
- backend_search_name, /* search_name */
+ NULL, /* search_files */
+ backend_search_groups, /* search_groups */
+ backend_search_names, /* search_names */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
backend_what_provides, /* what_provides */
commit 2761bc5470786fb175b7b58585b2b8ee42eaf223
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Fri Jan 8 02:36:03 2010 +0200
Cache autoremove too in transaction_remove_packages
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 7df5113..13df030 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -3883,6 +3883,7 @@ pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
/* save so we can run later */
transaction->priv->cached_allow_deps = allow_deps;
+ transaction->priv->cached_autoremove = autoremove;
transaction->priv->cached_package_ids = g_strdupv (package_ids);
pk_transaction_set_role (transaction, PK_ROLE_ENUM_REMOVE_PACKAGES);
commit f946bf10b000fba96101c7bf44be5810876c7aa5
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Fri Jan 8 00:52:32 2010 +0200
alpm: understand more config options (thanks to PirateJonno)
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 92046c2..e0b7ce1 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -534,9 +534,7 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
} else if (g_strcmp0 (key, "UseDelta") == 0) {
alpm_option_set_usedelta (1);
egg_debug ("config: usedelta");
- } else if (g_strcmp0 (key, "ILoveCandy") == 0) {
- continue;
- } else {
+ } else if (g_strcmp0 (key, "ILoveCandy") != 0 && g_strcmp0 (key, "ShowSize") != 0 && g_strcmp0 (key, "TotalDownload") != 0) {
egg_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
return 1;
}
@@ -573,7 +571,7 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
} else if (g_strcmp0 (key, "LogFile") == 0) {
alpm_option_set_logfile (ptr);
egg_debug ("config: logfile: %s", ptr);
- } else {
+ } else if (g_strcmp0 (key, "XferCommand") != 0 && g_strcmp0 (key, "CleanMethod") != 0) {
egg_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
return 1;
}
@@ -583,6 +581,8 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
if (alpm_db_setserver (db, server) != 0) {
/* pm_errno is set by alpm_db_setserver */
+ egg_error ("config file %s, line %d: could not add server URL to database (%s).", file, linenum, alpm_strerrorlast ());
+ free (server);
return 1;
}
free (server);
commit 27d423cb37ff1afee75480c76d5c8227979575f8
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Fri Jan 8 00:38:58 2010 +0200
alpm: more formatting (thanks to PirateJonno)
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index d369ee1..92046c2 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -142,7 +142,7 @@ pkg_from_package_id (const gchar *package_id)
alpm_list_t *iterator;
for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator)) {
repo = alpm_list_getdata (iterator);
- if (g_strcmp0 (alpm_db_get_name(repo), package_id_data[PK_PACKAGE_ID_DATA]) == 0)
+ if (g_strcmp0 (alpm_db_get_name (repo), package_id_data[PK_PACKAGE_ID_DATA]) == 0)
break;
}
}
@@ -296,7 +296,7 @@ cb_dl_progress (const char *filename, off_t file_xfered, off_t file_total)
file_percent = (int) ((float) file_xfered) / ((float) file_total) * 100;
trans_percent = (int) ((float) (trans_xfered + file_xfered)) / ((float) trans_total) * 100;
pk_backend_set_sub_percentage ((PkBackend *) backend_instance, file_percent);
- pk_backend_set_percentage((PkBackend *) backend_instance, trans_percent);
+ pk_backend_set_percentage ((PkBackend *) backend_instance, trans_percent);
if (file_xfered == file_total) {
downloaded_files = alpm_list_add (downloaded_files, g_strdup (filename));
@@ -351,14 +351,14 @@ strtrim (char *str)
* Helper function for strreplace
*/
static void
-_strnadd(char **str, const char *append, unsigned int count)
+_strnadd (char **str, const char *append, unsigned int count)
{
if (*str)
*str = realloc (*str, strlen (*str) + count + 1);
else
*str = calloc (sizeof (char), count + 1);
- strncat(*str, append, count);
+ strncat (*str, append, count);
}
/**
@@ -367,7 +367,7 @@ _strnadd(char **str, const char *append, unsigned int count)
* a new string (must be free'd)
*/
static char *
-strreplace(const char *str, const char *needle, const char *replace)
+strreplace (const char *str, const char *needle, const char *replace)
{
const char *p, *q;
char *newstr = NULL;
@@ -376,18 +376,18 @@ strreplace(const char *str, const char *needle, const char *replace)
p = q = str;
while (1) {
- q = strstr(p, needle);
+ q = strstr (p, needle);
if (!q) {
/* not found */
if (*p) /* add the rest of 'p' */
- _strnadd(&newstr, p, strlen(p));
+ _strnadd (&newstr, p, strlen (p));
break;
} else { /* found match */
if (q > p) /* add chars between this occurance and last occurance, if any */
- _strnadd(&newstr, p, q - p);
+ _strnadd (&newstr, p, q - p);
- _strnadd(&newstr, replace, replacesz);
+ _strnadd (&newstr, replace, replacesz);
p = q + needlesz;
}
}
@@ -403,7 +403,7 @@ strreplace(const char *str, const char *needle, const char *replace)
* @param optionfunc a function pointer to an alpm_option_add_* function
*/
static void
-set_repeating_option(const char *ptr, const char *option, void (*optionfunc) (const char*))
+set_repeating_option (const char *ptr, const char *option, void (*optionfunc) (const char*))
{
char *p = (char*) ptr;
char *q;
@@ -462,10 +462,10 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
alpm_option_add_cachedir (ALPM_CACHEDIR);
alpm_option_set_logfile (ALPM_LOGFILE);
- fp = fopen(file, "r");
+ fp = fopen (file, "r");
if (fp == NULL) {
egg_error ("config file %s could not be read", file);
- return (1);
+ return 1;
}
/* if we are passed a section, use it as our starting point */
@@ -544,7 +544,7 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
/* directives with settings */
if (g_strcmp0 (key, "Include") == 0) {
egg_debug ("config: including %s", ptr);
- parse_config(ptr, section, db);
+ parse_config (ptr, section, db);
/* Ignore include failures... assume non-critical */
} else if (g_strcmp0 (section, "options") == 0) {
if (g_strcmp0 (key, "NoUpgrade") == 0) {
@@ -562,7 +562,7 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
} else if (g_strcmp0 (key, "DBPath") == 0) {
alpm_option_set_dbpath (ptr);
} else if (g_strcmp0 (key, "CacheDir") == 0) {
- if (alpm_option_add_cachedir(ptr) != 0) {
+ if (alpm_option_add_cachedir (ptr) != 0) {
egg_error ("problem adding cachedir '%s' (%s)", ptr, alpm_strerrorlast ());
return 1;
}
@@ -931,7 +931,7 @@ backend_get_details (PkBackend *backend, gchar **package_ids)
licenses = g_string_free (licenses_str, FALSE);
/* return details */
- pk_backend_details (backend, package_ids[iterator], licenses, PK_GROUP_ENUM_OTHER, alpm_pkg_get_desc (pkg), alpm_pkg_get_url(pkg), alpm_pkg_get_size (pkg));
+ pk_backend_details (backend, package_ids[iterator], licenses, PK_GROUP_ENUM_OTHER, alpm_pkg_get_desc (pkg), alpm_pkg_get_url (pkg), alpm_pkg_get_size (pkg));
/* free licenses array as we no longer need it */
g_free (licenses);
@@ -1020,7 +1020,7 @@ backend_search (PkBackend *backend, pmdb_t *repo, const gchar *needle, PkAlpmSea
match = TRUE;
break;
case PK_ALPM_SEARCH_TYPE_RESOLVE:
- match = g_strcmp0 (alpm_pkg_get_name(pkg), needle) == 0;
+ match = g_strcmp0 (alpm_pkg_get_name (pkg), needle) == 0;
break;
case PK_ALPM_SEARCH_TYPE_NAME:
match = strstr (alpm_pkg_get_name (pkg), needle) != NULL;
@@ -1047,7 +1047,7 @@ backend_search (PkBackend *backend, pmdb_t *repo, const gchar *needle, PkAlpmSea
match = FALSE;
/* iterate provides */
for (provides = alpm_pkg_get_provides (pkg); provides && !match; provides = alpm_list_next (provides))
- match = (g_strcmp0 (needle, alpm_list_getdata(provides)) == 0);
+ match = (g_strcmp0 (needle, alpm_list_getdata (provides)) == 0);
break;
default:
match = FALSE;
commit 27016056c90c85b9c9c2e432cbf562d4636e3d97
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Fri Jan 8 00:28:57 2010 +0200
alpm: handle ILoveCandy config option (thanks to PirateJonno)
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 21647c7..d369ee1 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -534,6 +534,8 @@ parse_config (const char *file, const char *givensection, pmdb_t * const givendb
} else if (g_strcmp0 (key, "UseDelta") == 0) {
alpm_option_set_usedelta (1);
egg_debug ("config: usedelta");
+ } else if (g_strcmp0 (key, "ILoveCandy") == 0) {
+ continue;
} else {
egg_error ("config file %s, line %d: directive '%s' not recognized.", file, linenum, key);
return 1;
commit 3669f7d8b529e91f063e90f9597cc6f0191dbebb
Author: Aurelien Lefebvre <alkh at mandriva.org>
Date: Thu Jan 7 16:50:35 2010 +0100
urpmi: fix backend api
diff --git a/backends/urpmi/pk-backend-urpmi.c b/backends/urpmi/pk-backend-urpmi.c
index d02ec32..a88cf02 100644
--- a/backends/urpmi/pk-backend-urpmi.c
+++ b/backends/urpmi/pk-backend-urpmi.c
@@ -102,11 +102,11 @@ backend_get_filters (PkBackend *backend)
* pk_backend_search_name:
*/
static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_names (PkBackend *backend, PkBitfield filters, gchar **search)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-name", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-name", filters_text, search[0], NULL);
g_free (filters_text);
}
@@ -234,14 +234,14 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
}
/**
- * pk_backend_search_group:
+ * pk_backend_search_groups:
*/
static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **search)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-group", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-group", filters_text, search[0], NULL);
g_free (filters_text);
}
@@ -284,23 +284,23 @@ backend_get_requires (PkBackend *backend, PkBitfield filters, gchar **package_id
* pk_backend_search_details:
*/
static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_details (PkBackend *backend, PkBitfield filters, gchar **search)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-details", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-details", filters_text, search[0], NULL);
g_free (filters_text);
}
/**
- * pk_backend_search_file:
+ * pk_backend_search_files:
*/
static void
-backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_files (PkBackend *backend, PkBitfield filters, gchar **search)
{
gchar *filters_text;
filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-file", filters_text, search, NULL);
+ pk_backend_spawn_helper (spawn, "urpmi-dispatched-backend.pl", "search-file", filters_text, search[0], NULL);
g_free (filters_text);
}
@@ -391,9 +391,9 @@ PK_BACKEND_OPTIONS (
backend_resolve, /* resolve */
NULL, /* rollback */
backend_search_details, /* search_details */
- backend_search_file, /* search_file */
- backend_search_group, /* search_group */
- backend_search_name, /* search_name */
+ backend_search_files, /* search_files */
+ backend_search_groups, /* search_groups */
+ backend_search_names, /* search_names */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
NULL, /* what_provides */
commit 97803b3fbe46dfbef1bf2b83ad7dc9bff27ed89e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 7 12:21:37 2010 +0000
trivial: install pk-source.h so that client tools can use it
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index aa126e3..63a1412 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -54,6 +54,7 @@ libpackagekit_glib2_include_HEADERS = \
pk-require-restart.h \
pk-results.h \
pk-service-pack.h \
+ pk-source.h \
pk-task.h \
pk-transaction-past.h \
pk-transaction-list.h \
commit 189e754db6d71483026231d1fcdb4d6c9f433f87
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 7 10:51:29 2010 +0000
glib2: Add a parent object to all the source objects to track the source role and transacton id
diff --git a/lib/packagekit-glib2/Makefile.am b/lib/packagekit-glib2/Makefile.am
index 194710c..aa126e3 100644
--- a/lib/packagekit-glib2/Makefile.am
+++ b/lib/packagekit-glib2/Makefile.am
@@ -123,6 +123,8 @@ libpackagekit_glib2_la_SOURCES = \
pk-results.h \
pk-service-pack.c \
pk-service-pack.h \
+ pk-source.c \
+ pk-source.h \
pk-task.c \
pk-task.h \
pk-transaction-past.c \
diff --git a/lib/packagekit-glib2/pk-category.c b/lib/packagekit-glib2/pk-category.c
index 104b8d6..bdbfbc1 100644
--- a/lib/packagekit-glib2/pk-category.c
+++ b/lib/packagekit-glib2/pk-category.c
@@ -62,7 +62,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkCategory, pk_category, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkCategory, pk_category, PK_TYPE_SOURCE)
/**
* pk_category_get_property:
diff --git a/lib/packagekit-glib2/pk-category.h b/lib/packagekit-glib2/pk-category.h
index aea1f02..0fb27e3 100644
--- a/lib/packagekit-glib2/pk-category.h
+++ b/lib/packagekit-glib2/pk-category.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_CATEGORY (pk_category_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkCategoryClass PkCategoryClass;
struct _PkCategory
{
- GObject parent;
+ PkSource parent;
PkCategoryPrivate *priv;
};
struct _PkCategoryClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-client.c b/lib/packagekit-glib2/pk-client.c
index d728363..1b26d6a 100644
--- a/lib/packagekit-glib2/pk-client.c
+++ b/lib/packagekit-glib2/pk-client.c
@@ -769,6 +769,8 @@ pk_client_copy_downloaded_file (PkClientState *state, const gchar *package_id, c
g_object_set (item,
"package-id", package_id,
"files", files,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_files (state->results, item);
@@ -946,6 +948,8 @@ pk_client_package_cb (DBusGProxy *proxy, const gchar *info_text, const gchar *pa
g_object_set (package,
"info", info_enum,
"summary", summary,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
ret = pk_progress_set_package (state->progress, package);
if (state->progress_callback != NULL && ret)
@@ -1036,6 +1040,8 @@ pk_client_details_cb (DBusGProxy *proxy, const gchar *package_id, const gchar *l
"description", description,
"url", url,
"size", size,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_details (state->results, item);
g_object_unref (item);
@@ -1073,6 +1079,8 @@ pk_client_update_detail_cb (DBusGProxy *proxy, const gchar *package_id, const g
"state", state_enum,
"issued", issued_text,
"updated", updated_text,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_update_detail (state->results, item);
g_object_unref (item);
@@ -1101,6 +1109,8 @@ pk_client_transaction_cb (DBusGProxy *proxy, const gchar *tid, const gchar *time
"data", data,
"uid", uid,
"cmdline", cmdline,
+ "PkSource::role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_transaction (state->results, item);
g_object_unref (item);
@@ -1123,6 +1133,8 @@ pk_client_distro_upgrade_cb (DBusGProxy *proxy, const gchar *type_text, const gc
"type", type_enum,
"name", name,
"summary", summary,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_distro_upgrade (state->results, item);
g_object_unref (item);
@@ -1143,6 +1155,8 @@ pk_client_require_restart_cb (DBusGProxy *proxy, const gchar *restart_text, con
g_object_set (item,
"restart", restart_enum,
"package-id", package_id,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_require_restart (state->results, item);
g_object_unref (item);
@@ -1165,6 +1179,8 @@ pk_client_category_cb (DBusGProxy *proxy, const gchar *parent_id, const gchar *
"name", name,
"summary", summary,
"icon", icon,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_category (state->results, item);
g_object_unref (item);
@@ -1185,6 +1201,8 @@ pk_client_files_cb (DBusGProxy *proxy, const gchar *package_id, const gchar *fil
g_object_set (item,
"package-id", package_id,
"files", files,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_files (state->results, item);
g_object_unref (item);
@@ -1215,6 +1233,8 @@ pk_client_repo_signature_required_cb (DBusGProxy *proxy, const gchar *package_id
"key-fingerprint", key_fingerprint,
"key-timestamp", key_timestamp,
"type", type_enum,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_repo_signature_required (state->results, item);
g_object_unref (item);
@@ -1236,6 +1256,8 @@ pk_client_eula_required_cb (DBusGProxy *proxy, const gchar *eula_id, const gchar
"package-id", package_id,
"vendor-name", vendor_name,
"license-agreement", license_agreement,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_eula_required (state->results, item);
g_object_unref (item);
@@ -1258,6 +1280,8 @@ pk_client_media_change_required_cb (DBusGProxy *proxy, const gchar *media_type_t
"media-type", media_type_enum,
"media-id", media_id,
"media-text", media_text,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_media_change_required (state->results, item);
g_object_unref (item);
@@ -1278,6 +1302,8 @@ pk_client_repo_detail_cb (DBusGProxy *proxy, const gchar *repo_id,
"repo-id", repo_id,
"description", description,
"enabled", enabled,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_repo_detail (state->results, item);
g_object_unref (item);
@@ -1298,6 +1324,8 @@ pk_client_error_code_cb (DBusGProxy *proxy, const gchar *code_text, const gchar
g_object_set (item,
"code", code_enum,
"details", details,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_set_error_code (state->results, item);
g_object_unref (item);
@@ -1318,6 +1346,8 @@ pk_client_message_cb (DBusGProxy *proxy, const gchar *message_text, const gchar
g_object_set (item,
"type", message_enum,
"details", details,
+ "role", state->role,
+ "transaction-id", state->transaction_id,
NULL);
pk_results_add_message (state->results, item);
g_object_unref (item);
diff --git a/lib/packagekit-glib2/pk-client.h b/lib/packagekit-glib2/pk-client.h
index 9b16fe9..d6a043a 100644
--- a/lib/packagekit-glib2/pk-client.h
+++ b/lib/packagekit-glib2/pk-client.h
@@ -32,6 +32,7 @@
#include <packagekit-glib2/pk-results.h>
#include <packagekit-glib2/pk-progress.h>
#include <packagekit-glib2/pk-bitfield.h>
+#include <packagekit-glib2/pk-source.h>
G_BEGIN_DECLS
diff --git a/lib/packagekit-glib2/pk-details.c b/lib/packagekit-glib2/pk-details.c
index 7d18768..3be5759 100644
--- a/lib/packagekit-glib2/pk-details.c
+++ b/lib/packagekit-glib2/pk-details.c
@@ -67,7 +67,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkDetails, pk_details, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkDetails, pk_details, PK_TYPE_SOURCE)
/**
* pk_details_get_property:
diff --git a/lib/packagekit-glib2/pk-details.h b/lib/packagekit-glib2/pk-details.h
index e8c6b87..6ae6ec4 100644
--- a/lib/packagekit-glib2/pk-details.h
+++ b/lib/packagekit-glib2/pk-details.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_DETAILS (pk_details_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkDetailsClass PkDetailsClass;
struct _PkDetails
{
- GObject parent;
+ PkSource parent;
PkDetailsPrivate *priv;
};
struct _PkDetailsClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-distro-upgrade.c b/lib/packagekit-glib2/pk-distro-upgrade.c
index 352373f..7f56762 100644
--- a/lib/packagekit-glib2/pk-distro-upgrade.c
+++ b/lib/packagekit-glib2/pk-distro-upgrade.c
@@ -61,7 +61,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkDistroUpgrade, pk_distro_upgrade, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkDistroUpgrade, pk_distro_upgrade, PK_TYPE_SOURCE)
/**
* pk_distro_upgrade_get_property:
diff --git a/lib/packagekit-glib2/pk-distro-upgrade.h b/lib/packagekit-glib2/pk-distro-upgrade.h
index de7bc04..9f5c42a 100644
--- a/lib/packagekit-glib2/pk-distro-upgrade.h
+++ b/lib/packagekit-glib2/pk-distro-upgrade.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_DISTRO_UPGRADE (pk_distro_upgrade_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkDistroUpgradeClass PkDistroUpgradeClass;
struct _PkDistroUpgrade
{
- GObject parent;
+ PkSource parent;
PkDistroUpgradePrivate *priv;
};
struct _PkDistroUpgradeClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-error.c b/lib/packagekit-glib2/pk-error.c
index 3faf1e7..e467522 100644
--- a/lib/packagekit-glib2/pk-error.c
+++ b/lib/packagekit-glib2/pk-error.c
@@ -59,7 +59,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkError, pk_error, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkError, pk_error, PK_TYPE_SOURCE)
/**
* pk_error_get_property:
diff --git a/lib/packagekit-glib2/pk-error.h b/lib/packagekit-glib2/pk-error.h
index c7be761..96357be 100644
--- a/lib/packagekit-glib2/pk-error.h
+++ b/lib/packagekit-glib2/pk-error.h
@@ -27,7 +27,9 @@
#define __PK_ERROR_CODE_H
#include <glib-object.h>
+
#include <packagekit-glib2/pk-enum.h>
+#include <packagekit-glib2/pk-source.h>
G_BEGIN_DECLS
@@ -44,13 +46,13 @@ typedef struct _PkErrorClass PkErrorClass;
struct _PkError
{
- GObject parent;
+ PkSource parent;
PkErrorPrivate *priv;
};
struct _PkErrorClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-eula-required.c b/lib/packagekit-glib2/pk-eula-required.c
index 1f416ea..1a1f2af 100644
--- a/lib/packagekit-glib2/pk-eula-required.c
+++ b/lib/packagekit-glib2/pk-eula-required.c
@@ -62,7 +62,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkEulaRequired, pk_eula_required, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkEulaRequired, pk_eula_required, PK_TYPE_SOURCE)
/**
* pk_eula_required_get_property:
diff --git a/lib/packagekit-glib2/pk-eula-required.h b/lib/packagekit-glib2/pk-eula-required.h
index 9a69b35..c3bb9e5 100644
--- a/lib/packagekit-glib2/pk-eula-required.h
+++ b/lib/packagekit-glib2/pk-eula-required.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_EULA_REQUIRED (pk_eula_required_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkEulaRequiredClass PkEulaRequiredClass;
struct _PkEulaRequired
{
- GObject parent;
+ PkSource parent;
PkEulaRequiredPrivate *priv;
};
struct _PkEulaRequiredClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-files.c b/lib/packagekit-glib2/pk-files.c
index 5d54684..8082181 100644
--- a/lib/packagekit-glib2/pk-files.c
+++ b/lib/packagekit-glib2/pk-files.c
@@ -58,7 +58,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkFiles, pk_files, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkFiles, pk_files, PK_TYPE_SOURCE)
/**
* pk_files_get_property:
diff --git a/lib/packagekit-glib2/pk-files.h b/lib/packagekit-glib2/pk-files.h
index 728d99f..e00e3e2 100644
--- a/lib/packagekit-glib2/pk-files.h
+++ b/lib/packagekit-glib2/pk-files.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_FILES (pk_files_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkFilesClass PkFilesClass;
struct _PkFiles
{
- GObject parent;
+ PkSource parent;
PkFilesPrivate *priv;
};
struct _PkFilesClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-media-change-required.c b/lib/packagekit-glib2/pk-media-change-required.c
index 45ad254..0ad2b43 100644
--- a/lib/packagekit-glib2/pk-media-change-required.c
+++ b/lib/packagekit-glib2/pk-media-change-required.c
@@ -61,7 +61,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkMediaChangeRequired, pk_media_change_required, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkMediaChangeRequired, pk_media_change_required, PK_TYPE_SOURCE)
/**
* pk_media_change_required_get_property:
diff --git a/lib/packagekit-glib2/pk-media-change-required.h b/lib/packagekit-glib2/pk-media-change-required.h
index ffedb61..5f18ee3 100644
--- a/lib/packagekit-glib2/pk-media-change-required.h
+++ b/lib/packagekit-glib2/pk-media-change-required.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_MEDIA_CHANGE_REQUIRED (pk_media_change_required_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkMediaChangeRequiredClass PkMediaChangeRequiredClass;
struct _PkMediaChangeRequired
{
- GObject parent;
+ PkSource parent;
PkMediaChangeRequiredPrivate *priv;
};
struct _PkMediaChangeRequiredClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-message.c b/lib/packagekit-glib2/pk-message.c
index cd1b072..db2270c 100644
--- a/lib/packagekit-glib2/pk-message.c
+++ b/lib/packagekit-glib2/pk-message.c
@@ -59,7 +59,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkMessage, pk_message, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkMessage, pk_message, PK_TYPE_SOURCE)
/**
* pk_message_get_property:
diff --git a/lib/packagekit-glib2/pk-message.h b/lib/packagekit-glib2/pk-message.h
index 9b602fb..1500882 100644
--- a/lib/packagekit-glib2/pk-message.h
+++ b/lib/packagekit-glib2/pk-message.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_MESSAGE (pk_message_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkMessageClass PkMessageClass;
struct _PkMessage
{
- GObject parent;
+ PkSource parent;
PkMessagePrivate *priv;
};
struct _PkMessageClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-package.c b/lib/packagekit-glib2/pk-package.c
index 0f8f5c9..f7c9281 100644
--- a/lib/packagekit-glib2/pk-package.c
+++ b/lib/packagekit-glib2/pk-package.c
@@ -102,7 +102,7 @@ enum {
static guint signals [SIGNAL_LAST] = { 0 };
-G_DEFINE_TYPE (PkPackage, pk_package, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkPackage, pk_package, PK_TYPE_SOURCE)
/**
* pk_package_equal:
diff --git a/lib/packagekit-glib2/pk-package.h b/lib/packagekit-glib2/pk-package.h
index d4f7d76..a812c8e 100644
--- a/lib/packagekit-glib2/pk-package.h
+++ b/lib/packagekit-glib2/pk-package.h
@@ -27,7 +27,9 @@
#define __PK_PACKAGE_H
#include <glib-object.h>
+
#include <packagekit-glib2/pk-enum.h>
+#include <packagekit-glib2/pk-source.h>
G_BEGIN_DECLS
@@ -46,13 +48,13 @@ typedef struct _PkPackageClass PkPackageClass;
struct _PkPackage
{
- GObject parent;
+ PkSource parent;
PkPackagePrivate *priv;
};
struct _PkPackageClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* signals */
void (* changed) (PkPackage *package);
diff --git a/lib/packagekit-glib2/pk-repo-detail.c b/lib/packagekit-glib2/pk-repo-detail.c
index cf63604..f807d38 100644
--- a/lib/packagekit-glib2/pk-repo-detail.c
+++ b/lib/packagekit-glib2/pk-repo-detail.c
@@ -60,7 +60,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkRepoDetail, pk_repo_detail, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkRepoDetail, pk_repo_detail, PK_TYPE_SOURCE)
/**
* pk_repo_detail_get_property:
diff --git a/lib/packagekit-glib2/pk-repo-detail.h b/lib/packagekit-glib2/pk-repo-detail.h
index 6a66244..23b8f4c 100644
--- a/lib/packagekit-glib2/pk-repo-detail.h
+++ b/lib/packagekit-glib2/pk-repo-detail.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_REPO_DETAIL (pk_repo_detail_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkRepoDetailClass PkRepoDetailClass;
struct _PkRepoDetail
{
- GObject parent;
+ PkSource parent;
PkRepoDetailPrivate *priv;
};
struct _PkRepoDetailClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-repo-signature-required.c b/lib/packagekit-glib2/pk-repo-signature-required.c
index 27ba133..c2d150f 100644
--- a/lib/packagekit-glib2/pk-repo-signature-required.c
+++ b/lib/packagekit-glib2/pk-repo-signature-required.c
@@ -71,7 +71,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkRepoSignatureRequired, pk_repo_signature_required, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkRepoSignatureRequired, pk_repo_signature_required, PK_TYPE_SOURCE)
/**
* pk_repo_signature_required_get_property:
diff --git a/lib/packagekit-glib2/pk-repo-signature-required.h b/lib/packagekit-glib2/pk-repo-signature-required.h
index 2ca6066..ff58f03 100644
--- a/lib/packagekit-glib2/pk-repo-signature-required.h
+++ b/lib/packagekit-glib2/pk-repo-signature-required.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_REPO_SIGNATURE_REQUIRED (pk_repo_signature_required_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkRepoSignatureRequiredClass PkRepoSignatureRequiredClass;
struct _PkRepoSignatureRequired
{
- GObject parent;
+ PkSource parent;
PkRepoSignatureRequiredPrivate *priv;
};
struct _PkRepoSignatureRequiredClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-require-restart.c b/lib/packagekit-glib2/pk-require-restart.c
index dd1101d..b6e7c96 100644
--- a/lib/packagekit-glib2/pk-require-restart.c
+++ b/lib/packagekit-glib2/pk-require-restart.c
@@ -59,7 +59,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkRequireRestart, pk_require_restart, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkRequireRestart, pk_require_restart, PK_TYPE_SOURCE)
/**
* pk_require_restart_get_property:
diff --git a/lib/packagekit-glib2/pk-require-restart.h b/lib/packagekit-glib2/pk-require-restart.h
index a13f7c2..7730414 100644
--- a/lib/packagekit-glib2/pk-require-restart.h
+++ b/lib/packagekit-glib2/pk-require-restart.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_REQUIRE_RESTART (pk_require_restart_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkRequireRestartClass PkRequireRestartClass;
struct _PkRequireRestart
{
- GObject parent;
+ PkSource parent;
PkRequireRestartPrivate *priv;
};
struct _PkRequireRestartClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-source.c b/lib/packagekit-glib2/pk-source.c
new file mode 100644
index 0000000..40e3f8d
--- /dev/null
+++ b/lib/packagekit-glib2/pk-source.c
@@ -0,0 +1,174 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard at hughsie.com>
+ *
+ * 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.
+ */
+
+/**
+ * SECTION:pk-source
+ * @short_description: Source object
+ *
+ * This GObject holds details about the source of the transaction object, and
+ * are therefore shared properties that all data objects have.
+ */
+
+#include "config.h"
+
+#include <glib-object.h>
+
+#include <packagekit-glib2/pk-source.h>
+#include <packagekit-glib2/pk-enum.h>
+
+#include "egg-debug.h"
+
+static void pk_source_finalize (GObject *object);
+
+#define PK_SOURCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_SOURCE, PkSourcePrivate))
+
+/**
+ * PkSourcePrivate:
+ *
+ * Private #PkSource data
+ **/
+struct _PkSourcePrivate
+{
+ PkRoleEnum role;
+ gchar *transaction_id;
+};
+
+enum {
+ PROP_0,
+ PROP_ROLE,
+ PROP_TRANSACTION_ID,
+ PROP_LAST
+};
+
+G_DEFINE_TYPE (PkSource, pk_source, G_TYPE_OBJECT)
+
+/**
+ * pk_source_get_property:
+ **/
+static void
+pk_source_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+{
+ PkSource *source = PK_SOURCE (object);
+ PkSourcePrivate *priv = source->priv;
+
+ switch (prop_id) {
+ case PROP_ROLE:
+ g_value_set_uint (value, priv->role);
+ break;
+ case PROP_TRANSACTION_ID:
+ g_value_set_string (value, priv->transaction_id);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/**
+ * pk_source_set_property:
+ **/
+static void
+pk_source_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+{
+ PkSource *source = PK_SOURCE (object);
+ PkSourcePrivate *priv = source->priv;
+
+ switch (prop_id) {
+ case PROP_ROLE:
+ priv->role = g_value_get_uint (value);
+ break;
+ case PROP_TRANSACTION_ID:
+ g_free (priv->transaction_id);
+ priv->transaction_id = g_strdup (g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/**
+ * pk_source_class_init:
+ **/
+static void
+pk_source_class_init (PkSourceClass *klass)
+{
+ GParamSpec *pspec;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_source_finalize;
+ object_class->get_property = pk_source_get_property;
+ object_class->set_property = pk_source_set_property;
+
+ /**
+ * PkSource:role:
+ */
+ pspec = g_param_spec_uint ("role", NULL, NULL,
+ 0, G_MAXUINT, PK_ROLE_ENUM_UNKNOWN,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_ROLE, pspec);
+
+ /**
+ * PkSource:transaction-id:
+ */
+ pspec = g_param_spec_string ("transaction-id", NULL, NULL,
+ NULL,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_TRANSACTION_ID, pspec);
+
+ g_type_class_add_private (klass, sizeof (PkSourcePrivate));
+}
+
+/**
+ * pk_source_init:
+ **/
+static void
+pk_source_init (PkSource *source)
+{
+ source->priv = PK_SOURCE_GET_PRIVATE (source);
+}
+
+/**
+ * pk_source_finalize:
+ **/
+static void
+pk_source_finalize (GObject *object)
+{
+ PkSource *source = PK_SOURCE (object);
+ PkSourcePrivate *priv = source->priv;
+
+ g_free (priv->transaction_id);
+
+ G_OBJECT_CLASS (pk_source_parent_class)->finalize (object);
+}
+
+/**
+ * pk_source_new:
+ *
+ * Return value: a new PkSource object.
+ **/
+PkSource *
+pk_source_new (void)
+{
+ PkSource *source;
+ source = g_object_new (PK_TYPE_SOURCE, NULL);
+ return PK_SOURCE (source);
+}
+
diff --git a/lib/packagekit-glib2/pk-source.h b/lib/packagekit-glib2/pk-source.h
new file mode 100644
index 0000000..6e307a7
--- /dev/null
+++ b/lib/packagekit-glib2/pk-source.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2009 Richard Hughes <richard at hughsie.com>
+ *
+ * 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.
+ */
+
+#if !defined (__PACKAGEKIT_H_INSIDE__) && !defined (PK_COMPILATION)
+#error "Only <packagekit.h> can be included directly."
+#endif
+
+#ifndef __PK_SOURCE_H
+#define __PK_SOURCE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_SOURCE (pk_source_get_type ())
+#define PK_SOURCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_SOURCE, PkSource))
+#define PK_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_SOURCE, PkSourceClass))
+#define PK_IS_SOURCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_SOURCE))
+#define PK_IS_SOURCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_SOURCE))
+#define PK_SOURCE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_SOURCE, PkSourceClass))
+
+typedef struct _PkSourcePrivate PkSourcePrivate;
+typedef struct _PkSource PkSource;
+typedef struct _PkSourceClass PkSourceClass;
+
+struct _PkSource
+{
+ GObject parent;
+ PkSourcePrivate *priv;
+};
+
+struct _PkSourceClass
+{
+ GObjectClass parent_class;
+ /* padding for future expansion */
+ void (*_pk_reserved1) (void);
+ void (*_pk_reserved2) (void);
+ void (*_pk_reserved3) (void);
+ void (*_pk_reserved4) (void);
+ void (*_pk_reserved5) (void);
+};
+
+GType pk_source_get_type (void);
+PkSource *pk_source_new (void);
+
+G_END_DECLS
+
+#endif /* __PK_SOURCE_H */
+
diff --git a/lib/packagekit-glib2/pk-transaction-past.c b/lib/packagekit-glib2/pk-transaction-past.c
index 3381fa5..877a2ca 100644
--- a/lib/packagekit-glib2/pk-transaction-past.c
+++ b/lib/packagekit-glib2/pk-transaction-past.c
@@ -71,7 +71,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkTransactionPast, pk_transaction_past, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkTransactionPast, pk_transaction_past, PK_TYPE_SOURCE)
/**
* pk_transaction_past_get_property:
diff --git a/lib/packagekit-glib2/pk-transaction-past.h b/lib/packagekit-glib2/pk-transaction-past.h
index 5b06bfc..0463ee0 100644
--- a/lib/packagekit-glib2/pk-transaction-past.h
+++ b/lib/packagekit-glib2/pk-transaction-past.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_TRANSACTION_PAST (pk_transaction_past_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkTransactionPastClass PkTransactionPastClass;
struct _PkTransactionPast
{
- GObject parent;
+ PkSource parent;
PkTransactionPastPrivate *priv;
};
struct _PkTransactionPastClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
diff --git a/lib/packagekit-glib2/pk-update-detail.c b/lib/packagekit-glib2/pk-update-detail.c
index 2cff695..57b286e 100644
--- a/lib/packagekit-glib2/pk-update-detail.c
+++ b/lib/packagekit-glib2/pk-update-detail.c
@@ -79,7 +79,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (PkUpdateDetail, pk_update_detail, G_TYPE_OBJECT)
+G_DEFINE_TYPE (PkUpdateDetail, pk_update_detail, PK_TYPE_SOURCE)
/**
* pk_update_detail_get_property:
diff --git a/lib/packagekit-glib2/pk-update-detail.h b/lib/packagekit-glib2/pk-update-detail.h
index 15df1ef..0529fda 100644
--- a/lib/packagekit-glib2/pk-update-detail.h
+++ b/lib/packagekit-glib2/pk-update-detail.h
@@ -28,6 +28,8 @@
#include <glib-object.h>
+#include <packagekit-glib2/pk-source.h>
+
G_BEGIN_DECLS
#define PK_TYPE_UPDATE_DETAIL (pk_update_detail_get_type ())
@@ -43,13 +45,13 @@ typedef struct _PkUpdateDetailClass PkUpdateDetailClass;
struct _PkUpdateDetail
{
- GObject parent;
+ PkSource parent;
PkUpdateDetailPrivate *priv;
};
struct _PkUpdateDetailClass
{
- GObjectClass parent_class;
+ PkSourceClass parent_class;
/* padding for future expansion */
void (*_pk_reserved1) (void);
void (*_pk_reserved2) (void);
commit 1b254465105d0e171ae693be80f0f73c18c43058
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 7 09:40:50 2010 +0000
yum: use repo-for-developers-only when enabling rawhide
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 3c6f73c..3d6750d 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2438,7 +2438,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
"Please use these packages if you want to work with the " \
"Fedora developers by testing these new development packages.\n\n" \
"If this is not correct, please disable the %s software source." % repoid
- self.message(MESSAGE_BACKEND_ERROR, warning.replace("\n", ";"))
+ self.message(MESSAGE_REPO_FOR_DEVELOPERS_ONLY, warning.replace("\n", ";"))
except yum.Errors.RepoError, e:
self.error(ERROR_REPO_NOT_FOUND, _to_unicode(e))
except Exception, e:
commit d36fbccad0242e6a7111cfeee4a1ebf002460473
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 7 09:40:29 2010 +0000
Add a new message enum 'repo-for-developers-only' for repos that should not be used by users
diff --git a/lib/packagekit-glib2/pk-enum.c b/lib/packagekit-glib2/pk-enum.c
index c7aad97..e173565 100644
--- a/lib/packagekit-glib2/pk-enum.c
+++ b/lib/packagekit-glib2/pk-enum.c
@@ -222,6 +222,7 @@ static const PkEnumMatch enum_message[] = {
{PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED, "package-already-installed"},
{PK_MESSAGE_ENUM_AUTOREMOVE_IGNORED, "autoremove-ignored"},
{PK_MESSAGE_ENUM_REPO_METADATA_DOWNLOAD_FAILED, "repo-metadata-download-failed"},
+ {PK_MESSAGE_ENUM_REPO_FOR_DEVELOPERS_ONLY, "repo-for-developers-only"},
{0, NULL}
};
diff --git a/lib/packagekit-glib2/pk-enum.h b/lib/packagekit-glib2/pk-enum.h
index 80778b1..4688142 100644
--- a/lib/packagekit-glib2/pk-enum.h
+++ b/lib/packagekit-glib2/pk-enum.h
@@ -251,6 +251,7 @@ typedef enum {
PK_MESSAGE_ENUM_PACKAGE_ALREADY_INSTALLED,
PK_MESSAGE_ENUM_AUTOREMOVE_IGNORED,
PK_MESSAGE_ENUM_REPO_METADATA_DOWNLOAD_FAILED,
+ PK_MESSAGE_ENUM_REPO_FOR_DEVELOPERS_ONLY,
PK_MESSAGE_ENUM_LAST
} PkMessageEnum;
commit 487b0c63abaf471ba8b8ab4cc64ca77ba801c543
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Jan 7 09:31:40 2010 +0000
trivial: update a script not glib has been removed
diff --git a/tools/add-error-enum.sh b/tools/add-error-enum.sh
index 850cab7..2e6fc94 100755
--- a/tools/add-error-enum.sh
+++ b/tools/add-error-enum.sh
@@ -7,5 +7,5 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-$EDITOR lib/packagekit-glib/pk-enum.h lib/packagekit-glib/pk-enum.c ../gnome-packagekit/src/gpk-enum.c ../gnome-packagekit/src/gpk-enum.h
+$EDITOR lib/packagekit-glib2/pk-enum.h lib/packagekit-glib2/pk-enum.c ../gnome-packagekit/src/gpk-enum.c ../gnome-packagekit/src/gpk-enum.h
commit 84d6e16d274f55dc8cebb611c61689ae20102b2f
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jan 6 16:29:22 2010 +0000
Add support for the 'interactive' hint in the daemon, and also sent it to the backend
diff --git a/lib/packagekit-glib2/pk-common.h b/lib/packagekit-glib2/pk-common.h
index b30712a..38c6954 100644
--- a/lib/packagekit-glib2/pk-common.h
+++ b/lib/packagekit-glib2/pk-common.h
@@ -74,13 +74,6 @@ G_BEGIN_DECLS
*/
#define PK_SYSTEM_PACKAGE_LIST_FILENAME "/var/lib/PackageKit/system.package-list"
-/* a boolean with unset */
-typedef enum {
- PK_TRISTATE_FALSE = FALSE,
- PK_TRISTATE_TRUE = TRUE,
- PK_TRISTATE_UNSET
-} PkTristate;
-
void pk_common_test (gpointer user_data);
gchar **pk_ptr_array_to_strv (GPtrArray *array)
G_GNUC_WARN_UNUSED_RESULT;
diff --git a/lib/python/packagekit/backend.py b/lib/python/packagekit/backend.py
index 9993e72..1053bf0 100644
--- a/lib/python/packagekit/backend.py
+++ b/lib/python/packagekit/backend.py
@@ -56,6 +56,7 @@ class PackageKitBaseBackend:
self.lang = "C"
self.has_network = False
self.background = False
+ self.interactive = False
self.percentage_old = 0
self.sub_percentage_old = 0
@@ -79,6 +80,13 @@ class PackageKitBaseBackend:
except KeyError, e:
print "Error: No BACKGROUND envp"
+ # try to get INTERACTIVE state
+ try:
+ if os.environ['INTERACTIVE'] == 'TRUE':
+ self.interactive = True
+ except KeyError, e:
+ print "Error: No INTERACTIVE envp"
+
def doLock(self):
''' Generic locking, overide and extend in child class'''
self._locked = True
diff --git a/src/pk-backend-spawn.c b/src/pk-backend-spawn.c
index e419a5d..900854b 100644
--- a/src/pk-backend-spawn.c
+++ b/src/pk-backend-spawn.c
@@ -49,6 +49,7 @@
#include "pk-backend-spawn.h"
#include "pk-marshal.h"
#include "pk-spawn.h"
+#include "pk-shared.h"
#include "pk-time.h"
#include "pk-inhibit.h"
#include "pk-conf.h"
@@ -576,6 +577,7 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
gchar *uri;
GPtrArray *array;
gboolean ret;
+ PkHintEnum interactive;
array = g_ptr_array_new_with_free_func (g_free);
@@ -616,9 +618,17 @@ pk_backend_spawn_get_envp (PkBackendSpawn *backend_spawn)
egg_debug ("setting evp '%s'", line);
g_ptr_array_add (array, line);
- /* IDLE */
- ret = pk_backend_use_idle_bandwidth (backend_spawn->priv->backend);
- line = g_strdup_printf ("%s=%s", "IDLE", ret ? "TRUE" : "FALSE");
+ /* BACKGROUND */
+ ret = pk_backend_use_background (backend_spawn->priv->backend);
+ line = g_strdup_printf ("%s=%s", "BACKGROUND", ret ? "TRUE" : "FALSE");
+ egg_debug ("setting evp '%s'", line);
+ g_ptr_array_add (array, line);
+
+ /* INTERACTIVE */
+ g_object_get (backend_spawn->priv->backend,
+ "interactive", &interactive,
+ NULL);
+ line = g_strdup_printf ("%s=%s", "INTERACTIVE", interactive ? "TRUE" : "FALSE");
egg_debug ("setting evp '%s'", line);
g_ptr_array_add (array, line);
@@ -678,7 +688,7 @@ pk_backend_spawn_helper_va_list (PkBackendSpawn *backend_spawn, const gchar *exe
gchar *filename;
gchar **argv;
gchar **envp;
- PkTristate background;
+ PkHintEnum background;
#if PK_BUILD_LOCAL
const gchar *directory;
#endif
@@ -719,8 +729,12 @@ pk_backend_spawn_helper_va_list (PkBackendSpawn *backend_spawn, const gchar *exe
argv[0] = g_strdup (filename);
/* copy idle setting from backend to PkSpawn instance */
- g_object_get (backend_spawn->priv->backend, "background", &background, NULL);
- g_object_set (backend_spawn->priv->spawn, "background", (background == PK_TRISTATE_TRUE), NULL);
+ g_object_get (backend_spawn->priv->backend,
+ "background", &background,
+ NULL);
+ g_object_set (backend_spawn->priv->spawn,
+ "background", (background == PK_HINT_ENUM_TRUE),
+ NULL);
backend_spawn->priv->finished = FALSE;
envp = pk_backend_spawn_get_envp (backend_spawn);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index f5cfc2a..202caed 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -45,6 +45,7 @@
#include "pk-backend.h"
#include "pk-conf.h"
#include "pk-store.h"
+#include "pk-shared.h"
#include "pk-time.h"
#include "pk-file-monitor.h"
#include "pk-notify.h"
@@ -91,7 +92,6 @@ struct _PkBackendPrivate
gboolean use_time;
gchar *transaction_id;
gchar *locale;
- PkTristate background;
gchar *name;
gchar *proxy_ftp;
gchar *proxy_http;
@@ -108,7 +108,9 @@ struct _PkBackendPrivate
GThread *thread;
PkBackendDesc *desc;
PkBackendFileChanged file_changed_func;
- PkTristate allow_cancel;
+ PkHintEnum background;
+ PkHintEnum interactive;
+ PkHintEnum allow_cancel;
PkBitfield roles;
PkConf *conf;
PkExitEnum exit;
@@ -150,6 +152,7 @@ enum {
enum {
PROP_0,
PROP_BACKGROUND,
+ PROP_INTERACTIVE,
PROP_STATUS,
PROP_ROLE,
PROP_TRANSACTION_ID,
@@ -1829,7 +1832,7 @@ pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
}
/* same as last state? */
- if (backend->priv->allow_cancel == (PkTristate) allow_cancel) {
+ if (backend->priv->allow_cancel == (PkHintEnum) allow_cancel) {
egg_debug ("ignoring same allow-cancel state");
return FALSE;
}
@@ -1852,7 +1855,7 @@ pk_backend_get_allow_cancel (PkBackend *backend)
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* return FALSE if we never set state */
- if (backend->priv->allow_cancel != PK_TRISTATE_UNSET)
+ if (backend->priv->allow_cancel != PK_HINT_ENUM_UNSET)
allow_cancel = backend->priv->allow_cancel;
return allow_cancel;
@@ -2062,22 +2065,26 @@ pk_backend_is_online (PkBackend *backend)
}
/**
- * pk_backend_use_idle_bandwidth:
+ * pk_backend_use_background:
**/
gboolean
-pk_backend_use_idle_bandwidth (PkBackend *backend)
+pk_backend_use_background (PkBackend *backend)
{
gboolean ret;
+ /* we're watching the GUI, do as fast as possible */
+ if (backend->priv->interactive == PK_HINT_ENUM_TRUE)
+ return FALSE;
+
/* check we are allowed */
ret = pk_conf_get_bool (backend->priv->conf, "UseIdleBandwidth");
if (!ret)
return FALSE;
/* the session has set it one way or the other */
- if (backend->priv->background == PK_TRISTATE_TRUE)
+ if (backend->priv->background == PK_HINT_ENUM_TRUE)
return TRUE;
- if (backend->priv->background == PK_TRISTATE_FALSE)
+ if (backend->priv->background == PK_HINT_ENUM_FALSE)
return FALSE;
/* use a metric to try to guess a correct value */
@@ -2232,6 +2239,9 @@ pk_backend_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
case PROP_BACKGROUND:
g_value_set_uint (value, priv->background);
break;
+ case PROP_INTERACTIVE:
+ g_value_set_uint (value, priv->interactive);
+ break;
case PROP_STATUS:
g_value_set_uint (value, priv->status);
break;
@@ -2260,6 +2270,9 @@ pk_backend_set_property (GObject *object, guint prop_id, const GValue *value, GP
case PROP_BACKGROUND:
priv->background = g_value_get_uint (value);
break;
+ case PROP_INTERACTIVE:
+ priv->interactive = g_value_get_uint (value);
+ break;
case PROP_STATUS:
priv->status = g_value_get_uint (value);
break;
@@ -2322,11 +2335,19 @@ pk_backend_class_init (PkBackendClass *klass)
* PkBackend:background:
*/
pspec = g_param_spec_uint ("background", NULL, NULL,
- PK_TRISTATE_FALSE, PK_TRISTATE_UNSET, PK_TRISTATE_FALSE,
+ PK_HINT_ENUM_FALSE, PK_HINT_ENUM_UNSET, PK_HINT_ENUM_UNSET,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_BACKGROUND, pspec);
/**
+ * PkBackend:interactive:
+ */
+ pspec = g_param_spec_uint ("interactive", NULL, NULL,
+ PK_HINT_ENUM_FALSE, PK_HINT_ENUM_UNSET, PK_HINT_ENUM_UNSET,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (object_class, PROP_INTERACTIVE, pspec);
+
+ /**
* PkBackend:status:
*/
pspec = g_param_spec_uint ("status", NULL, NULL,
@@ -2485,7 +2506,7 @@ pk_backend_reset (PkBackend *backend)
backend->priv->download_files = 0;
backend->priv->thread = NULL;
backend->priv->last_package = NULL;
- backend->priv->allow_cancel = PK_TRISTATE_UNSET;
+ backend->priv->allow_cancel = PK_HINT_ENUM_UNSET;
backend->priv->status = PK_STATUS_ENUM_UNKNOWN;
backend->priv->exit = PK_EXIT_ENUM_UNKNOWN;
backend->priv->role = PK_ROLE_ENUM_UNKNOWN;
diff --git a/src/pk-backend.h b/src/pk-backend.h
index c6d14bd..b6a8e8c 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -196,7 +196,7 @@ typedef gboolean (*PkBackendThreadFunc) (PkBackend *backend);
gboolean pk_backend_thread_create (PkBackend *backend,
PkBackendThreadFunc func);
gboolean pk_backend_is_online (PkBackend *backend);
-gboolean pk_backend_use_idle_bandwidth (PkBackend *backend);
+gboolean pk_backend_use_background (PkBackend *backend);
/* config changed functions */
typedef void (*PkBackendFileChanged) (PkBackend *backend,
diff --git a/src/pk-shared.c b/src/pk-shared.c
index dd404ac..f41abec 100644
--- a/src/pk-shared.c
+++ b/src/pk-shared.c
@@ -82,3 +82,32 @@ out:
return ret;
}
+/**
+ * pk_hint_enum_to_text:
+ **/
+const gchar *
+pk_hint_enum_to_text (PkHintEnum hint)
+{
+ if (hint == PK_HINT_ENUM_FALSE)
+ return "false";
+ if (hint == PK_HINT_ENUM_TRUE)
+ return "true";
+ if (hint == PK_HINT_ENUM_UNSET)
+ return "unset";
+ return NULL;
+}
+
+/**
+ * pk_hint_enum_from_text:
+ **/
+PkHintEnum
+pk_hint_enum_from_text (const gchar *hint)
+{
+ if (g_strcmp0 (hint, "false") == 0)
+ return PK_HINT_ENUM_FALSE;
+ if (g_strcmp0 (hint, "true") == 0)
+ return PK_HINT_ENUM_TRUE;
+ if (g_strcmp0 (hint, "unset") == 0)
+ return PK_HINT_ENUM_UNSET;
+ return PK_HINT_ENUM_UNSET;
+}
diff --git a/src/pk-shared.h b/src/pk-shared.h
index 7f867e9..7e8d202 100644
--- a/src/pk-shared.h
+++ b/src/pk-shared.h
@@ -26,7 +26,18 @@
G_BEGIN_DECLS
+/* a boolean with unset */
+typedef enum {
+ PK_HINT_ENUM_FALSE = FALSE,
+ PK_HINT_ENUM_TRUE = TRUE,
+ PK_HINT_ENUM_UNSET,
+ PK_HINT_ENUM_INVALID,
+ PK_HINT_ENUM_LAST
+} PkHintEnum;
+
gboolean pk_directory_remove_contents (const gchar *directory);
+const gchar *pk_hint_enum_to_text (PkHintEnum hint);
+PkHintEnum pk_hint_enum_from_text (const gchar *hint);
G_END_DECLS
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index bb30331..7df5113 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -100,7 +100,8 @@ struct PkTransactionPrivate
gboolean emit_signature_required;
gboolean emit_media_change_required;
gboolean caller_active;
- PkTristate background;
+ PkHintEnum background;
+ PkHintEnum interactive;
gchar *locale;
guint uid;
EggDbusMonitor *monitor;
@@ -1601,6 +1602,7 @@ pk_transaction_set_running (PkTransaction *transaction)
GError *error = NULL;
PkBitfield filters;
PkTransactionPrivate *priv = PK_TRANSACTION_GET_PRIVATE (transaction);
+
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
@@ -1610,6 +1612,7 @@ pk_transaction_set_running (PkTransaction *transaction)
/* assign */
g_object_set (priv->backend,
"background", priv->background,
+ "interactive", priv->interactive,
"transaction-id", priv->tid,
NULL);
@@ -1908,8 +1911,8 @@ pk_transaction_commit (PkTransaction *transaction)
g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
/* set the idle really early as this affects scheduling */
- if (transaction->priv->background == PK_TRISTATE_TRUE ||
- transaction->priv->background == PK_TRISTATE_FALSE) {
+ if (transaction->priv->background == PK_HINT_ENUM_TRUE ||
+ transaction->priv->background == PK_HINT_ENUM_FALSE) {
pk_transaction_list_set_background (transaction->priv->transaction_list,
transaction->priv->tid,
transaction->priv->background);
@@ -4500,44 +4503,48 @@ static gboolean
pk_transaction_set_hint (PkTransaction *transaction, const gchar *key, const gchar *value, GError **error)
{
gboolean ret = TRUE;
+ PkTransactionPrivate *priv = transaction->priv;
/* locale=en_GB.utf8 */
if (g_strcmp0 (key, "locale") == 0) {
/* already set */
- if (transaction->priv->locale != NULL) {
+ if (priv->locale != NULL) {
*error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "Already set locale to %s", transaction->priv->locale);
+ "Already set locale to %s", priv->locale);
ret = FALSE;
goto out;
}
/* success */
- transaction->priv->locale = g_strdup (value);
+ priv->locale = g_strdup (value);
goto out;
}
- /* idle=true */
+ /* background=true */
if (g_strcmp0 (key, "background") == 0) {
-
- /* idle true */
- if (g_strcmp0 (value, "true") == 0) {
- transaction->priv->background = PK_TRISTATE_TRUE;
- goto out;
+ priv->background = pk_hint_enum_from_text (value);
+ if (priv->background == PK_HINT_ENUM_INVALID) {
+ priv->background = PK_HINT_ENUM_UNSET;
+ *error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+ "background hint expects true or false, not %s", value);
+ ret = FALSE;
}
+ goto out;
+ }
- /* idle false */
- if (g_strcmp0 (value, "false") == 0) {
- transaction->priv->background = PK_TRISTATE_FALSE;
- goto out;
+ /* interactive=true */
+ if (g_strcmp0 (key, "interactive") == 0) {
+ priv->interactive = pk_hint_enum_from_text (value);
+ if (priv->interactive == PK_HINT_ENUM_INVALID) {
+ priv->interactive = PK_HINT_ENUM_UNSET;
+ *error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+ "interactive hint expects true or false, not %s", value);
+ ret = FALSE;
}
-
- /* nothing recognised */
- *error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
- "idle hint expects true or false, not %s", value);
- ret = FALSE;
goto out;
}
+
/* to preserve forwards and backwards compatibility, we ignore extra options here */
egg_warning ("unknown option: %s with value %s", key, value);
out:
@@ -5442,7 +5449,7 @@ pk_transaction_init (PkTransaction *transaction)
transaction->priv->status = PK_STATUS_ENUM_WAIT;
transaction->priv->percentage = PK_BACKEND_PERCENTAGE_INVALID;
transaction->priv->subpercentage = PK_BACKEND_PERCENTAGE_INVALID;
- transaction->priv->background = PK_TRISTATE_UNSET;
+ transaction->priv->background = PK_HINT_ENUM_UNSET;
transaction->priv->elapsed_time = 0;
transaction->priv->remaining_time = 0;
transaction->priv->backend = pk_backend_new ();
commit 23db0214ffa5ea07e0e45b9c4f31cb879e57f827
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jan 6 15:53:03 2010 +0000
bugfix: Ensure we enter SETUP before we run the pre-transaction checks
This fixes a warning from the daemon and the random 'Waiting in queue..' message from cnf.
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 029acfd..bb30331 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1632,6 +1632,10 @@ pk_transaction_set_running (PkTransaction *transaction)
g_error_free (error);
}
+ /* we are no longer waiting, we are setting up */
+ pk_backend_set_status (priv->backend, PK_STATUS_ENUM_SETUP);
+ pk_transaction_status_changed_emit (transaction, PK_STATUS_ENUM_SETUP);
+
/* do any pre transaction checks */
ret = pk_transaction_pre_transaction_checks (transaction, priv->cached_package_ids, &error);
if (!ret) {
@@ -1711,8 +1715,7 @@ pk_transaction_set_running (PkTransaction *transaction)
transaction->priv->has_been_run = TRUE;
transaction->priv->allow_cancel = FALSE;
- /* we are no longer waiting, we are setting up */
- pk_backend_set_status (priv->backend, PK_STATUS_ENUM_SETUP);
+ /* reset after the pre-transaction checks */
pk_backend_set_percentage (priv->backend, PK_BACKEND_PERCENTAGE_INVALID);
/* do the correct action with the cached parameters */
commit a063ce8a90f5585eefc7982c69396e57c21f1f56
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jan 5 09:50:46 2010 +0000
yum: include PackageKit in the list of essential packages
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 6b09bca..3c6f73c 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2162,7 +2162,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
else:
for txmbr in self.yumbase.tsInfo:
pkg = txmbr.po
- system_packages = ['yum','rpm', 'glibc']
+ system_packages = ['yum','rpm','glibc','PackageKit']
if pkg.name in system_packages:
self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE, "The package %s is essential to correct operation and cannot be removed using this tool." % pkg.name, exit=False)
return
commit aa7a41e1e9bde3848885c07c9feb59325c229743
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jan 5 09:49:38 2010 +0000
yum: show a message to the user if the repo could not be reached. Fixes rh#531838
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 1c53b98..6b09bca 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2787,6 +2787,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
repo.repoXML
except yum.Errors.RepoError, e:
self.yumbase.repos.disableRepo(repo.id)
+ self.message(MESSAGE_REPO_METADATA_DOWNLOAD_FAILED, "Could not contact source '%s', so it will be disabled" % repo.id)
# should we suggest yum-complete-transaction?
unfinished = yum.misc.find_unfinished_transactions(yumlibpath=self.yumbase.conf.persistdir)
commit e589dee9c9dea85530f5c9c702b482a2c2efd67e
Author: Matthias Clasen <mclasen at redhat.com>
Date: Tue Jan 5 09:31:25 2010 +0000
Fix a trivial translation typo
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/po/de.po b/po/de.po
index 169ed88..3453dea 100644
--- a/po/de.po
+++ b/po/de.po
@@ -1952,7 +1952,7 @@ msgstr ""
#. TRANSLATORS: is not GPG signed
#: ../src/pk-polkit-action-lookup.c:171 ../src/pk-polkit-action-lookup.c:190
msgid "The software is not from a trusted source."
-msgstr "Sie Software stammt nicht aus einer vertrauenswürdigen Quelle."
+msgstr "Die Software stammt nicht aus einer vertrauenswürdigen Quelle."
#: ../src/pk-polkit-action-lookup.c:176
msgid "Do not update this package unless you are sure it is safe to do so."
commit d353f63653d4c1ccf91c55e30e5257cce321ea29
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Jan 4 16:49:34 2010 +0000
trivial: post release version bump
diff --git a/RELEASE b/RELEASE
index ea62cd7..4d632d9 100644
--- a/RELEASE
+++ b/RELEASE
@@ -26,8 +26,8 @@ Bugfixes:
4. Commit changes in PackageKit git:
-git commit -a -m "Release version 0.6.0"
-git tag -a -f -m "Release 0.6.0" PACKAGEKIT_0_6_0
+git commit -a -m "Release version 0.6.1"
+git tag -a -f -m "Release 0.6.1" PACKAGEKIT_0_6_1
git push --tags
git push
git push git+ssh://hughsient@git.freedesktop.org/git/packagekit
diff --git a/configure.ac b/configure.ac
index d30741c..76690c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ AC_PREREQ(2.52)
m4_define([pk_major_version], [0])
m4_define([pk_minor_version], [6])
-m4_define([pk_micro_version], [0])
+m4_define([pk_micro_version], [1])
m4_define([pk_version],
[pk_major_version.pk_minor_version.pk_micro_version])
More information about the PackageKit-commit
mailing list