From: Alejandro del Castillo Date: Mon, 21 Mar 2016 22:33:59 +0000 (-0500) Subject: buildReplaces: do not add duplicated replacees X-Git-Url: https://git.librecmc.org/?p=oweals%2Fopkg-lede.git;a=commitdiff_plain;h=a00a6a9bd4ce2e19b7d5a3f4733f60a5ee32e221 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 --- 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;