From a94fa1878df9ffe2b9a4f04733d4a58c8f0cd2e0 Mon Sep 17 00:00:00 2001 From: Sertonix <sertonix@posteo.net> Date: Sat, 8 Mar 2025 14:33:15 +0100 Subject: [PATCH] pkg: move same origin check after replaces check Otherwise replaces and replaces_priority doesn't work when packages have the same origin. Fixes https://gitlab.alpinelinux.org/alpine/aports/-/issues/16924 --- src/package.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/package.c b/src/package.c index fc1de78e..503d2e6c 100644 --- a/src/package.c +++ b/src/package.c @@ -958,9 +958,6 @@ int apk_pkg_replaces_file(const struct apk_package *a, const struct apk_package /* Upgrading package? */ if (a->name == b->name) return APK_PKG_REPLACES_YES; - /* Or same source package? */ - if (a->origin && a->origin == b->origin) return APK_PKG_REPLACES_YES; - /* Does the original package replace the new one? */ apk_array_foreach(dep, a->ipkg->replaces) { if (apk_dep_is_materialized(dep, b)) { @@ -984,6 +981,9 @@ int apk_pkg_replaces_file(const struct apk_package *a, const struct apk_package * the file without warnings. */ if (b_prio >= 0) return APK_PKG_REPLACES_YES; + /* Or same source package? */ + if (a->origin && a->origin == b->origin) return APK_PKG_REPLACES_YES; + /* Both ship same file, but metadata is inconclusive. */ return APK_PKG_REPLACES_CONFLICT; } -- GitLab