From a00a6a9bd4ce2e19b7d5a3f4733f60a5ee32e221 Mon Sep 17 00:00:00 2001 From: Alejandro del Castillo Date: Mon, 21 Mar 2016 17:33:59 -0500 Subject: [PATCH] buildReplaces: do not add duplicated replacees If package A both replaces and conflicts package B, it is added unconditionally to the replaced_by vector of package B. Add check to only add it if it's not there to avoid inaccurate warnings of the type: Multiple replacers for X, using first one Signed-off-by: Alejandro del Castillo --- libopkg/pkg_depends.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c index 6979f14..711283a 100644 --- a/libopkg/pkg_depends.c +++ b/libopkg/pkg_depends.c @@ -707,8 +707,10 @@ void parse_replacelist(pkg_t *pkg, char *list) /* if a package pkg both replaces and conflicts old_abpkg, * then add it to the replaced_by vector so that old_abpkg * will be upgraded to ab_pkg automatically */ - if (pkg_conflicts_abstract(pkg, old_abpkg)) - abstract_pkg_vec_insert(old_abpkg->replaced_by, ab_pkg); + if (pkg_conflicts_abstract(pkg, old_abpkg)) { + if (!abstract_pkg_vec_contains(old_abpkg->replaced_by, ab_pkg)) + abstract_pkg_vec_insert(old_abpkg->replaced_by, ab_pkg); + } replaces = tmp; replaces[count - 1] = old_abpkg; -- 2.25.1