From ed06f531d5752487a4bfed8970f1b9b7a6fb331d Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Sun, 29 Jun 2014 21:34:03 +0300 Subject: [PATCH 2/2] Improve rpm callback handling for packages in the cleanup state Try harder to find the matching HyPackage when RPM doesn't tell us the filename of the package that's getting removed. During updates when older packages are getting auto-removed, RPM doesn't tell us the filenames of cleaned up packages, and we have to look them up in the remove_helper array instead. https://bugs.freedesktop.org/show_bug.cgi?id=80689 --- libhif/hif-transaction.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/libhif/hif-transaction.c b/libhif/hif-transaction.c index 4009319..be6c3b5 100644 --- a/libhif/hif-transaction.c +++ b/libhif/hif-transaction.c @@ -607,27 +607,22 @@ hif_transaction_ts_progress_cb (const void *arg, case RPMCALLBACK_UNINST_START: - /* invalid? */ - if (filename == NULL) { - g_debug ("no filename set in uninst-start with total %i", - (gint32) total); + /* find pkg */ + pkg = hif_find_pkg_from_header (priv->remove, hdr); + if (pkg == NULL && filename != NULL) { + pkg = hif_find_pkg_from_filename_suffix (priv->remove, + filename); + } + if (pkg == NULL && name != NULL) + pkg = hif_find_pkg_from_name (priv->remove, name); + if (pkg == NULL && name != NULL) + pkg = hif_find_pkg_from_name (priv->remove_helper, name); + if (pkg == NULL) { + g_warning ("cannot find %s in uninst-start", name); priv->step = HIF_TRANSACTION_STEP_WRITING; break; } - /* find pkg */ - pkg = hif_find_pkg_from_name (priv->remove, name); - if (pkg != NULL) - pkg = hif_find_pkg_from_name (priv->remove_helper, name); - if (pkg == NULL) { - pkg = hif_find_pkg_from_filename_suffix (priv->remove, - filename); - } - if (pkg == NULL) { - g_debug ("cannot find %s", filename); - break; - } - /* map to correct action code */ action = hif_package_get_action (pkg); if (action == HIF_STATE_ACTION_UNKNOWN) @@ -708,12 +703,18 @@ hif_transaction_ts_progress_cb (const void *arg, if (pkg == NULL && name != NULL) pkg = hif_find_pkg_from_name (priv->remove_helper, name); if (pkg == NULL) { - g_warning ("cannot find %s", name); + g_warning ("cannot find %s in uninst-progress", name); break; } + + /* map to correct action code */ + action = hif_package_get_action (pkg); + if (action == HIF_STATE_ACTION_UNKNOWN) + action = HIF_STATE_ACTION_REMOVE; + hif_state_set_package_progress (priv->state, hif_package_get_id (pkg), - HIF_STATE_ACTION_REMOVE, + action, percentage); break; -- 2.0.0