main/apk-tools: fix apk fetch with single-provider virtuals

This commit is contained in:
William Pitcock 2018-02-21 15:41:41 +00:00
parent 0ea445ac01
commit 983a134571
2 changed files with 61 additions and 2 deletions

View File

@ -0,0 +1,57 @@
From 0dcbd933c8d3d305395a99b7b1690a187ce5ec8c Mon Sep 17 00:00:00 2001
From: William Pitcock <nenolod@dereferenced.org>
Date: Wed, 21 Feb 2018 15:35:53 +0000
Subject: [PATCH] solver: allow names with only one provider to be autoselected
regardless of priority
---
src/solver.c | 5 +++--
test/provides.repo | 9 ++++++++-
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/solver.c b/src/solver.c
index 91e5958..d27a7a3 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -671,11 +671,12 @@ static void select_package(struct apk_solver_state *ss, struct apk_name *name)
(!p->pkg->ss.iif_triggered ||
!p->pkg->ss.tag_ok))
continue;
- /* Virtual packages without provider_priority cannot be autoselected */
+ /* Virtual packages without provider_priority cannot be autoselected,
+ * unless there is only one provider */
if (p->version == &apk_null_blob &&
p->pkg->name->auto_select_virtual == 0 &&
p->pkg->name->ss.requirers == 0 &&
- p->pkg->provider_priority == 0)
+ (p->pkg->provider_priority == 0 && name->providers->num > 1))
continue;
if (compare_providers(ss, p, &chosen) > 0)
chosen = *p;
diff --git a/test/provides.repo b/test/provides.repo
index 58bd416..358151e 100644
--- a/test/provides.repo
+++ b/test/provides.repo
@@ -82,7 +82,7 @@ P:conflicted-provider-b
V:0.1
S:1
I:1
-p:conflicted-provider
+p:conflicted-provider conflicted-provider-2
C:Q1EyN5AdpAOBJWKMR89ppC66ccccj=
P:conflicted-dep
@@ -104,3 +104,10 @@ V:0.1
S:1
I:1
p:self-provide
+
+C:Q1EyN5AdpAOBJWKMR89ppC66eeeej=
+P:conflicted-dep-2
+V:0.1
+S:1
+I:1
+D:conflicted-provider-2
--
2.16.1

View File

@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.9.1
pkgrel=0
pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
@ -13,6 +13,7 @@ if [ "$CBUILD" = "$CHOST" ]; then
makedepends="$makedepends lua5.2-dev"
fi
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
0001-solver-allow-names-with-only-one-provider-to-be-auto.patch
"
url="https://git.alpinelinux.org/cgit/apk-tools/"
@ -82,4 +83,5 @@ luaapk() {
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/
}
sha512sums="4ffb8d1716bbb94421b1cc4277beb47d369c429f4c3bf597d08949abb7586d30c4504edf2f775bea3b93614a280c12391b956ca8f914fb0ec27799a4a005a145 apk-tools-2.9.1.tar.xz"
sha512sums="4ffb8d1716bbb94421b1cc4277beb47d369c429f4c3bf597d08949abb7586d30c4504edf2f775bea3b93614a280c12391b956ca8f914fb0ec27799a4a005a145 apk-tools-2.9.1.tar.xz
5ca2d2f2646032ed8f9f86357e986b054045a80ddb944be6a540566ff7092f38591ec8dfc7ac06b9daededa95e86c0e892ead55f9e8907eb318aed76644f7f97 0001-solver-allow-names-with-only-one-provider-to-be-auto.patch"