buildReplaces: do not add duplicated replacees
[project/opkg-lede.git] / libopkg / pkg_depends.c
index 6979f14b5af9d2adb1ce05e48acb090505a55ec5..711283ae874872ba16a1e206c88905d504e6499b 100644 (file)
@@ -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;