From patchwork Thu Jul 16 14:28:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Stadler X-Patchwork-Id: 1330326 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=1oipREyd; 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 4B6xXc75Rvz9sRN for ; Fri, 17 Jul 2020 00:32:00 +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=7dvu1RGiaPnm4VxXlMIpnxYX9Y9TSxFH7Q3ROfEACgk=; b=1oipREydiOb1EjJqF/nHCdbyxA DfVlQCGo14W189KFEa1hNwz1b5lrK68tPjAIogzuPZ/kuzqKHt1g88U6pWvjOB0LMcOUV60Hh/doC kcHUhkQlMVfoqdYBWlO+wHT0QrYFISCJQwPEh6pnNl1LOLa6OVPxxBJmlunNd505nwPRI1PXDrqcm Gfl3JluqXzQEKIsKZpAB8crpWzDXOKtXY/SDYUM8TiE7vxX3naFvL9RGcII5NUIyYh6oIGOhnE4O/ TFHxmIthU5pyu6TET8mM8vnNMdZihfULzN37pE4nCBRimJlUWtG0XqRsGW44myVPiGgUlz1XHUzm8 CjhLM5+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jw4tZ-00075W-0h; Thu, 16 Jul 2020 14:29:57 +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 1jw4tW-00074M-2v for openwrt-devel@lists.openwrt.org; Thu, 16 Jul 2020 14:29:55 +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 06GETevv025732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 16 Jul 2020 16:29:48 +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:28:55 +0200 Message-Id: <20200716142855.77226-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_102954_364334_AFE9892C X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. 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 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`). Signed-off-by: Peter Stadler --- libopkg/pkg_hash.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c index 52c64ff..9b22f01 100644 --- a/libopkg/pkg_hash.c +++ b/libopkg/pkg_hash.c @@ -410,10 +410,15 @@ pkg_t *pkg_hash_fetch_best_installation_candidate(abstract_pkg_t * apkg, if (constraint_fcn(matching, cdata)) { opkg_msg(DEBUG, "Candidate: %s %s.\n", matching->name, pkg_get_string(matching, PKG_VERSION)); - good_pkg_by_name = matching; + /* Select the first (the same as for priorized_matching) */ + if (good_pkg_by_name == NULL) { + good_pkg_by_name = matching; + } /* It has been provided by hand, so it is what user want */ - if (matching->provided_by_hand == 1) + if (matching->provided_by_hand == 1) { + good_pkg_by_name = matching; break; + } } }