From f09eab62cd55df123ccb988ed7c823f710025b49 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 1 Nov 2013 18:05:11 +0100 Subject: [PATCH] Fix #18. An ATF test-case will be imported in a while. --- lib/package_conflicts.c | 20 +++++++++++++++++++- lib/transaction_dictionary.c | 5 ++++- lib/transaction_ops.c | 5 ----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/package_conflicts.c b/lib/package_conflicts.c index b257e9ba..a784d63c 100644 --- a/lib/package_conflicts.c +++ b/lib/package_conflicts.c @@ -37,7 +37,7 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, xbps_dictionary_t pkg_repod) { xbps_array_t pkg_cflicts, trans_cflicts; - xbps_dictionary_t pkgd; + xbps_dictionary_t pkgd, tpkgd; xbps_object_t obj; xbps_object_iterator_t iter; const char *cfpkg, *repopkgver, *pkgver; @@ -71,6 +71,24 @@ xbps_pkg_find_conflicts(struct xbps_handle *xhp, free(pkgname); continue; } + /* + * If there's an update for the conflicting pkg in + * the transaction and does not match the pattern, + * ignore it. + */ + if ((tpkgd = xbps_find_pkg_in_array(unsorted, pkgname))) { + const char *tract, *p; + + xbps_dictionary_get_cstring_nocopy(tpkgd, + "transaction", &tract); + xbps_dictionary_get_cstring_nocopy(tpkgd, + "pkgver", &p); + if ((xbps_pkgpattern_match(p, cfpkg) == 0) && + (strcmp(tract, "update") == 0)) { + free(pkgname); + continue; + } + } free(pkgname); xbps_dbg_printf(xhp, "found conflicting installed " "pkg %s with pkg in transaction %s\n", pkgver, diff --git a/lib/transaction_dictionary.c b/lib/transaction_dictionary.c index 476b8513..95c1404e 100644 --- a/lib/transaction_dictionary.c +++ b/lib/transaction_dictionary.c @@ -237,7 +237,7 @@ xbps_transaction_init(struct xbps_handle *xhp) int xbps_transaction_prepare(struct xbps_handle *xhp) { - xbps_array_t mdeps, conflicts; + xbps_array_t pkgs, mdeps, conflicts; int rv = 0; if (xhp->transd == NULL) @@ -251,6 +251,9 @@ xbps_transaction_prepare(struct xbps_handle *xhp) if (xbps_array_count(mdeps)) return ENODEV; + pkgs = xbps_dictionary_get(xhp->transd, "unsorted_deps"); + for (unsigned int i = 0; i < xbps_array_count(pkgs); i++) + xbps_pkg_find_conflicts(xhp, pkgs, xbps_array_get(pkgs, i)); /* * If there are package conflicts bail out. */ diff --git a/lib/transaction_ops.c b/lib/transaction_ops.c index 36aa045d..6e50f9d7 100644 --- a/lib/transaction_ops.c +++ b/lib/transaction_ops.c @@ -118,11 +118,6 @@ trans_find_pkg(struct xbps_handle *xhp, const char *pkg, int action) return rv; unsorted = xbps_dictionary_get(xhp->transd, "unsorted_deps"); - /* - * Find out if package has matched conflicts. - */ - xbps_pkg_find_conflicts(xhp, unsorted, pkg_repod); - /* * Find out if package being updated matches the one already * in transaction, in that case ignore it.