From c457b594aa29b6980e3887ee309d2df96a89884c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 14 Oct 2015 11:46:56 +0200 Subject: [PATCH] libxbps: fix eudev-libgudev -> libgudev fallout. Packages to be replaced must be collected *before* checking for broken reverse dependencies, otherwise them will always be detected as broken. --- NEWS | 3 +++ lib/transaction_dictionary.c | 16 ++++++++-------- lib/transaction_package_replace.c | 1 + lib/transaction_revdeps.c | 4 ++++ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 747111d6..03d16ef9 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.48 (???): + * libxbps: fix a bug where broken reverse dependencies would be detected + before detecting packages that need to be replaced in transaction. + * xbps-query(1): fail if unused arguments are supplied. * libxbps: relative cachedir set via xbps.d(5) now work correctly. diff --git a/lib/transaction_dictionary.c b/lib/transaction_dictionary.c index a2e30d07..222d49eb 100644 --- a/lib/transaction_dictionary.c +++ b/lib/transaction_dictionary.c @@ -299,6 +299,14 @@ xbps_transaction_prepare(struct xbps_handle *xhp) } xbps_object_release(edges); + /* + * Check for packages to be replaced. + */ + if ((rv = xbps_transaction_package_replace(xhp, pkgs)) != 0) { + xbps_object_release(xhp->transd); + xhp->transd = NULL; + return rv; + } /* * If there are missing deps or revdeps bail out. */ @@ -330,14 +338,6 @@ xbps_transaction_prepare(struct xbps_handle *xhp) return ENOEXEC; } } - /* - * Check for packages to be replaced. - */ - if ((rv = xbps_transaction_package_replace(xhp, pkgs)) != 0) { - xbps_object_release(xhp->transd); - xhp->transd = NULL; - return rv; - } /* * Add transaction stats for total download/installed size, * number of packages to be installed, updated, configured diff --git a/lib/transaction_package_replace.c b/lib/transaction_package_replace.c index d8f898de..2f3502d9 100644 --- a/lib/transaction_package_replace.c +++ b/lib/transaction_package_replace.c @@ -121,6 +121,7 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs) */ xbps_dictionary_set_cstring_nocopy(instd, "transaction", "remove"); + xbps_dictionary_set_bool(instd, "replaced", true); if (!xbps_array_add_first(pkgs, instd)) { xbps_object_iterator_release(iter); free(pkgname); diff --git a/lib/transaction_revdeps.c b/lib/transaction_revdeps.c index f9659962..ff44d96f 100644 --- a/lib/transaction_revdeps.c +++ b/lib/transaction_revdeps.c @@ -166,6 +166,10 @@ xbps_transaction_revdeps(struct xbps_handle *xhp, xbps_array_t pkgs) * the transaction. */ if (strcmp(tract, "remove") == 0) { + if (xbps_dictionary_get(obj, "replaced")) { + free(pkgname); + continue; + } if (xbps_find_pkg_in_array(pkgs, pkgname, "remove")) { free(pkgname); continue;