Bjørn Lie
d4fe6a0bd3
- Add PackageKit-zypp-add-upgrade-system.patch: implement upgrade-system method(gh#hughsie/PackageKit/commit/930dd201b). OBS-URL: https://build.opensuse.org/request/show/986127 OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/PackageKit?expand=0&rev=432
73 lines
2.0 KiB
Diff
73 lines
2.0 KiB
Diff
From 74da50015b14f3465042aa7280a8e7721a825540 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Kang <jonathankang@gnome.org>
|
|
Date: Wed, 4 Aug 2021 14:32:22 +0800
|
|
Subject: [PATCH] zypp: implement upgrade-system method
|
|
|
|
---
|
|
backends/zypp/pk-backend-zypp.cpp | 49 +++++++++++++++++++++++++++++++
|
|
1 file changed, 49 insertions(+)
|
|
|
|
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
|
|
index 6da70348b..49251297d 100644
|
|
--- a/backends/zypp/pk-backend-zypp.cpp
|
|
+++ b/backends/zypp/pk-backend-zypp.cpp
|
|
@@ -3528,6 +3528,55 @@ pk_backend_update_packages (PkBackend *backend, PkBackendJob *job, PkBitfield tr
|
|
pk_backend_job_thread_create (job, backend_update_packages_thread, NULL, NULL);
|
|
}
|
|
|
|
+static void
|
|
+pk_backend_upgrade_system_thread (PkBackendJob *job,
|
|
+ GVariant *params,
|
|
+ gpointer user_data)
|
|
+{
|
|
+ const gchar *release_ver = NULL;
|
|
+ PkBitfield transaction_flags = 0;
|
|
+
|
|
+ g_variant_get (params, "(t&su)",
|
|
+ &transaction_flags,
|
|
+ &release_ver, NULL);
|
|
+
|
|
+ ZyppJob zjob(job);
|
|
+ ZYpp::Ptr zypp = zjob.get_zypp ();
|
|
+ if (zypp == NULL) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (is_tumbleweed ()) {
|
|
+ pk_backend_job_error_code (job, PK_ERROR_ENUM_NOT_SUPPORTED,
|
|
+ "upgrade-system is not supported in Tumbleweed, use \"pkcon update\" instead.");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ ResPool pool = zypp_build_pool (zypp, TRUE);
|
|
+ PkRestartEnum restart = PK_RESTART_ENUM_NONE;
|
|
+ PoolStatusSaver saver;
|
|
+
|
|
+ /* Set environment variable ZYPP_REPO_RELEASEVER to target version. */
|
|
+ g_setenv ("ZYPP_REPO_RELEASEVER", release_ver, TRUE);
|
|
+
|
|
+ upgrade_system (job, zypp, transaction_flags);
|
|
+
|
|
+ g_unsetenv ("ZYPP_REPO_RELEASEVER");
|
|
+}
|
|
+
|
|
+/**
|
|
+ * pk_backend_upgrade_system
|
|
+ */
|
|
+void
|
|
+pk_backend_upgrade_system (PkBackend *backend,
|
|
+ PkBackendJob *job,
|
|
+ PkBitfield transaction_flags,
|
|
+ const gchar *distro_id,
|
|
+ PkUpgradeKindEnum upgrade_kind)
|
|
+{
|
|
+ pk_backend_job_thread_create (job, pk_backend_upgrade_system_thread, NULL, NULL);
|
|
+}
|
|
+
|
|
static void
|
|
backend_repo_set_data_thread (PkBackendJob *job, GVariant *params, gpointer user_data)
|
|
{
|
|
--
|
|
2.31.1
|
|
|