[PackageKit] Fix several reported problems with the offline-update funtionality.

Richard Hughes rhughes at fedoraproject.org
Mon Jul 9 12:52:15 UTC 2012


commit ce93e7da5398de5b0d16e6612bfbb57b7c12f699
Author: Richard Hughes <richard at hughsie.com>
Date:   Mon Jul 9 13:50:29 2012 +0100

    Fix several reported problems with the offline-update funtionality.

 PackageKit-0.8.1-master.patch |  154 +++++++++++++++++++++++++++++++++++++++++
 PackageKit.spec               |    5 +-
 2 files changed, 158 insertions(+), 1 deletions(-)
---
diff --git a/PackageKit-0.8.1-master.patch b/PackageKit-0.8.1-master.patch
index 0c7ea23..1cff6e5 100644
--- a/PackageKit-0.8.1-master.patch
+++ b/PackageKit-0.8.1-master.patch
@@ -1050,3 +1050,157 @@ index 814ea5d..2d5e06c 100644
  	/* if we did not send this, ensure the GUI has the right state */
  	if (transaction->priv->allow_cancel)
  		pk_transaction_allow_cancel_emit (transaction, FALSE);
+commit 031540927b742eb10f52b8baa21ee6c7030b5315
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Fri Jul 6 09:04:43 2012 +0100
+
+    Only simulate in pkcon if only-download is not set
+
+diff --git a/client/pk-console.c b/client/pk-console.c
+index edbe593..b71e70c 100644
+--- a/client/pk-console.c
++++ b/client/pk-console.c
+@@ -1429,7 +1429,7 @@ main (int argc, char *argv[])
+ 	task = pk_task_text_new ();
+ 	g_object_set (task,
+ 		      "background", background,
+-		      "simulate", !noninteractive,
++		      "simulate", !noninteractive && !only_download,
+ 		      "interactive", !noninteractive,
+ 		      "only-download", only_download,
+ 		      "cache-age", cache_age,
+commit acf8f943676b9ee70ffba75264994c83fb2bc935
+Author: Matthias Klumpp <matthias at tenstral.net>
+Date:   Fri Jul 6 14:31:34 2012 +0200
+
+    Disable package-cache by default
+    
+    The light-cache will stay enabled. Those who
+    need the large cache can re-enable it.
+
+diff --git a/etc/PackageKit.conf.in b/etc/PackageKit.conf.in
+index 22eb467..74f0d26 100644
+--- a/etc/PackageKit.conf.in
++++ b/etc/PackageKit.conf.in
+@@ -133,8 +133,8 @@ ScanDesktopFiles=true
+ # NOTE: Don't enable this for backends that are slow doing GetPackages()
+ #       or GetDetails()
+ #
+-# default=true
+-UpdatePackageCache=true
++# default=false
++UpdatePackageCache=false
+ 
+ # Update the package list on PackageKit transactions
+ #
+commit 23704bca2c7efdbc3f4ed1f67dad90bb9eb17de0
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Sun Jul 8 17:01:10 2012 +0100
+
+    trivial: Print debug messages to the console when using PK_OFFLINE_UPDATE_TEST
+
+diff --git a/contrib/systemd-updates/pk-offline-update.c b/contrib/systemd-updates/pk-offline-update.c
+index a6fdaaf..ae40281 100644
+--- a/contrib/systemd-updates/pk-offline-update.c
++++ b/contrib/systemd-updates/pk-offline-update.c
+@@ -40,8 +40,10 @@ pk_offline_update_set_plymouth_msg (const gchar *msg)
+ 	GError *error = NULL;
+ 
+ 	/* allow testing without sending commands to plymouth */
+-	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL)
++	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) {
++		g_print ("TESTING, so not setting message: %s\n", msg);
+ 		return;
++	}
+ 	cmd = g_strdup_printf ("plymouth display-message --text=\"%s\"", msg);
+ 	ret = g_spawn_command_line_async (cmd, &error);
+ 	if (!ret) {
+@@ -64,8 +66,10 @@ pk_offline_update_set_plymouth_mode (const gchar *mode)
+ 	gchar *cmdline;
+ 
+ 	/* allow testing without sending commands to plymouth */
+-	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL)
++	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) {
++		g_print ("TESTING, so not switching mode: %s\n", mode);
+ 		return;
++	}
+ 	cmdline = g_strdup_printf ("plymouth change-mode --%s", mode);
+ 	ret = g_spawn_command_line_async (cmdline, &error);
+ 	if (!ret) {
+@@ -87,8 +91,10 @@ pk_offline_update_set_plymouth_percentage (guint percentage)
+ 	gchar *cmdline;
+ 
+ 	/* allow testing without sending commands to plymouth */
+-	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL)
++	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) {
++		g_print ("TESTING, so not setting percentage: %i\n", percentage);
+ 		return;
++	}
+ 	cmdline = g_strdup_printf ("plymouth system-update --progress=%i",
+ 				   percentage);
+ 	ret = g_spawn_command_line_async (cmdline, &error);
+@@ -139,8 +145,10 @@ pk_offline_update_reboot (void)
+ 	GVariant *val = NULL;
+ 
+ 	/* allow testing without rebooting */
+-	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL)
++	if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) {
++		g_print ("TESTING, so not rebooting\n");
+ 		return;
++	}
+ 
+ 	/* reboot using systemd */
+ 	pk_offline_update_set_plymouth_mode ("shutdown");
+commit 8d8454dab3647d19f864fb533f8a7335096343bd
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Mon Jul 9 13:29:42 2012 +0100
+
+    systemd-updates: If the upgrade tool exits with an error reboot the system
+
+diff --git a/contrib/systemd-updates/packagekit-offline-update.service.in b/contrib/systemd-updates/packagekit-offline-update.service.in
+index 4b9440a..bff38d3 100644
+--- a/contrib/systemd-updates/packagekit-offline-update.service.in
++++ b/contrib/systemd-updates/packagekit-offline-update.service.in
+@@ -1,5 +1,6 @@
+ [Unit]
+ Description=Updates the operating system whilst offline
++OnFailure=reboot.target
+ 
+ [Install]
+ WantedBy=system-update.target
+commit 281f0a286ad409c638688b3eb5d5478cf88f3dab
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Mon Jul 9 13:42:29 2012 +0100
+
+    systemd-updates: Be careful to not get in a reboot loop if the pk-offline-update tool crashes
+
+diff --git a/contrib/systemd-updates/pk-offline-update.c b/contrib/systemd-updates/pk-offline-update.c
+index ae40281..36972be 100644
+--- a/contrib/systemd-updates/pk-offline-update.c
++++ b/contrib/systemd-updates/pk-offline-update.c
+@@ -26,6 +26,7 @@
+ #include <stdlib.h>
+ 
+ #define PK_OFFLINE_UPDATE_RESULTS_GROUP		"PackageKit Offline Update Results"
++#define PK_OFFLINE_UPDATE_TRIGGER_FILENAME	"/system-update"
+ #define PK_OFFLINE_UPDATE_RESULTS_FILENAME	"/var/lib/PackageKit/offline-update-competed"
+ #define PK_OFFLINE_PREPARED_UPDATE_FILENAME	"/var/lib/PackageKit/prepared-update"
+ 
+@@ -339,6 +340,9 @@ main (int argc, char *argv[])
+ 		goto out;
+ 	}
+ 
++	/* always do this first to avoid a loop if this tool segfaults */
++	g_unlink (PK_OFFLINE_UPDATE_TRIGGER_FILENAME);
++
+ 	/* get the list of packages to update */
+ 	ret = g_file_get_contents (PK_OFFLINE_PREPARED_UPDATE_FILENAME,
+ 				   &packages_data,
+@@ -374,7 +378,6 @@ main (int argc, char *argv[])
+ 	g_unlink (PK_OFFLINE_PREPARED_UPDATE_FILENAME);
+ 	retval = EXIT_SUCCESS;
+ out:
+-	g_unlink ("/system-update");
+ 	pk_offline_update_reboot ();
+ 	g_free (packages_data);
+ 	g_strfreev (package_ids);
diff --git a/PackageKit.spec b/PackageKit.spec
index 832d8b7..0d2a68b 100644
--- a/PackageKit.spec
+++ b/PackageKit.spec
@@ -3,7 +3,7 @@
 Summary:   Package management service
 Name:      PackageKit
 Version:   0.8.1
-Release:   5%{?dist}
+Release:   6%{?dist}
 License:   GPLv2+ and LGPLv2+
 URL:       http://www.packagekit.org
 Source0:   http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
@@ -472,6 +472,9 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 %{_libdir}/pkgconfig/packagekit-plugin.pc
 
 %changelog
+* Mon Jul 09 2012 Richard Hughes  <rhughes at redhat.com> - 0.8.1-6
+- Fix several reported problems with the offline-update funtionality.
+
 * Thu Jul 05 2012 Richard Hughes  <rhughes at redhat.com> - 0.8.1-5
 - Correctly write the /var/lib/PackageKit/prepared-update file.
 


More information about the scm-commits mailing list