166 lines
5.2 KiB
Diff
166 lines
5.2 KiB
Diff
commit 09c9cde8c0cfec3a5f4320ec10bf2e1b0f9b460f
|
|
Author: Richard Hughes <richard@hughsie.com>
|
|
Date: Thu Jan 23 13:46:49 2014 +0000
|
|
|
|
hawkey: Fix installing i386 packages on a 64bit computer
|
|
|
|
diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
|
|
index f2ee746..b069396 100644
|
|
--- a/backends/hawkey/pk-backend-hawkey.c
|
|
+++ b/backends/hawkey/pk-backend-hawkey.c
|
|
@@ -3196,10 +3196,12 @@ out:
|
|
}
|
|
|
|
/**
|
|
- * hif_is_installed_package_name:
|
|
+ * hif_is_installed_package_name_arch:
|
|
*/
|
|
static gboolean
|
|
-hif_is_installed_package_name (HySack sack, const gchar *name)
|
|
+hif_is_installed_package_name_arch (HySack sack,
|
|
+ const gchar *name,
|
|
+ const gchar *arch)
|
|
{
|
|
gboolean ret;
|
|
HyPackageList pkglist = NULL;
|
|
@@ -3208,6 +3210,7 @@ hif_is_installed_package_name (HySack sack, const gchar *name)
|
|
/* run query */
|
|
query = hy_query_create (sack);
|
|
hy_query_filter (query, HY_PKG_NAME, HY_EQ, name);
|
|
+ hy_query_filter (query, HY_PKG_ARCH, HY_EQ, arch);
|
|
hy_query_filter (query, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME);
|
|
pkglist = hy_query_run (query);
|
|
|
|
@@ -3228,7 +3231,9 @@ hif_is_installed_package_id (HySack sack, const gchar *package_id)
|
|
gboolean ret;
|
|
gchar **split;
|
|
split = pk_package_id_split (package_id);
|
|
- ret = hif_is_installed_package_name (sack, split[PK_PACKAGE_ID_NAME]);
|
|
+ ret = hif_is_installed_package_name_arch (sack,
|
|
+ split[PK_PACKAGE_ID_NAME],
|
|
+ split[PK_PACKAGE_ID_ARCH]);
|
|
g_strfreev (split);
|
|
return ret;
|
|
}
|
|
commit 5776000231f81f7d0d764038a9957439c35a7a5d
|
|
Author: Richard Hughes <richard@hughsie.com>
|
|
Date: Thu Jan 23 14:25:55 2014 +0000
|
|
|
|
hawkey: Release locks early if the state fails
|
|
|
|
diff --git a/backends/hawkey/hif-lock.c b/backends/hawkey/hif-lock.c
|
|
index 97066f4..a644330 100644
|
|
--- a/backends/hawkey/hif-lock.c
|
|
+++ b/backends/hawkey/hif-lock.c
|
|
@@ -91,6 +91,19 @@ hif_lock_type_to_string (HifLockType lock_type)
|
|
}
|
|
|
|
/**
|
|
+ * hif_lock_mode_to_string:
|
|
+ **/
|
|
+static const gchar *
|
|
+hif_lock_mode_to_string (HifLockMode lock_mode)
|
|
+{
|
|
+ if (lock_mode == HIF_LOCK_MODE_THREAD)
|
|
+ return "thread";
|
|
+ if (lock_mode == HIF_LOCK_MODE_PROCESS)
|
|
+ return "process";
|
|
+ return "unknown";
|
|
+}
|
|
+
|
|
+/**
|
|
* hif_lock_get_item_by_type_mode:
|
|
**/
|
|
static HifLockItem *
|
|
@@ -337,7 +350,9 @@ hif_lock_take (HifLock *lock,
|
|
g_set_error (error,
|
|
HIF_ERROR,
|
|
PK_ERROR_ENUM_CANNOT_GET_LOCK,
|
|
- "already locked by %s",
|
|
+ "%s[%s] already locked by %s",
|
|
+ hif_lock_type_to_string (type),
|
|
+ hif_lock_mode_to_string (mode),
|
|
cmdline);
|
|
goto out;
|
|
}
|
|
@@ -520,7 +535,7 @@ hif_lock_finalize (GObject *object)
|
|
if (item->refcount > 0) {
|
|
g_warning ("held lock %s at shutdown",
|
|
hif_lock_type_to_string (item->type));
|
|
- hif_lock_release (lock, item->type, NULL);
|
|
+ hif_lock_release (lock, item->id, NULL);
|
|
}
|
|
}
|
|
|
|
diff --git a/backends/hawkey/hif-source.c b/backends/hawkey/hif-source.c
|
|
index b79f525..fffcc31 100644
|
|
--- a/backends/hawkey/hif-source.c
|
|
+++ b/backends/hawkey/hif-source.c
|
|
@@ -695,6 +695,7 @@ hif_source_update (HifSource *src,
|
|
if (!ret)
|
|
goto out;
|
|
out:
|
|
+ hif_state_release_locks (state);
|
|
lr_handle_setopt (src->repo_handle, NULL, LRO_PROGRESSCB, NULL);
|
|
lr_handle_setopt (src->repo_handle, NULL, LRO_PROGRESSDATA, 0xdeadbeef);
|
|
return ret;
|
|
diff --git a/backends/hawkey/hif-state.c b/backends/hawkey/hif-state.c
|
|
index 6cd706f..fc6753c 100644
|
|
--- a/backends/hawkey/hif-state.c
|
|
+++ b/backends/hawkey/hif-state.c
|
|
@@ -273,13 +273,17 @@ hif_state_set_speed (HifState *state, guint64 speed)
|
|
/**
|
|
* hif_state_release_locks:
|
|
**/
|
|
-static gboolean
|
|
+gboolean
|
|
hif_state_release_locks (HifState *state)
|
|
{
|
|
gboolean ret = TRUE;
|
|
guint i;
|
|
guint lock_id;
|
|
|
|
+ /* release children first */
|
|
+ if (state->priv->child != NULL)
|
|
+ hif_state_release_locks (state->priv->child);
|
|
+
|
|
/* release each one */
|
|
for (i = 0; i < state->priv->lock_ids->len; i++) {
|
|
lock_id = GPOINTER_TO_UINT (g_ptr_array_index (state->priv->lock_ids, i));
|
|
diff --git a/backends/hawkey/hif-state.h b/backends/hawkey/hif-state.h
|
|
index ffd42e9..b7b26f4 100644
|
|
--- a/backends/hawkey/hif-state.h
|
|
+++ b/backends/hawkey/hif-state.h
|
|
@@ -131,6 +131,7 @@ gboolean hif_state_take_lock (HifState *state,
|
|
HifLockType lock_type,
|
|
HifLockMode lock_mode,
|
|
GError **error);
|
|
+gboolean hif_state_release_locks (HifState *state);
|
|
|
|
G_END_DECLS
|
|
|
|
diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
|
|
index b069396..40831b9 100644
|
|
--- a/backends/hawkey/pk-backend-hawkey.c
|
|
+++ b/backends/hawkey/pk-backend-hawkey.c
|
|
@@ -521,8 +521,10 @@ pk_backend_stop_job (PkBackend *backend, PkBackendJob *job)
|
|
PkBackendHifJobData *job_data = pk_backend_job_get_user_data (job);
|
|
|
|
g_object_unref (job_data->cancellable);
|
|
- if (job_data->state != NULL)
|
|
+ if (job_data->state != NULL) {
|
|
+ hif_state_release_locks (job_data->state);
|
|
g_object_unref (job_data->state);
|
|
+ }
|
|
if (job_data->sources != NULL)
|
|
g_ptr_array_unref (job_data->sources);
|
|
g_ptr_array_unref (job_data->packages_to_download);
|
|
@@ -2954,6 +2956,7 @@ pk_backend_transaction_commit (PkBackendJob *job, HifState *state, GError **erro
|
|
if (!ret)
|
|
goto out;
|
|
out:
|
|
+ hif_state_release_locks (state);
|
|
g_free (verbosity_string);
|
|
if (commit != NULL) {
|
|
g_timer_destroy (commit->timer);
|