From patchwork Thu Jul 16 14:34:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Stadler X-Patchwork-Id: 1330331 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=student.uibk.ac.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=A0Y0eu4m; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B6xfp5XHWz9sRN for ; Fri, 17 Jul 2020 00:37:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VDy1A4FGmmw57bg6K8loBUL/ovH/xfoUyUNnq2m8cck=; b=A0Y0eu4mRBKj/kmTCVYL2D99gx nhsViO+Tuvmea5Mpz5sq6SwPWzRyOQI7Iedix171olxtpU+w1aF4UbxsJsphRbVo2bRrKgiaiBsqN oAZaJDO37suaGdcsl9cm9p/R/kCg5HRhHYunl0Ix93ElvyGvnjmagP+7LRZ1/ryd/16FQmljlAWCF 3R8MxQ4idSW9SEPDUXB60qg8Z2g6SBmSoIfe8Vd7wtfdlVEgoU4AEJ5DwJk00l++1IqBy8Qp/Wfvi seVgrHLH1/Kg8EWjn3YH5q1Y4hrXO9oiaSeqc8bXEynuRjPDHHpysfk+RmCJbP7x+wdz4Ykjc1TyU uRu/RnwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4zl-0008Qh-1T; Thu, 16 Jul 2020 14:36:21 +0000 Received: from lmr1.uibk.ac.at ([138.232.1.142] helo=smtp.uibk.ac.at) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4zi-0008Po-DQ for openwrt-devel@lists.openwrt.org; Thu, 16 Jul 2020 14:36:19 +0000 Received: from localhost.localdomain (ipbcc1ad47.dynamic.kabel-deutschland.de [188.193.173.71]) (authenticated bits=0) by smtp.uibk.ac.at (8.14.4/8.14.4/F1) with ESMTP id 06GEaB7n027994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jul 2020 16:36:16 +0200 From: Peter Stadler To: openwrt-devel@lists.openwrt.org Subject: [PATCH] opkg: prioritize the latest provider (not the first) Date: Thu, 16 Jul 2020 16:34:45 +0200 Message-Id: <20200716143444.77470-1-peter.stadler@student.uibk.ac.at> X-Mailer: git-send-email 2.25.3 MIME-Version: 1.0 X-Spam-Score: () -15.0 ALL_TRUSTED,RCV_SMTP_AUTH,RCV_SMTP_UIBK X-Scanned-By: MIMEDefang 2.84 at uibk.ac.at X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200716_103618_695073_3FD65AB2 X-CRM114-Status: GOOD ( 11.81 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [138.232.1.142 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [138.232.1.142 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Stadler Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Hi, this is now the right patch that does: Set `priorized_matching` to the latest provider with maximum priority, such that it is similar to the other selections (especially `good_pkg_by_name`). So, we have consistency between using `opkg install apkg` and installing a package that `DEPENDS:=+apkg` (if there are two providers for `apkg`). All the best, Peter Signed-off-by: Peter Stadler --- libopkg/pkg_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index 52c64ff..f564b6f 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -440,7 +440,7 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(abstract_pkg_t * apkg, for (i = 0; i < matching_pkgs->len; i++) { pkg_t *matching = matching_pkgs->pkgs[i]; arch_priority = pkg_get_arch_priority(matching); - if (arch_priority > prio) { + if (arch_priority >= prio) { priorized_matching = matching; prio = arch_priority; opkg_msg(DEBUG, "Match %s with priority %i.\n",