633 lines
21 KiB
Diff
633 lines
21 KiB
Diff
From 0b076deaa3c98730c608611a5f68d1f4d83eaaed Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <klember@redhat.com>
|
|
Date: Wed, 7 Mar 2018 14:09:00 +0100
|
|
Subject: [PATCH 1/5] dnf: trivial: Don't call lr_global_init
|
|
|
|
libdnf does this automatically for us.
|
|
---
|
|
backends/dnf/pk-backend-dnf.c | 2 --
|
|
1 file changed, 2 deletions(-)
|
|
|
|
diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c
|
|
index eb05801bbafd..9b0718e941e3 100644
|
|
--- a/backends/dnf/pk-backend-dnf.c
|
|
+++ b/backends/dnf/pk-backend-dnf.c
|
|
@@ -306,8 +306,6 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
priv->repos_timer = g_timer_new ();
|
|
g_signal_connect (dnf_context_get_repo_loader (priv->context), "changed",
|
|
G_CALLBACK (pk_backend_yum_repos_changed_cb), backend);
|
|
-
|
|
- lr_global_init ();
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.16.2
|
|
|
|
|
|
From 3aa8a7ca9aa354f28f67e3efe5fd73400ead6400 Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <klember@redhat.com>
|
|
Date: Wed, 7 Mar 2018 14:23:06 +0100
|
|
Subject: [PATCH 2/5] dnf: trivial: Call libdnf "libdnf", not "Dnf"
|
|
|
|
---
|
|
backends/dnf/pk-backend-dnf.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c
|
|
index 9b0718e941e3..d455b6cd686b 100644
|
|
--- a/backends/dnf/pk-backend-dnf.c
|
|
+++ b/backends/dnf/pk-backend-dnf.c
|
|
@@ -265,7 +265,7 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
pk_backend_set_user_data (backend, priv);
|
|
priv->conf = g_key_file_ref (conf);
|
|
|
|
- g_debug ("Using Dnf %i.%i.%i",
|
|
+ g_debug ("Using libdnf %i.%i.%i",
|
|
LIBDNF_MAJOR_VERSION,
|
|
LIBDNF_MINOR_VERSION,
|
|
LIBDNF_MICRO_VERSION);
|
|
--
|
|
2.16.2
|
|
|
|
|
|
From 8f6a152f220233eff9d17a7af5b0d18dc2102263 Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <klember@redhat.com>
|
|
Date: Wed, 7 Mar 2018 14:24:20 +0100
|
|
Subject: [PATCH 3/5] dnf: trivial: Store release_ver in priv struct
|
|
|
|
---
|
|
backends/dnf/pk-backend-dnf.c | 9 +++++----
|
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c
|
|
index d455b6cd686b..7c2579ab4511 100644
|
|
--- a/backends/dnf/pk-backend-dnf.c
|
|
+++ b/backends/dnf/pk-backend-dnf.c
|
|
@@ -57,6 +57,7 @@ typedef struct {
|
|
GHashTable *sack_cache; /* of DnfSackCacheItem */
|
|
GMutex sack_mutex;
|
|
GTimer *repos_timer;
|
|
+ gchar *release_ver;
|
|
} PkBackendDnfPrivate;
|
|
|
|
typedef struct {
|
|
@@ -254,7 +255,6 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
gboolean ret;
|
|
PkBackendDnfPrivate *priv;
|
|
g_autoptr(GError) error = NULL;
|
|
- g_autofree gchar *release_ver = NULL;
|
|
|
|
/* use logging */
|
|
pk_debug_add_log_domain (G_LOG_DOMAIN);
|
|
@@ -274,12 +274,12 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
LR_VERSION_MINOR,
|
|
LR_VERSION_PATCH);
|
|
|
|
- release_ver = pk_get_distro_version_id (&error);
|
|
- if (release_ver == NULL)
|
|
+ priv->release_ver = pk_get_distro_version_id (&error);
|
|
+ if (priv->release_ver == NULL)
|
|
g_error ("Failed to parse os-release: %s", error->message);
|
|
|
|
/* clean up any cache directories left over from a distro upgrade */
|
|
- remove_old_cache_directories (backend, release_ver);
|
|
+ remove_old_cache_directories (backend, priv->release_ver);
|
|
|
|
/* a cache of DnfSacks with the key being which sacks are loaded
|
|
*
|
|
@@ -322,6 +322,7 @@ pk_backend_destroy (PkBackend *backend)
|
|
g_timer_destroy (priv->repos_timer);
|
|
g_mutex_clear (&priv->sack_mutex);
|
|
g_hash_table_unref (priv->sack_cache);
|
|
+ g_free (priv->release_ver);
|
|
g_free (priv);
|
|
}
|
|
|
|
--
|
|
2.16.2
|
|
|
|
|
|
From 1e2452712c690d7b9d5a65ddef81fb98a1296e7a Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <klember@redhat.com>
|
|
Date: Wed, 7 Mar 2018 14:27:45 +0100
|
|
Subject: [PATCH 4/5] dnf: trivial: Break out
|
|
pk_backend_ensure_default_dnf_context
|
|
|
|
... so that we can use it in the next commit.
|
|
---
|
|
backends/dnf/pk-backend-dnf.c | 42 ++++++++++++++++++++++++++++++------------
|
|
1 file changed, 30 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c
|
|
index 7c2579ab4511..3c09f84bac8f 100644
|
|
--- a/backends/dnf/pk-backend-dnf.c
|
|
+++ b/backends/dnf/pk-backend-dnf.c
|
|
@@ -246,13 +246,40 @@ remove_old_cache_directories (PkBackend *backend, const gchar *release_ver_str)
|
|
}
|
|
}
|
|
|
|
+static gboolean
|
|
+pk_backend_ensure_default_dnf_context (PkBackend *backend, GError **error)
|
|
+{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(DnfContext) context = NULL;
|
|
+
|
|
+ /* already set */
|
|
+ if (priv->context != NULL)
|
|
+ return TRUE;
|
|
+
|
|
+ g_assert (priv->conf != NULL);
|
|
+ g_assert (priv->release_ver != NULL);
|
|
+
|
|
+ /* set defaults */
|
|
+ context = dnf_context_new ();
|
|
+ if (!pk_backend_setup_dnf_context (context, priv->conf, priv->release_ver, error))
|
|
+ return FALSE;
|
|
+
|
|
+ /* setup succeeded: store in priv and connect signals */
|
|
+ priv->context = g_steal_pointer (&context);
|
|
+ g_signal_connect (priv->context, "invalidate",
|
|
+ G_CALLBACK (pk_backend_context_invalidate_cb), backend);
|
|
+ g_signal_connect (dnf_context_get_repo_loader (priv->context), "changed",
|
|
+ G_CALLBACK (pk_backend_yum_repos_changed_cb), backend);
|
|
+
|
|
+ return TRUE;
|
|
+}
|
|
+
|
|
/**
|
|
* pk_backend_initialize:
|
|
*/
|
|
void
|
|
pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
{
|
|
- gboolean ret;
|
|
PkBackendDnfPrivate *priv;
|
|
g_autoptr(GError) error = NULL;
|
|
|
|
@@ -264,6 +291,7 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
priv = g_new0 (PkBackendDnfPrivate, 1);
|
|
pk_backend_set_user_data (backend, priv);
|
|
priv->conf = g_key_file_ref (conf);
|
|
+ priv->repos_timer = g_timer_new ();
|
|
|
|
g_debug ("Using libdnf %i.%i.%i",
|
|
LIBDNF_MAJOR_VERSION,
|
|
@@ -294,18 +322,8 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
g_free,
|
|
(GDestroyNotify) dnf_sack_cache_item_free);
|
|
|
|
- /* set defaults */
|
|
- priv->context = dnf_context_new ();
|
|
- g_signal_connect (priv->context, "invalidate",
|
|
- G_CALLBACK (pk_backend_context_invalidate_cb), backend);
|
|
- ret = pk_backend_setup_dnf_context (priv->context, conf, release_ver, &error);
|
|
- if (!ret)
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error))
|
|
g_error ("failed to setup context: %s", error->message);
|
|
-
|
|
- /* use context's repository loaders */
|
|
- priv->repos_timer = g_timer_new ();
|
|
- g_signal_connect (dnf_context_get_repo_loader (priv->context), "changed",
|
|
- G_CALLBACK (pk_backend_yum_repos_changed_cb), backend);
|
|
}
|
|
|
|
/**
|
|
--
|
|
2.16.2
|
|
|
|
|
|
From 2f1c4b820b056efc989be0f9101da604aa532bc0 Mon Sep 17 00:00:00 2001
|
|
From: Kalev Lember <klember@redhat.com>
|
|
Date: Wed, 7 Mar 2018 14:41:59 +0100
|
|
Subject: [PATCH 5/5] dnf: Don't abort() when failing to set up context
|
|
|
|
If we abort() in init, then there's no way to report the error to
|
|
gnome-software.
|
|
|
|
Instead, log a warning when failing to set up context in init, and keep
|
|
going. Later, when one of the vfuncs is invoked and we have no context,
|
|
try setting it up again -- at this point, if it fails, we're able to
|
|
return the error message to gnome-software, so it can show it to the
|
|
user.
|
|
---
|
|
backends/dnf/pk-backend-dnf.c | 221 +++++++++++++++++++++++++++++++++++++++++-
|
|
1 file changed, 217 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c
|
|
index 3c09f84bac8f..d997dee67c7d 100644
|
|
--- a/backends/dnf/pk-backend-dnf.c
|
|
+++ b/backends/dnf/pk-backend-dnf.c
|
|
@@ -323,7 +323,7 @@ pk_backend_initialize (GKeyFile *conf, PkBackend *backend)
|
|
(GDestroyNotify) dnf_sack_cache_item_free);
|
|
|
|
if (!pk_backend_ensure_default_dnf_context (backend, &error))
|
|
- g_error ("failed to setup context: %s", error->message);
|
|
+ g_warning ("failed to setup context: %s", error->message);
|
|
}
|
|
|
|
/**
|
|
@@ -479,7 +479,6 @@ pk_backend_job_set_context (PkBackendJob *job, DnfContext *context)
|
|
void
|
|
pk_backend_start_job (PkBackend *backend, PkBackendJob *job)
|
|
{
|
|
- PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
PkBackendDnfJobData *job_data;
|
|
job_data = g_new0 (PkBackendDnfJobData, 1);
|
|
job_data->backend = backend;
|
|
@@ -502,8 +501,6 @@ pk_backend_start_job (PkBackend *backend, PkBackendJob *job)
|
|
G_CALLBACK (pk_backend_speed_changed_cb),
|
|
job);
|
|
|
|
- pk_backend_job_set_context (job, priv->context);
|
|
-
|
|
#ifdef PK_BUILD_LOCAL
|
|
/* we don't want to enable this for normal runtime */
|
|
dnf_state_set_enable_profile (job_data->state, TRUE);
|
|
@@ -1145,6 +1142,15 @@ pk_backend_get_packages (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
PkBitfield filters)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1157,6 +1163,15 @@ pk_backend_resolve (PkBackend *backend,
|
|
PkBitfield filters,
|
|
gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1169,6 +1184,15 @@ pk_backend_search_names (PkBackend *backend,
|
|
PkBitfield filters,
|
|
gchar **values)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1181,6 +1205,15 @@ pk_backend_search_details (PkBackend *backend,
|
|
PkBitfield filters,
|
|
gchar **values)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1193,6 +1226,15 @@ pk_backend_search_files (PkBackend *backend,
|
|
PkBitfield filters,
|
|
gchar **values)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1205,6 +1247,15 @@ pk_backend_what_provides (PkBackend *backend,
|
|
PkBitfield filters,
|
|
gchar **values)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1216,6 +1267,15 @@ pk_backend_get_updates (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
PkBitfield filters)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_search_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1328,6 +1388,15 @@ pk_backend_get_repo_list (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
PkBitfield filters)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_get_repo_list_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1444,6 +1513,15 @@ pk_backend_repo_set_data (PkBackend *backend,
|
|
const gchar *parameter,
|
|
const gchar *value)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_repo_set_data_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1456,6 +1534,15 @@ pk_backend_repo_enable (PkBackend *backend,
|
|
const gchar *repo_id,
|
|
gboolean enabled)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_repo_set_data_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1713,6 +1800,15 @@ pk_backend_refresh_cache (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
gboolean force)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_refresh_cache_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1882,6 +1978,15 @@ backend_get_details_thread (PkBackendJob *job, GVariant *params, gpointer user_d
|
|
void
|
|
pk_backend_get_details (PkBackend *backend, PkBackendJob *job, gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, backend_get_details_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -1968,6 +2073,15 @@ backend_get_details_local_thread (PkBackendJob *job, GVariant *params, gpointer
|
|
void
|
|
pk_backend_get_details_local (PkBackend *backend, PkBackendJob *job, gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, backend_get_details_local_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -2050,6 +2164,15 @@ backend_get_files_local_thread (PkBackendJob *job, GVariant *params, gpointer us
|
|
void
|
|
pk_backend_get_files_local (PkBackend *backend, PkBackendJob *job, gchar **files)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, backend_get_files_local_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -2203,6 +2326,15 @@ pk_backend_download_packages (PkBackend *backend,
|
|
gchar **package_ids,
|
|
const gchar *directory)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_download_packages_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -2664,6 +2796,15 @@ pk_backend_repo_remove (PkBackend *backend,
|
|
const gchar *repo_id,
|
|
gboolean autoremove)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_repo_remove_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -2841,6 +2982,15 @@ pk_backend_remove_packages (PkBackend *backend, PkBackendJob *job,
|
|
gboolean allow_deps,
|
|
gboolean autoremove)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_remove_packages_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3031,6 +3181,15 @@ pk_backend_install_packages (PkBackend *backend, PkBackendJob *job,
|
|
PkBitfield transaction_flags,
|
|
gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_install_packages_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3140,6 +3299,15 @@ pk_backend_install_files (PkBackend *backend, PkBackendJob *job,
|
|
PkBitfield transaction_flags,
|
|
gchar **full_paths)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_install_files_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3251,6 +3419,15 @@ void
|
|
pk_backend_update_packages (PkBackend *backend, PkBackendJob *job,
|
|
PkBitfield transaction_flags, gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_update_packages_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3352,6 +3529,15 @@ pk_backend_upgrade_system (PkBackend *backend,
|
|
const gchar *distro_id,
|
|
PkUpgradeKindEnum upgrade_kind)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_upgrade_system_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3502,6 +3688,15 @@ pk_backend_get_files (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_get_files_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3645,6 +3840,15 @@ pk_backend_get_update_detail (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
gchar **package_ids)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_get_update_detail_thread, NULL, NULL);
|
|
}
|
|
|
|
@@ -3715,5 +3919,14 @@ pk_backend_repair_system (PkBackend *backend,
|
|
PkBackendJob *job,
|
|
PkBitfield transaction_flags)
|
|
{
|
|
+ PkBackendDnfPrivate *priv = pk_backend_get_user_data (backend);
|
|
+ g_autoptr(GError) error = NULL;
|
|
+
|
|
+ if (!pk_backend_ensure_default_dnf_context (backend, &error)) {
|
|
+ pk_backend_job_error_code (job, error->code, "%s", error->message);
|
|
+ pk_backend_job_finished (job);
|
|
+ return;
|
|
+ }
|
|
+ pk_backend_job_set_context (job, priv->context);
|
|
pk_backend_job_thread_create (job, pk_backend_repair_system_thread, NULL, NULL);
|
|
}
|
|
--
|
|
2.16.2
|
|
|