From d33f8ea6fa98e5eba3c832001809cff1129ac30c Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 16 Jul 2012 11:55:26 +0100 Subject: [PATCH] New upstream release - Bumped sonames for libpackagekit-glib and libpackagekit-qt - Lots of fixes to systemd-updates offline update functionality - Remove the Transaction.UpdateSystem() method - Don't show a warning if /var/run/PackageKit/udev does not exist - Never run any plugins for simulated actions --- .gitignore | 1 + PackageKit-0.8.1-master.patch | 1498 --------------------------------- PackageKit-0.8.1-qt_ULL.patch | 80 -- PackageKit.spec | 20 +- sources | 2 +- 5 files changed, 12 insertions(+), 1589 deletions(-) delete mode 100644 PackageKit-0.8.1-master.patch delete mode 100644 PackageKit-0.8.1-qt_ULL.patch diff --git a/.gitignore b/.gitignore index 41d000d..d29e3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ PackageKit-0.6.7.tar.bz2 /PackageKit-0.7.2.tar.xz /PackageKit-0.7.4.tar.xz /PackageKit-0.8.1.tar.xz +/PackageKit-0.8.2.tar.xz diff --git a/PackageKit-0.8.1-master.patch b/PackageKit-0.8.1-master.patch deleted file mode 100644 index c333f1e..0000000 --- a/PackageKit-0.8.1-master.patch +++ /dev/null @@ -1,1498 +0,0 @@ -diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py -index 491f044..896d32b 100755 ---- a/backends/yum/yumBackend.py -+++ b/backends/yum/yumBackend.py -@@ -1787,7 +1787,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - return - self._show_package(pkg, INFO_UNTRUSTED) - try: -- self._runYumTransaction(allow_skip_broken=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags, allow_skip_broken=True) - except PkError, e: - self.error(e.code, e.details, exit=False) - else: -@@ -2020,7 +2020,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - return - self._show_package(pkg, INFO_UNTRUSTED) - try: -- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags) - except PkError, e: - self.error(e.code, e.details, exit=False) - else: -@@ -2203,7 +2203,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - return - - try: -- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags) - except PkError, e: - self.error(e.code, e.details, exit=False) - return -@@ -2231,7 +2231,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - if not self.yumbase.tsInfo.pkgSack: - self.yumbase.tsInfo.pkgSack = MetaSack() - try: -- self._runYumTransaction(only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags) - except PkError, e: - self.error(e.code, e.details, exit=False) - return -@@ -2344,7 +2344,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - return - self._show_package(pkg, INFO_UNTRUSTED) - try: -- self._runYumTransaction(allow_skip_broken=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags, allow_skip_broken=True) - except PkError, e: - self.error(e.code, e.details, exit=False) - else: -@@ -2361,7 +2361,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - or (notice and notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested'])): - self.require_restart(RESTART_SYSTEM, self._pkg_to_id(pkg)) - -- def _runYumTransaction(self, allow_remove_deps=None, allow_skip_broken=False, only_simulate=False): -+ def _runYumTransaction(self, transaction_flags, allow_remove_deps=None, allow_skip_broken=False): - ''' - Run the yum Transaction - This will only work with yum 3.2.4 or higher -@@ -2409,7 +2409,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - raise PkError(ERROR_TRANSACTION_ERROR, message) - - # abort now we have the package list -- if only_simulate: -+ if TRANSACTION_FLAG_SIMULATE in transaction_flags: - package_list = [] - for txmbr in self.yumbase.tsInfo: - if txmbr.output_state in TransactionsInfoMap.keys(): -@@ -2421,6 +2421,20 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - self.percentage(100) - return - -+ if TRANSACTION_FLAG_ONLY_DOWNLOAD in transaction_flags: -+ package_list = [] -+ for txmbr in self.yumbase.tsInfo: -+ if txmbr.output_state in (TS_UPDATE, TS_INSTALL): -+ self._show_package(txmbr.po, INFO_DOWNLOADING) -+ repo = self.yumbase.repos.getRepo(txmbr.po.repoid) -+ try: -+ path = repo.getPackage(txmbr.po) -+ except IOError, e: -+ self.error(ERROR_PACKAGE_DOWNLOAD_FAILED, "Cannot write to file", exit=False) -+ return -+ self.percentage(100) -+ return -+ - try: - rpmDisplay = PackageKitCallback(self) - callback = ProcessTransPackageKitCallback(self) -@@ -2529,9 +2543,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - return - try: - if not allowdep: -- self._runYumTransaction(allow_remove_deps=False, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags, allow_remove_deps=False) - else: -- self._runYumTransaction(allow_remove_deps=True, only_simulate=TRANSACTION_FLAG_SIMULATE in transaction_flags) -+ self._runYumTransaction(transaction_flags, allow_remove_deps=True) - except PkError, e: - self.error(e.code, e.details, exit=False) - else: -@@ -3173,6 +3187,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage): - # default to 100% unless method overrides - self.yumbase.conf.throttle = "90%" - -+ # do not use parallel downloading -+ self.yumbase.conf.async = False -+ - def _setup_yum(self): - try: - # setup Yum Config -@@ -3349,17 +3366,18 @@ class PackageKitCallback(RPMBaseCallback): - self.base.message(MESSAGE_BACKEND_ERROR, "The constant '%s' was unknown, please report. details: %s" % (action, _to_unicode(e))) - - # set item percentage -- #if package and te_total > 0: -- # val = (te_current*100L)/te_total -- # if self.curpkg: -- # self.base.item_percentage(self.base._pkg_to_id(self.curpkg), val) -+ if package and te_total > 0: -+ val = (te_current*100L)/te_total -+ if self.curpkg: -+ self.base.item_percentage(self.base._pkg_to_id(self.curpkg), val) - -- # find out the offset -+ # find out the start offset - pct_start = StatusPercentageMap[STATUS_INSTALL] - - # do percentage - if ts_total > 0: - div = (100 - pct_start) / ts_total -+ val = (te_current*100L)/te_total - pct = div * (ts_current - 1) + pct_start + ((div / 100.0) * val) - self.base.percentage(pct) - -diff --git a/client/pk-console.c b/client/pk-console.c -index ade188e..edbe593 100644 ---- a/client/pk-console.c -+++ b/client/pk-console.c -@@ -978,6 +978,41 @@ out: - } - - /** -+ * pk_console_update_system: -+ **/ -+static gboolean -+pk_console_update_system (GError **error) -+{ -+ gboolean ret = TRUE; -+ gchar **package_ids = NULL; -+ PkPackageSack *sack = NULL; -+ PkResults *results; -+ -+ /* get the current updates */ -+ results = pk_task_get_updates_sync (PK_TASK (task), 0, cancellable, -+ (PkProgressCallback) pk_console_progress_cb, NULL, -+ error); -+ if (results == NULL) { -+ ret = FALSE; -+ goto out; -+ } -+ -+ /* do the async action */ -+ sack = pk_results_get_package_sack (results); -+ package_ids = pk_package_sack_get_ids (sack); -+ pk_task_update_packages_async (PK_TASK(task), package_ids, cancellable, -+ (PkProgressCallback) pk_console_progress_cb, NULL, -+ (GAsyncReadyCallback) pk_console_finished_cb, NULL); -+out: -+ if (sack != NULL) -+ g_object_unref (sack); -+ if (results != NULL) -+ g_object_unref (results); -+ g_strfreev (package_ids); -+ return ret; -+} -+ -+/** - * pk_console_get_requires: - **/ - static gboolean -@@ -1565,9 +1600,7 @@ main (int argc, char *argv[]) - } else if (strcmp (mode, "update") == 0) { - if (value == NULL) { - /* do the system update */ -- pk_task_update_system_async (PK_TASK(task), cancellable, -- (PkProgressCallback) pk_console_progress_cb, NULL, -- (GAsyncReadyCallback) pk_console_finished_cb, NULL); -+ nowait = !pk_console_update_system (&error); - } else { - nowait = !pk_console_update_packages (argv+2, &error); - } -diff --git a/contrib/systemd-updates/pk-offline-update.c b/contrib/systemd-updates/pk-offline-update.c -index 5d6604d..a6fdaaf 100644 ---- a/contrib/systemd-updates/pk-offline-update.c -+++ b/contrib/systemd-updates/pk-offline-update.c -@@ -27,6 +27,7 @@ - - #define PK_OFFLINE_UPDATE_RESULTS_GROUP "PackageKit Offline Update Results" - #define PK_OFFLINE_UPDATE_RESULTS_FILENAME "/var/lib/PackageKit/offline-update-competed" -+#define PK_OFFLINE_PREPARED_UPDATE_FILENAME "/var/lib/PackageKit/prepared-update" - - /** - * pk_offline_update_set_plymouth_msg: -@@ -38,6 +39,9 @@ pk_offline_update_set_plymouth_msg (const gchar *msg) - gchar *cmd; - GError *error = NULL; - -+ /* allow testing without sending commands to plymouth */ -+ if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) -+ return; - cmd = g_strdup_printf ("plymouth display-message --text=\"%s\"", msg); - ret = g_spawn_command_line_async (cmd, &error); - if (!ret) { -@@ -59,6 +63,9 @@ pk_offline_update_set_plymouth_mode (const gchar *mode) - GError *error = NULL; - gchar *cmdline; - -+ /* allow testing without sending commands to plymouth */ -+ if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) -+ return; - cmdline = g_strdup_printf ("plymouth change-mode --%s", mode); - ret = g_spawn_command_line_async (cmdline, &error); - if (!ret) { -@@ -79,6 +86,9 @@ pk_offline_update_set_plymouth_percentage (guint percentage) - GError *error = NULL; - gchar *cmdline; - -+ /* allow testing without sending commands to plymouth */ -+ if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) -+ return; - cmdline = g_strdup_printf ("plymouth system-update --progress=%i", - percentage); - ret = g_spawn_command_line_async (cmdline, &error); -@@ -128,6 +138,10 @@ pk_offline_update_reboot (void) - GError *error = NULL; - GVariant *val = NULL; - -+ /* allow testing without rebooting */ -+ if (g_getenv ("PK_OFFLINE_UPDATE_TEST") != NULL) -+ return; -+ - /* reboot using systemd */ - pk_offline_update_set_plymouth_mode ("shutdown"); - pk_offline_update_set_plymouth_msg ("Rebooting after installing updates..."); -@@ -299,10 +313,13 @@ out: - int - main (int argc, char *argv[]) - { -+ gboolean ret; -+ gchar **package_ids = NULL; -+ gchar *packages_data = NULL; - GError *error = NULL; - gint retval; -- PkTask *task = NULL; - PkResults *results; -+ PkTask *task = NULL; - - /* setup */ - g_type_init (); -@@ -314,16 +331,30 @@ main (int argc, char *argv[]) - goto out; - } - -+ /* get the list of packages to update */ -+ ret = g_file_get_contents (PK_OFFLINE_PREPARED_UPDATE_FILENAME, -+ &packages_data, -+ NULL, -+ &error); -+ if (!ret) { -+ retval = EXIT_FAILURE; -+ g_warning ("failed to read: %s", error->message); -+ g_error_free (error); -+ goto out; -+ } -+ - /* just update the system */ - task = pk_task_new (); - pk_task_set_interactive (task, FALSE); - pk_offline_update_set_plymouth_mode ("updates"); -- results = pk_client_update_system (PK_CLIENT (task), -- 0, -- NULL, /* GCancellable */ -- pk_offline_update_progress_cb, -- NULL, /* user_data */ -- &error); -+ package_ids = g_strsplit (packages_data, "\n", -1); -+ results = pk_client_update_packages (PK_CLIENT (task), -+ 0, -+ package_ids, -+ NULL, /* GCancellable */ -+ pk_offline_update_progress_cb, -+ NULL, /* user_data */ -+ &error); - if (results == NULL) { - retval = EXIT_FAILURE; - pk_offline_update_write_error (error); -@@ -332,11 +363,13 @@ main (int argc, char *argv[]) - goto out; - } - pk_offline_update_write_results (results); -- g_unlink ("/var/lib/PackageKit/prepared-update"); -+ 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); - if (task != NULL) - g_object_unref (task); - return retval; -diff --git a/lib/packagekit-glib2/pk-client.c b/lib/packagekit-glib2/pk-client.c -index 5613f3e..4af44a7 100644 ---- a/lib/packagekit-glib2/pk-client.c -+++ b/lib/packagekit-glib2/pk-client.c -@@ -1204,7 +1204,7 @@ pk_client_signal_cb (GDBusProxy *proxy, - if (g_strcmp0 (signal_name, "Transaction") == 0) { - PkTransactionPast *item; - g_variant_get (parameters, -- "(&o&sb&su&su&s)", -+ "(&o&sbuu&su&s)", - &tmp_str[0], - &tmp_str[1], - &tmp_bool, -diff --git a/lib/packagekit-glib2/pk-progress.c b/lib/packagekit-glib2/pk-progress.c -index d1b7ff4..aa1b94f 100644 ---- a/lib/packagekit-glib2/pk-progress.c -+++ b/lib/packagekit-glib2/pk-progress.c -@@ -266,6 +266,10 @@ pk_progress_set_role (PkProgress *progress, PkRoleEnum role) - { - g_return_val_if_fail (PK_IS_PROGRESS (progress), FALSE); - -+ /* ignore unknown as we don't want to replace a valid value */ -+ if (role == PK_ROLE_ENUM_UNKNOWN) -+ return FALSE; -+ - /* the same as before? */ - if (progress->priv->role == role) - return FALSE; -diff --git a/src/pk-backend.c b/src/pk-backend.c -index b9ae2b8..477552f 100644 ---- a/src/pk-backend.c -+++ b/src/pk-backend.c -@@ -1109,6 +1109,8 @@ pk_backend_set_item_progress (PkBackend *backend, - const gchar *package_id, - guint percentage) - { -+ PkItemProgress *item; -+ - g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE); - g_return_val_if_fail (backend->priv->loaded, FALSE); - -@@ -1125,9 +1127,15 @@ pk_backend_set_item_progress (PkBackend *backend, - } - - /* emit */ -+ item = pk_item_progress_new (); -+ g_object_set (item, -+ "package-id", package_id, -+ "percentage", percentage, -+ NULL); - pk_backend_call_vfunc (backend, - PK_BACKEND_SIGNAL_ITEM_PROGRESS, -- (gpointer) package_id); //FIXME -+ item); -+ g_object_unref (item); - return TRUE; - } - -diff --git a/src/pk-transaction.c b/src/pk-transaction.c -index afdd563..1818723 100644 ---- a/src/pk-transaction.c -+++ b/src/pk-transaction.c -@@ -689,23 +689,24 @@ pk_transaction_category_cb (PkBackend *backend, - **/ - static void - pk_transaction_item_progress_cb (PkBackend *backend, -- const gchar *package_id, -- guint percentage, -+ PkItemProgress *item_progress, - PkTransaction *transaction) - { - g_return_if_fail (PK_IS_TRANSACTION (transaction)); - g_return_if_fail (transaction->priv->tid != NULL); - - /* emit */ -- g_debug ("emitting item-progress %s, %u", package_id, percentage); -+ g_debug ("emitting item-progress %s, %u", -+ pk_item_progress_get_package_id (item_progress), -+ pk_item_progress_get_percentage (item_progress)); - g_dbus_connection_emit_signal (transaction->priv->connection, - NULL, - transaction->priv->tid, - PK_DBUS_INTERFACE_TRANSACTION, - "ItemProgress", - g_variant_new ("(su)", -- package_id, -- percentage), -+ pk_item_progress_get_package_id (item_progress), -+ pk_item_progress_get_percentage (item_progress)), - NULL); - } - -@@ -1058,6 +1059,18 @@ pk_transaction_get_package_ids (PkTransaction *transaction) - } - - /** -+ * pk_transaction_get_transaction_flags: -+ * -+ * Returns: transaction flags for the transaction -+ **/ -+PkBitfield -+pk_transaction_get_transaction_flags (PkTransaction *transaction) -+{ -+ g_return_val_if_fail (PK_IS_TRANSACTION (transaction), 0); -+ return transaction->priv->cached_transaction_flags; -+} -+ -+/** - * pk_transaction_set_package_ids: - **/ - void -@@ -1106,40 +1119,6 @@ pk_transaction_set_full_paths (PkTransaction *transaction, - } - - /** -- * pk_transaction_write_prepared_file: -- **/ --static void --pk_transaction_write_prepared_file (PkTransaction *transaction) --{ -- gboolean ret; -- gchar *path; -- GError *error = NULL; -- -- /* not interesting to us */ -- if (transaction->priv->role != PK_ROLE_ENUM_UPDATE_PACKAGES && -- transaction->priv->role != PK_ROLE_ENUM_UPDATE_SYSTEM) { -- return; -- } -- -- /* write filename */ -- path = g_build_filename (LOCALSTATEDIR, -- "lib", -- "PackageKit", -- "prepared-update", -- NULL); -- ret = g_file_set_contents (path, -- pk_role_enum_to_string (transaction->priv->role), -- -1, -- &error); -- if (!ret) { -- g_warning ("failed to write %s: %s", -- path, error->message); -- g_error_free (error); -- } -- g_free (path); --} -- --/** - * pk_transaction_finished_cb: - **/ - static void -@@ -1244,13 +1223,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit_enum, PkTransact - if (exit_enum == PK_EXIT_ENUM_SUCCESS) - pk_transaction_db_action_time_reset (transaction->priv->transaction_db, transaction->priv->role); - -- /* write notification files if anything is pending */ -- if (exit_enum == PK_EXIT_ENUM_SUCCESS && -- pk_bitfield_contain (transaction->priv->cached_transaction_flags, -- PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD)) { -- pk_transaction_write_prepared_file (transaction); -- } -- - /* did we finish okay? */ - if (exit_enum == PK_EXIT_ENUM_SUCCESS) - pk_transaction_db_set_finished (transaction->priv->transaction_db, transaction->priv->tid, TRUE, time_ms); -@@ -1751,7 +1723,7 @@ pk_transaction_transaction_cb (PkTransactionDb *tdb, - transaction->priv->tid, - PK_DBUS_INTERFACE_TRANSACTION, - "Transaction", -- g_variant_new ("(osbsusus)", -+ g_variant_new ("(osbuusus)", - tid, - timespec, - succeeded, -@@ -2880,6 +2852,21 @@ pk_transaction_obtain_authorization (PkTransaction *transaction, - - g_return_val_if_fail (priv->sender != NULL, FALSE); - -+ /* we don't need to authenticate at all to just download packages */ -+ if (pk_bitfield_contain (transaction->priv->cached_transaction_flags, -+ PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD)) { -+ g_debug ("No authentication required for only-download"); -+ ret = pk_transaction_commit (transaction); -+ if (!ret) { -+ g_set_error_literal (error, -+ PK_TRANSACTION_ERROR, -+ PK_TRANSACTION_ERROR_COMMIT_FAILED, -+ "Could not commit to a transaction object"); -+ pk_transaction_release_tid (transaction); -+ } -+ goto out; -+ } -+ - /* we should always have subject */ - if (priv->subject == NULL) { - g_set_error (error, PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_REFUSED_BY_POLICY, -@@ -3029,6 +3016,18 @@ pk_transaction_get_role (PkTransaction *transaction) - } - - /** -+ * pk_transaction_set_role: -+ **/ -+static void -+pk_transaction_set_role (PkTransaction *transaction, PkRoleEnum role) -+{ -+ transaction->priv->role = role; -+ pk_transaction_emit_property_changed (transaction, -+ "Role", -+ g_variant_new_uint32 (role)); -+} -+ -+/** - * pk_transaction_dbus_return: - **/ - static void -@@ -3065,7 +3064,6 @@ pk_transaction_accept_eula (PkTransaction *transaction, - - g_return_if_fail (PK_IS_TRANSACTION (transaction)); - g_return_if_fail (transaction->priv->tid != NULL); -- transaction->priv->role = PK_ROLE_ENUM_ACCEPT_EULA; - - g_variant_get (params, "(&s)", - &eula_id); -@@ -3077,6 +3075,8 @@ pk_transaction_accept_eula (PkTransaction *transaction, - goto out; - } - -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_ACCEPT_EULA); -+ - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, - PK_ROLE_ENUM_ACCEPT_EULA, -@@ -3319,7 +3319,7 @@ pk_transaction_download_packages (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_package_ids = g_strdupv (package_ids); - transaction->priv->cached_directory = g_strdup (directory); -- transaction->priv->role = PK_ROLE_ENUM_DOWNLOAD_PACKAGES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_DOWNLOAD_PACKAGES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3360,7 +3360,7 @@ pk_transaction_get_categories (PkTransaction *transaction, - goto out; - } - -- transaction->priv->role = PK_ROLE_ENUM_GET_CATEGORIES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_CATEGORIES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3434,7 +3434,7 @@ pk_transaction_get_depends (PkTransaction *transaction, - transaction->priv->cached_filters = filter; - transaction->priv->cached_package_ids = g_strdupv (package_ids); - transaction->priv->cached_force = recursive; -- transaction->priv->role = PK_ROLE_ENUM_GET_DEPENDS; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DEPENDS); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3504,7 +3504,7 @@ pk_transaction_get_details (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_package_ids = g_strdupv (package_ids); -- transaction->priv->role = PK_ROLE_ENUM_GET_DETAILS; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DETAILS); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3545,7 +3545,7 @@ pk_transaction_get_distro_upgrades (PkTransaction *transaction, - } - - /* save so we can run later */ -- transaction->priv->role = PK_ROLE_ENUM_GET_DISTRO_UPGRADES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_DISTRO_UPGRADES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3613,7 +3613,7 @@ pk_transaction_get_files (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_package_ids = g_strdupv (package_ids); -- transaction->priv->role = PK_ROLE_ENUM_GET_FILES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_FILES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3659,7 +3659,7 @@ pk_transaction_get_packages (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_filters = filter; -- transaction->priv->role = PK_ROLE_ENUM_GET_PACKAGES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_PACKAGES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3692,7 +3692,7 @@ pk_transaction_get_old_transactions (PkTransaction *transaction, - - g_debug ("GetOldTransactions method called"); - -- transaction->priv->role = PK_ROLE_ENUM_GET_OLD_TRANSACTIONS; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_OLD_TRANSACTIONS); - pk_transaction_db_get_list (transaction->priv->transaction_db, number); - idle_id = g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction); - g_source_set_name_by_id (idle_id, "[PkTransaction] finished from get-old-transactions"); -@@ -3731,7 +3731,7 @@ pk_transaction_get_repo_list (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_filters = filter; -- transaction->priv->role = PK_ROLE_ENUM_GET_REPO_LIST; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_REPO_LIST); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3806,7 +3806,7 @@ pk_transaction_get_requires (PkTransaction *transaction, - transaction->priv->cached_filters = filter; - transaction->priv->cached_package_ids = g_strdupv (package_ids); - transaction->priv->cached_force = recursive; -- transaction->priv->role = PK_ROLE_ENUM_GET_REQUIRES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_REQUIRES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -3875,7 +3875,7 @@ pk_transaction_get_update_detail (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_package_ids = g_strdupv (package_ids); -- transaction->priv->role = PK_ROLE_ENUM_GET_UPDATE_DETAIL; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_UPDATE_DETAIL); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -4004,7 +4004,7 @@ pk_transaction_get_updates (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_filters = filter; -- transaction->priv->role = PK_ROLE_ENUM_GET_UPDATES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_GET_UPDATES); - - /* try and reuse cache */ - ret = pk_transaction_try_emit_cache (transaction); -@@ -4166,7 +4166,7 @@ pk_transaction_install_files (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_transaction_flags = transaction_flags; - transaction->priv->cached_full_paths = g_strdupv (full_paths); -- transaction->priv->role = PK_ROLE_ENUM_INSTALL_FILES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_FILES); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4239,7 +4239,7 @@ pk_transaction_install_packages (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_transaction_flags = transaction_flags; - transaction->priv->cached_package_ids = g_strdupv (package_ids); -- transaction->priv->role = PK_ROLE_ENUM_INSTALL_PACKAGES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_PACKAGES); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4309,7 +4309,7 @@ pk_transaction_install_signature (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_package_id = g_strdup (package_id); - transaction->priv->cached_key_id = g_strdup (key_id); -- transaction->priv->role = PK_ROLE_ENUM_INSTALL_SIGNATURE; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_INSTALL_SIGNATURE); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4357,7 +4357,7 @@ pk_transaction_refresh_cache (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_force = force; -- transaction->priv->role = PK_ROLE_ENUM_REFRESH_CACHE; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REFRESH_CACHE); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4435,7 +4435,7 @@ pk_transaction_remove_packages (PkTransaction *transaction, - transaction->priv->cached_package_ids = g_strdupv (package_ids); - transaction->priv->cached_allow_deps = allow_deps; - transaction->priv->cached_autoremove = autoremove; -- transaction->priv->role = PK_ROLE_ENUM_REMOVE_PACKAGES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REMOVE_PACKAGES); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4491,7 +4491,7 @@ pk_transaction_repo_enable (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_repo_id = g_strdup (repo_id); - transaction->priv->cached_enabled = enabled; -- transaction->priv->role = PK_ROLE_ENUM_REPO_ENABLE; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_ENABLE); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4550,7 +4550,7 @@ pk_transaction_repo_set_data (PkTransaction *transaction, - transaction->priv->cached_repo_id = g_strdup (repo_id); - transaction->priv->cached_parameter = g_strdup (parameter); - transaction->priv->cached_value = g_strdup (value); -- transaction->priv->role = PK_ROLE_ENUM_REPO_SET_DATA; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPO_SET_DATA); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -4630,7 +4630,7 @@ pk_transaction_resolve (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_package_ids = g_strdupv (packages); - transaction->priv->cached_filters = filter; -- transaction->priv->role = PK_ROLE_ENUM_RESOLVE; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_RESOLVE); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -4687,7 +4687,7 @@ pk_transaction_search_details (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_filters = filter; - transaction->priv->cached_values = g_strdupv (values); -- transaction->priv->role = PK_ROLE_ENUM_SEARCH_DETAILS; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_DETAILS); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -4754,7 +4754,7 @@ pk_transaction_search_files (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_filters = filter; - transaction->priv->cached_values = g_strdupv (values); -- transaction->priv->role = PK_ROLE_ENUM_SEARCH_FILE; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_FILE); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -4821,7 +4821,7 @@ pk_transaction_search_groups (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_filters = filter; - transaction->priv->cached_values = g_strdupv (values); -- transaction->priv->role = PK_ROLE_ENUM_SEARCH_GROUP; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_GROUP); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -4877,7 +4877,7 @@ pk_transaction_search_names (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_filters = filter; - transaction->priv->cached_values = g_strdupv (values); -- transaction->priv->role = PK_ROLE_ENUM_SEARCH_NAME; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_SEARCH_NAME); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -5112,7 +5112,7 @@ pk_transaction_update_packages (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_transaction_flags = transaction_flags; - transaction->priv->cached_package_ids = g_strdupv (package_ids); -- transaction->priv->role = PK_ROLE_ENUM_UPDATE_PACKAGES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPDATE_PACKAGES); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -5165,7 +5165,7 @@ pk_transaction_update_system (PkTransaction *transaction, - } - - transaction->priv->cached_transaction_flags = transaction_flags; -- transaction->priv->role = PK_ROLE_ENUM_UPDATE_SYSTEM; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPDATE_SYSTEM); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -5225,7 +5225,7 @@ pk_transaction_what_provides (PkTransaction *transaction, - transaction->priv->cached_filters = filter; - transaction->priv->cached_values = g_strdupv (values); - transaction->priv->cached_provides = provides; -- transaction->priv->role = PK_ROLE_ENUM_WHAT_PROVIDES; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_WHAT_PROVIDES); - - /* try to commit this */ - ret = pk_transaction_commit (transaction); -@@ -5274,7 +5274,7 @@ pk_transaction_upgrade_system (PkTransaction *transaction, - /* save so we can run later */ - transaction->priv->cached_value = g_strdup (distro_id); - transaction->priv->cached_provides = upgrade_kind; -- transaction->priv->role = PK_ROLE_ENUM_UPGRADE_SYSTEM; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_UPGRADE_SYSTEM); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -@@ -5319,7 +5319,7 @@ pk_transaction_repair_system (PkTransaction *transaction, - - /* save so we can run later */ - transaction->priv->cached_transaction_flags = transaction_flags; -- transaction->priv->role = PK_ROLE_ENUM_REPAIR_SYSTEM; -+ pk_transaction_set_role (transaction, PK_ROLE_ENUM_REPAIR_SYSTEM); - - /* try to get authorization */ - ret = pk_transaction_obtain_authorization (transaction, -diff --git a/src/pk-transaction.h b/src/pk-transaction.h -index 4f247b3..79c68a5 100644 ---- a/src/pk-transaction.h -+++ b/src/pk-transaction.h -@@ -82,6 +82,7 @@ void pk_transaction_set_backend (PkTransaction *transaction, - PkBackend *backend); - PkResults *pk_transaction_get_results (PkTransaction *transaction); - gchar **pk_transaction_get_package_ids (PkTransaction *transaction); -+PkBitfield pk_transaction_get_transaction_flags (PkTransaction *transaction); - void pk_transaction_set_package_ids (PkTransaction *transaction, - gchar **package_ids); - gchar **pk_transaction_get_values (PkTransaction *transaction); -diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am -index c1bf30d..f693c2c 100644 ---- a/src/plugins/Makefile.am -+++ b/src/plugins/Makefile.am -@@ -58,6 +58,7 @@ plugin_LTLIBRARIES = \ - libpk_plugin-update-package-cache.la \ - libpk_plugin-no-update-process.la \ - libpk_plugin-scan-desktop-files.la \ -+ libpk_plugin-systemd-updates.la \ - libpk_plugin-update-check-processes.la \ - libpk_plugin-check-shared-libraries-in-use.la \ - libpk_plugin-clear-system-update.la \ -@@ -68,6 +69,11 @@ libpk_plugin_example_la_LIBADD = $(PK_PLUGIN_LIBS) - libpk_plugin_example_la_LDFLAGS = -module -avoid-version - libpk_plugin_example_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C) - -+libpk_plugin_systemd_updates_la_SOURCES = pk-plugin-systemd-updates.c -+libpk_plugin_systemd_updates_la_LIBADD = $(PK_PLUGIN_LIBS) -+libpk_plugin_systemd_updates_la_LDFLAGS = -module -avoid-version -+libpk_plugin_systemd_updates_la_CFLAGS = $(PK_PLUGIN_CFLAGS) $(WARNINGFLAGS_C) -+ - libpk_plugin_scripts_la_SOURCES = pk-plugin-scripts.c - libpk_plugin_scripts_la_LIBADD = $(PK_PLUGIN_LIBS) - libpk_plugin_scripts_la_LDFLAGS = -module -avoid-version -diff --git a/src/plugins/pk-plugin-clear-firmware-requests.c b/src/plugins/pk-plugin-clear-firmware-requests.c -index 8b4216a..f9326f4 100644 ---- a/src/plugins/pk-plugin-clear-firmware-requests.c -+++ b/src/plugins/pk-plugin-clear-firmware-requests.c -@@ -51,6 +51,8 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin, - - /* clear the firmware requests directory */ - filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL); -+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) -+ goto out; - g_debug ("clearing udev firmware requests at %s", filename); - ret = pk_directory_remove_contents (filename); - if (!ret) -diff --git a/src/plugins/pk-plugin-systemd-updates.c b/src/plugins/pk-plugin-systemd-updates.c -new file mode 100644 -index 0000000..b0abc8d ---- /dev/null -+++ b/src/plugins/pk-plugin-systemd-updates.c -@@ -0,0 +1,162 @@ -+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- -+ * -+ * Copyright (C) 2012 Richard Hughes -+ * -+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -+ */ -+ -+#include -+#include -+#include -+ -+/** -+ * pk_plugin_get_description: -+ */ -+const gchar * -+pk_plugin_get_description (void) -+{ -+ return "A plugin to write the prepared-updates file"; -+} -+ -+/** -+ * pk_plugin_get_existing_prepared_updates: -+ **/ -+static GPtrArray * -+pk_plugin_get_existing_prepared_updates (const gchar *filename) -+{ -+ gboolean ret; -+ gchar **package_ids = NULL; -+ gchar *packages_data = NULL; -+ GError *error = NULL; -+ GPtrArray *packages; -+ guint i; -+ -+ /* always return a valid array, even for failure */ -+ packages = g_ptr_array_new_with_free_func (g_free); -+ -+ /* does the file exist ? */ -+ if (!g_file_test (filename, G_FILE_TEST_EXISTS)) -+ goto out; -+ -+ /* get the list of packages to update */ -+ ret = g_file_get_contents (filename, -+ &packages_data, -+ NULL, -+ &error); -+ if (!ret) { -+ g_warning ("failed to read: %s", error->message); -+ g_error_free (error); -+ goto out; -+ } -+ -+ /* add them to the new array */ -+ package_ids = g_strsplit (packages_data, "\n", -1); -+ for (i = 0; package_ids[i] != NULL; i++) -+ g_ptr_array_add (packages, g_strdup (package_ids[i])); -+out: -+ g_free (packages_data); -+ g_strfreev (package_ids); -+ return packages; -+} -+ -+/** -+ * pk_plugin_array_str_exists: -+ **/ -+static gboolean -+pk_plugin_array_str_exists (GPtrArray *array, const gchar *str) -+{ -+ guint i; -+ const gchar *tmp; -+ for (i = 0; i < array->len; i++) { -+ tmp = g_ptr_array_index (array, i); -+ if (g_strcmp0 (tmp, str) == 0) -+ return TRUE; -+ } -+ return FALSE; -+} -+ -+/** -+ * pk_plugin_transaction_finished_end: -+ */ -+void -+pk_plugin_transaction_finished_end (PkPlugin *plugin, -+ PkTransaction *transaction) -+{ -+ gboolean ret; -+ gchar **package_ids; -+ gchar *packages_str = NULL; -+ gchar *path = NULL; -+ GError *error = NULL; -+ GPtrArray *packages; -+ guint i; -+ PkBitfield transaction_flags; -+ PkExitEnum exit_enum; -+ PkResults *results; -+ PkRoleEnum role; -+ -+ /* check the role */ -+ role = pk_transaction_get_role (transaction); -+ if (role != PK_ROLE_ENUM_UPDATE_PACKAGES) -+ goto out; -+ -+ /* check for success */ -+ results = pk_transaction_get_results (transaction); -+ exit_enum = pk_results_get_exit_code (results); -+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) -+ goto out; -+ -+ /* only write the file for only-download */ -+ transaction_flags = pk_transaction_get_transaction_flags (transaction); -+ if (!pk_bitfield_contain (transaction_flags, -+ PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD)) -+ return; -+ -+ /* get the existing prepared updates */ -+ path = g_build_filename (LOCALSTATEDIR, -+ "lib", -+ "PackageKit", -+ "prepared-update", -+ NULL); -+ packages = pk_plugin_get_existing_prepared_updates (path); -+ -+ /* add any new ones */ -+ package_ids = pk_transaction_get_package_ids (transaction); -+ for (i = 0; package_ids[i] != NULL; i++) { -+ if (!pk_plugin_array_str_exists (packages, package_ids[i])) { -+ g_ptr_array_add (packages, -+ g_strdup (package_ids[i])); -+ } -+ } -+ g_ptr_array_add (packages, NULL); -+ -+ /* write filename */ -+ packages_str = g_strjoinv ("\n", (gchar **) packages->pdata); -+ ret = g_file_set_contents (path, -+ packages_str, -+ -1, -+ &error); -+ if (!ret) { -+ g_warning ("failed to write %s: %s", -+ path, error->message); -+ g_error_free (error); -+ goto out; -+ } -+out: -+ g_free (packages_str); -+ g_free (path); -+ return; -+} -commit 587b14d08196509ebf93a6bc0d1ab0fe76b6ef89 -Author: Richard Hughes -Date: Thu Jul 5 15:23:37 2012 +0100 - - Set the exit code before running the plugin finished handlers - -diff --git a/src/pk-transaction.c b/src/pk-transaction.c -index 814ea5d..2d5e06c 100644 ---- a/src/pk-transaction.c -+++ b/src/pk-transaction.c -@@ -1146,6 +1146,9 @@ pk_transaction_finished_cb (PkBackendJob *job, PkExitEnum exit_enum, PkTransacti - return; - } - -+ /* save this so we know if the cache is valid */ -+ pk_results_set_exit_code (transaction->priv->results, exit_enum); -+ - /* run the plugins */ - pk_transaction_plugin_phase (transaction, - PK_PLUGIN_PHASE_TRANSACTION_FINISHED_START); -@@ -1158,9 +1161,6 @@ pk_transaction_finished_cb (PkBackendJob *job, PkExitEnum exit_enum, PkTransacti - pk_transaction_plugin_phase (transaction, - PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END); - -- /* save this so we know if the cache is valid */ -- pk_results_set_exit_code (transaction->priv->results, exit_enum); -- - /* 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 -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 -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 -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 -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 -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 - - #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); -commit e5e2ec784248a5ee15be98dbfe2e6d12bd5ec63a -Author: Richard Hughes -Date: Tue Jul 10 11:00:56 2012 +0100 - - Never run any plugins for simulated actions - -diff --git a/src/pk-transaction.c b/src/pk-transaction.c -index b5292fc..a29eb82 100644 ---- a/src/pk-transaction.c -+++ b/src/pk-transaction.c -@@ -944,6 +944,14 @@ pk_transaction_plugin_phase (PkTransaction *transaction, - if (transaction->priv->plugins == NULL) - goto out; - -+ /* never run any plugins for simulate actions */ -+ if (pk_bitfield_contain (transaction->priv->cached_transaction_flags, -+ PK_TRANSACTION_FLAG_ENUM_SIMULATE)) { -+ g_debug ("not running plugin function %s as simulating", -+ function); -+ return; -+ } -+ - /* run each plugin */ - for (i=0; ipriv->plugins->len; i++) { - plugin = g_ptr_array_index (transaction->priv->plugins, i); -commit 10e2461115adb7ecd9ab37c64b54484eea17e5ae -Author: Richard Hughes -Date: Tue Jul 10 12:46:01 2012 +0100 - - Run any methods that implement pk_plugin_state_changed() when the daemon state changes - - This can happen if any native tool is run on the command line. - -diff --git a/src/pk-engine.c b/src/pk-engine.c -index bd845d1..4844355 100644 ---- a/src/pk-engine.c -+++ b/src/pk-engine.c -@@ -58,6 +58,7 @@ - - static void pk_engine_finalize (GObject *object); - static void pk_engine_set_locked (PkEngine *engine, gboolean is_locked); -+static void pk_engine_plugin_phase (PkEngine *engine, PkPluginPhase phase); - - #define PK_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_ENGINE, PkEnginePrivate)) - -@@ -379,6 +380,9 @@ pk_engine_state_changed_cb (gpointer data) - - g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE); - -+ /* run the plugin hook */ -+ pk_engine_plugin_phase (engine, PK_PLUGIN_PHASE_STATE_CHANGED); -+ - /* if network is not up, then just reschedule */ - state = pk_network_get_network_state (engine->priv->network); - if (state == PK_NETWORK_ENUM_OFFLINE) { -@@ -1042,6 +1046,9 @@ pk_engine_plugin_phase (PkEngine *engine, - case PK_PLUGIN_PHASE_DESTROY: - function = "pk_plugin_destroy"; - break; -+ case PK_PLUGIN_PHASE_STATE_CHANGED: -+ function = "pk_plugin_state_changed"; -+ break; - default: - g_assert_not_reached (); - break; -diff --git a/src/pk-plugin.h b/src/pk-plugin.h -index bf13711..8c4ce02 100644 ---- a/src/pk-plugin.h -+++ b/src/pk-plugin.h -@@ -49,6 +49,7 @@ typedef enum { - PK_PLUGIN_PHASE_TRANSACTION_FINISHED_RESULTS, /* finished with some signals */ - PK_PLUGIN_PHASE_TRANSACTION_FINISHED_END, /* finished with no signals */ - PK_PLUGIN_PHASE_DESTROY, /* plugin finalized */ -+ PK_PLUGIN_PHASE_STATE_CHANGED, /* system state has changed */ - PK_PLUGIN_PHASE_UNKNOWN - } PkPluginPhase; - -@@ -65,6 +66,7 @@ typedef void (*PkPluginTransactionFunc) (PkPlugin *plugin, - const gchar *pk_plugin_get_description (void); - void pk_plugin_initialize (PkPlugin *plugin); - void pk_plugin_destroy (PkPlugin *plugin); -+void pk_plugin_state_changed (PkPlugin *plugin); - void pk_plugin_transaction_run (PkPlugin *plugin, - PkTransaction *transaction); - void pk_plugin_transaction_started (PkPlugin *plugin, -commit 16513d3a3032ca61c8e5e6ade91c64c5fdde8ccc -Author: Richard Hughes -Date: Tue Jul 10 12:46:37 2012 +0100 - - systemd-updates: Remove the prepared-updates file if the daemon state changes - -diff --git a/src/plugins/pk-plugin-systemd-updates.c b/src/plugins/pk-plugin-systemd-updates.c -index b0abc8d..00c099a 100644 ---- a/src/plugins/pk-plugin-systemd-updates.c -+++ b/src/plugins/pk-plugin-systemd-updates.c -@@ -21,6 +21,7 @@ - - #include - #include -+#include - #include - - /** -@@ -90,6 +91,31 @@ pk_plugin_array_str_exists (GPtrArray *array, const gchar *str) - } - - /** -+ * pk_plugin_state_changed: -+ */ -+void -+pk_plugin_state_changed (PkPlugin *plugin) -+{ -+ gchar *file; -+ -+ /* if the state changed because of a yum command that could -+ * have changed the updates list then nuke the prepared-updates -+ * file */ -+ file = g_build_filename (LOCALSTATEDIR, -+ "lib", -+ "PackageKit", -+ "prepared-update", -+ NULL); -+ if (g_file_test (file, G_FILE_TEST_EXISTS)) { -+ g_debug ("Removing %s as state has changed", file); -+ g_unlink (file); -+ } else { -+ g_debug ("No %s needed to be deleted", file); -+ } -+ g_free (file); -+} -+ -+/** - * pk_plugin_transaction_finished_end: - */ - void -commit 3fde672000e38812dd41e5d50c225b91c3f951fa -Author: Richard Hughes -Date: Tue Jul 10 13:00:02 2012 +0100 - - systemd-updates: Remove the prepared-updates file if GetUpdates() returns no packages - -diff --git a/src/plugins/pk-plugin-systemd-updates.c b/src/plugins/pk-plugin-systemd-updates.c -index 00c099a..de3e491 100644 ---- a/src/plugins/pk-plugin-systemd-updates.c -+++ b/src/plugins/pk-plugin-systemd-updates.c -@@ -116,11 +116,10 @@ pk_plugin_state_changed (PkPlugin *plugin) - } - - /** -- * pk_plugin_transaction_finished_end: -+ * pk_plugin_transaction_update_packages: - */ --void --pk_plugin_transaction_finished_end (PkPlugin *plugin, -- PkTransaction *transaction) -+static void -+pk_plugin_transaction_update_packages (PkTransaction *transaction) - { - gboolean ret; - gchar **package_ids; -@@ -130,20 +129,6 @@ pk_plugin_transaction_finished_end (PkPlugin *plugin, - GPtrArray *packages; - guint i; - PkBitfield transaction_flags; -- PkExitEnum exit_enum; -- PkResults *results; -- PkRoleEnum role; -- -- /* check the role */ -- role = pk_transaction_get_role (transaction); -- if (role != PK_ROLE_ENUM_UPDATE_PACKAGES) -- goto out; -- -- /* check for success */ -- results = pk_transaction_get_results (transaction); -- exit_enum = pk_results_get_exit_code (results); -- if (exit_enum != PK_EXIT_ENUM_SUCCESS) -- goto out; - - /* only write the file for only-download */ - transaction_flags = pk_transaction_get_transaction_flags (transaction); -@@ -186,3 +171,70 @@ out: - g_free (path); - return; - } -+ -+/** -+ * pk_plugin_transaction_get_updates: -+ */ -+static void -+pk_plugin_transaction_get_updates (PkTransaction *transaction) -+{ -+ gchar *path; -+ GPtrArray *array; -+ PkResults *results; -+ -+ results = pk_transaction_get_results (transaction); -+ path = g_build_filename (LOCALSTATEDIR, -+ "lib", -+ "PackageKit", -+ "prepared-update", -+ NULL); -+ array = pk_results_get_package_array (results); -+ if (array->len != 0) { -+ g_debug ("got %i updates, so ignoring %s", -+ array->len, path); -+ goto out; -+ } -+ if (g_file_test (path, G_FILE_TEST_EXISTS)) { -+ g_debug ("Removing %s as no updates", path); -+ g_unlink (path); -+ } else { -+ g_debug ("No %s present, so no need to delete", path); -+ } -+out: -+ g_free (path); -+ g_ptr_array_unref (array); -+} -+ -+/** -+ * pk_plugin_transaction_finished_end: -+ */ -+void -+pk_plugin_transaction_finished_end (PkPlugin *plugin, -+ PkTransaction *transaction) -+{ -+ PkExitEnum exit_enum; -+ PkResults *results; -+ PkRoleEnum role; -+ -+ /* check for success */ -+ results = pk_transaction_get_results (transaction); -+ exit_enum = pk_results_get_exit_code (results); -+ if (exit_enum != PK_EXIT_ENUM_SUCCESS) -+ goto out; -+ -+ /* if we're doing only-download then update prepared-updates */ -+ role = pk_transaction_get_role (transaction); -+ if (role == PK_ROLE_ENUM_UPDATE_PACKAGES) { -+ pk_plugin_transaction_update_packages (transaction); -+ goto out; -+ } -+ -+ /* if we do get-updates and there's no updates then remove -+ * prepared-updates so the UI doesn't display update & reboot */ -+ if (role == PK_ROLE_ENUM_GET_UPDATES) { -+ pk_plugin_transaction_get_updates (transaction); -+ goto out; -+ } -+out: -+ return; -+} -commit af0443450775a1876aeb4af84595b331bad19640 -Author: Richard Hughes -Date: Tue Jul 10 14:06:55 2012 +0100 - - When doing 'pkcon update' allow the user to specify filters but enforce NEWEST - -diff --git a/client/pk-console.c b/client/pk-console.c -index 2d16ff8..377ce28 100644 ---- a/client/pk-console.c -+++ b/client/pk-console.c -@@ -979,7 +979,7 @@ out: - * pk_console_update_system: - **/ - static gboolean --pk_console_update_system (GError **error) -+pk_console_update_system (PkBitfield filters, GError **error) - { - gboolean ret = TRUE; - gchar **package_ids = NULL; -@@ -987,7 +987,10 @@ pk_console_update_system (GError **error) - PkResults *results; - - /* get the current updates */ -- results = pk_task_get_updates_sync (PK_TASK (task), 0, cancellable, -+ pk_bitfield_add (filters, PK_FILTER_ENUM_NEWEST); -+ results = pk_task_get_updates_sync (PK_TASK (task), -+ filters, -+ cancellable, - (PkProgressCallback) pk_console_progress_cb, NULL, - error); - if (results == NULL) { -@@ -1597,7 +1600,7 @@ main (int argc, char *argv[]) - } else if (strcmp (mode, "update") == 0) { - if (value == NULL) { - /* do the system update */ -- nowait = !pk_console_update_system (&error); -+ nowait = !pk_console_update_system (filters, &error); - } else { - nowait = !pk_console_update_packages (argv+2, &error); - } diff --git a/PackageKit-0.8.1-qt_ULL.patch b/PackageKit-0.8.1-qt_ULL.patch deleted file mode 100644 index f1965cd..0000000 --- a/PackageKit-0.8.1-qt_ULL.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff -up PackageKit-0.8.1/lib/packagekit-qt2/packagedetails.h.ULL PackageKit-0.8.1/lib/packagekit-qt2/packagedetails.h ---- PackageKit-0.8.1/lib/packagekit-qt2/packagedetails.h.ULL 2012-06-22 10:30:52.000000000 -0500 -+++ PackageKit-0.8.1/lib/packagekit-qt2/packagedetails.h 2012-07-12 11:01:32.812483103 -0500 -@@ -62,41 +62,41 @@ public: - * Describes the different package groups - */ - enum Group { -- GroupUnknown = 1UL << 0, -- GroupAccessibility = 1UL << 1, -- GroupAccessories = 1UL << 2, -- GroupAdminTools = 1UL << 3, -- GroupCommunication = 1UL << 4, -- GroupDesktopGnome = 1UL << 5, -- GroupDesktopKde = 1UL << 6, -- GroupDesktopOther = 1UL << 7, -- GroupDesktopXfce = 1UL << 8, -- GroupEducation = 1UL << 9, -- GroupFonts = 1UL << 10, -- GroupGames = 1UL << 11, -- GroupGraphics = 1UL << 12, -- GroupInternet = 1UL << 13, -- GroupLegacy = 1UL << 14, -- GroupLocalization = 1UL << 15, -- GroupMaps = 1UL << 16, -- GroupMultimedia = 1UL << 17, -- GroupNetwork = 1UL << 18, -- GroupOffice = 1UL << 19, -- GroupOther = 1UL << 20, -- GroupPowerManagement = 1UL << 21, -- GroupProgramming = 1UL << 22, -- GroupPublishing = 1UL << 23, -- GroupRepos = 1UL << 24, -- GroupSecurity = 1UL << 25, -- GroupServers = 1UL << 26, -- GroupSystem = 1UL << 27, -- GroupVirtualization = 1UL << 28, -- GroupScience = 1UL << 29, -- GroupDocumentation = 1UL << 30, -- GroupElectronics = 1UL << 31, -- GroupCollections = 1UL << 32, -- GroupVendor = 1UL << 33, -- GroupNewest = 1UL << 34 -+ GroupUnknown = 1ULL << 0, -+ GroupAccessibility = 1ULL << 1, -+ GroupAccessories = 1ULL << 2, -+ GroupAdminTools = 1ULL << 3, -+ GroupCommunication = 1ULL << 4, -+ GroupDesktopGnome = 1ULL << 5, -+ GroupDesktopKde = 1ULL << 6, -+ GroupDesktopOther = 1ULL << 7, -+ GroupDesktopXfce = 1ULL << 8, -+ GroupEducation = 1ULL << 9, -+ GroupFonts = 1ULL << 10, -+ GroupGames = 1ULL << 11, -+ GroupGraphics = 1ULL << 12, -+ GroupInternet = 1ULL << 13, -+ GroupLegacy = 1ULL << 14, -+ GroupLocalization = 1ULL << 15, -+ GroupMaps = 1ULL << 16, -+ GroupMultimedia = 1ULL << 17, -+ GroupNetwork = 1ULL << 18, -+ GroupOffice = 1ULL << 19, -+ GroupOther = 1ULL << 20, -+ GroupPowerManagement = 1ULL << 21, -+ GroupProgramming = 1ULL << 22, -+ GroupPublishing = 1ULL << 23, -+ GroupRepos = 1ULL << 24, -+ GroupSecurity = 1ULL << 25, -+ GroupServers = 1ULL << 26, -+ GroupSystem = 1ULL << 27, -+ GroupVirtualization = 1ULL << 28, -+ GroupScience = 1ULL << 29, -+ GroupDocumentation = 1ULL << 30, -+ GroupElectronics = 1ULL << 31, -+ GroupCollections = 1ULL << 32, -+ GroupVendor = 1ULL << 33, -+ GroupNewest = 1ULL << 34 - }; - typedef qulonglong Groups; - diff --git a/PackageKit.spec b/PackageKit.spec index 2d40760..a9cf37c 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -2,8 +2,8 @@ Summary: Package management service Name: PackageKit -Version: 0.8.1 -Release: 8%{?dist} +Version: 0.8.2 +Release: 1%{?dist} License: GPLv2+ and LGPLv2+ URL: http://www.packagekit.org Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.xz @@ -17,12 +17,6 @@ Patch1: PackageKit-0.4.4-Fedora-turn-off-time.conf.patch # Upstreamable? allow use of xulrunner2 for browser-plugin support Patch4: PackageKit-0.7.4-xulrunner2.patch -# Upstream already -Patch5: PackageKit-0.8.1-master.patch - -# Upstreamable. fix UL vs ULL type mismatch in qt bindings -Patch6: PackageKit-0.8.1-qt_ULL.patch - Requires: %{name}-glib%{?_isa} = %{version}-%{release} Requires: PackageKit-backend Requires: shared-mime-info @@ -261,8 +255,6 @@ user to restart the computer or remove and re-insert the device. %patch0 -p1 -b .fedora %patch1 -p1 -b .no-time %patch4 -p1 -b .xulrunner2 -%patch5 -p1 -b .master -%patch6 -p1 -b .qt_ULL NOCONFIGURE=1 ./autogen.sh %build @@ -475,6 +467,14 @@ update-mime-database %{_datadir}/mime &> /dev/null || : %{_libdir}/pkgconfig/packagekit-plugin.pc %changelog +* Mon Jul 16 2012 Richard Hughes - 0.8.2-1 +- New upstream release +- Bumped sonames for libpackagekit-glib and libpackagekit-qt +- Lots of fixes to systemd-updates offline update functionality +- Remove the Transaction.UpdateSystem() method +- Don't show a warning if /var/run/PackageKit/udev does not exist +- Never run any plugins for simulated actions + * Thu Jul 12 2012 Rex Dieter - 0.8.1-8 - fix UL vs ULL type mismatch in qt bindings (#839712) - tighten subpkg deps with %%_isa diff --git a/sources b/sources index 45f049c..59ff4d0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -6939b904c1b7dd33d1b4f4f9522f8916 PackageKit-0.8.1.tar.xz +7ba2b1eb571daac0890f45da79f7e377 PackageKit-0.8.2.tar.xz