X-Loop: help-debbugs@HIDDEN Subject: [bug#75496] [PATCH rust-team 1/2] import: crate: Fix find-package-version. Resent-From: Herman Rimm <herman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: divya@HIDDEN, efraim@HIDDEN, guix-patches@HIDDEN Resent-Date: Sat, 11 Jan 2025 14:39:02 +0000 Resent-Message-ID: <handler.75496.B.173660630029755 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 75496 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75496 <at> debbugs.gnu.org Cc: Divya Ranjan Pattanaik <divya@HIDDEN>, Efraim Flashner <efraim@HIDDEN> X-Debbugs-Original-To: guix-patches@HIDDEN X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik <divya@HIDDEN>, Efraim Flashner <efraim@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.173660630029755 (code B ref -1); Sat, 11 Jan 2025 14:39:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Jan 2025 14:38:20 +0000 Received: from localhost ([127.0.0.1]:41867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tWcd2-0007jq-43 for submit <at> debbugs.gnu.org; Sat, 11 Jan 2025 09:38:20 -0500 Received: from lists.gnu.org ([2001:470:142::17]:39666) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <herman@HIDDEN>) id 1tWccz-0007jQ-68 for submit <at> debbugs.gnu.org; Sat, 11 Jan 2025 09:38:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <herman@HIDDEN>) id 1tWcct-0004Ze-Bz for guix-patches@HIDDEN; Sat, 11 Jan 2025 09:38:11 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117] helo=email.rimm.ee) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from <herman@HIDDEN>) id 1tWccr-0005fL-Iy for guix-patches@HIDDEN; Sat, 11 Jan 2025 09:38:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1736606277; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=K1XeMTActiImi3wJ7Y1OBTpgg24bFtJz0etZ3mTKBjA=; b=o45d013t1UCzbZRINVKKoxuAyeeLWqhQhYAPzPBqGcgcTNQ0zUWYlp2ckQ3WbicswX9/QJ mGJB+DoQLmHPhjlfqeG8LcrqmAPf7HdYwQMx5COhP/hUVBf1ChwA6r2ZKphPZTw7q8N0D4 2zF7E1jT3VpWkKdEva2TsrbR/ToUoFRlb6EOwegyt2QIsaAyj6UJh+aCVLtJWJJN2irF6v ciPt8m1H5n3uxFzr01OjSPeEk4Oej3nbhNF92IXTfxNgUM8mDGC/yG4HaQzWWExtqDCqCr x1leb2lA1JDNcCQT4H/4O6PYyyMurwfKQNbTF2fWiIi0aPgl/vQy63EuEoazdg== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 3e852fc9 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <guix-patches@HIDDEN>; Sat, 11 Jan 2025 14:37:57 +0000 (UTC) From: Herman Rimm <herman@HIDDEN> Date: Sat, 11 Jan 2025 15:37:06 +0100 Message-ID: <9fab183f6a0ee9be09769e7f776f0b9c615b2c97.1736606198.git.herman@HIDDEN> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=81.205.150.117; envelope-from=herman@HIDDEN; helo=email.rimm.ee X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) Fixes bug from 5ce1512b0f68cf39cb399623a14302f309c06129, where the earliest existing package (if any) was returned instead. See also: https://issues.guix.gnu.org/68346#3-lineno97 * guix/import/crate.scm (crate->guix-package)[find-package-version]: Invert boolean expression. Change-Id: I1d05f55a027241e7c5f62cc98a50a09b5639bdcf --- guix/import/crate.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index b4806c8bb22..a7134b85722 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -335,9 +335,9 @@ (define* (crate->guix-package (find-packages-by-name (crate-name->package-name name)))) (match-lambda* (((semver1 yanked1) (semver2 yanked2)) - (or (and yanked1 (not yanked2)) - (and (eq? yanked1 yanked2) - (semver<? semver1 semver2)))))))) + (and (or (not yanked1) yanked2) + (or (not (eq? yanked1 yanked2)) + (semver>? semver1 semver2)))))))) (and (not (eq? #f version)) (match-let (((semver yanked) version)) (list (semver->string semver) yanked))))) base-commit: 986245daca2fb50d58cf0f2b9273f0d670d38af2 -- 2.47.1
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Herman Rimm <herman@HIDDEN> Subject: bug#75496: Acknowledgement ([PATCH rust-team 1/2] import: crate: Fix find-package-version.) Message-ID: <handler.75496.B.173660630029755.ack <at> debbugs.gnu.org> References: <9fab183f6a0ee9be09769e7f776f0b9c615b2c97.1736606198.git.herman@HIDDEN> X-Gnu-PR-Message: ack 75496 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 75496 <at> debbugs.gnu.org Date: Sat, 11 Jan 2025 14:39:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to Divya Ranjan Pattanaik <divya@HIDDEN>, Efraim Flashner <efraim@= flashner.co.il> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): guix-patches@HIDDEN If you wish to submit further information on this problem, please send it to 75496 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 75496: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D75496 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: [bug#75496] [PATCH rust-team 2/2] import: crate: Refactor find-package-version. Resent-From: Herman Rimm <herman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: divya@HIDDEN, efraim@HIDDEN, guix-patches@HIDDEN Resent-Date: Sat, 11 Jan 2025 14:40:01 +0000 Resent-Message-ID: <handler.75496.B75496.173660639129983 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 75496 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75496 <at> debbugs.gnu.org Cc: Divya Ranjan Pattanaik <divya@HIDDEN>, Efraim Flashner <efraim@HIDDEN> X-Debbugs-Original-Xcc: Divya Ranjan Pattanaik <divya@HIDDEN>, Efraim Flashner <efraim@HIDDEN> Received: via spool by 75496-submit <at> debbugs.gnu.org id=B75496.173660639129983 (code B ref 75496); Sat, 11 Jan 2025 14:40:01 +0000 Received: (at 75496) by debbugs.gnu.org; 11 Jan 2025 14:39:51 +0000 Received: from localhost ([127.0.0.1]:41875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tWceV-0007nW-5n for submit <at> debbugs.gnu.org; Sat, 11 Jan 2025 09:39:51 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:58497 helo=email.rimm.ee) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <herman@HIDDEN>) id 1tWceS-0007nE-CP for 75496 <at> debbugs.gnu.org; Sat, 11 Jan 2025 09:39:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1736606375; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=79nAioYyOH9GbdjHXBspKMOgbXNjMdrYRf/w028cP+c=; b=fj1MQ5Dj59fDc2HJ2fQP2xpG3SeNSb+pUW8XeCVG463evNf+2cqlRjAnRd8p6Bcnlgc9Lc tnwYIWZvTjSm12HGTC3W9rROxUkHYFV030e7VIqyevIlRtNk+5qpf+jRL6KnWrKaVsyP/q g1KeQ4X+cXR3iUfFFUxc0a0SjEtdeYa/i6iyJRrzkTY3LMBRV/FgfdzVV9wGcnd/+y8Xaa 6+YsAENaaTnjd1sHo+mbLXsK+HyRI7e700pvoo8HBSCgD2/dtG2LSahALcVZ2zOISumn3s 3lsdM3ElrcP6vUgdqXnaf3VbPzWqGI9IxeOMowVHNoQ/1xqCXwAxrydGJsoH1Q== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id 9b7a4967 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO) for <75496 <at> debbugs.gnu.org>; Sat, 11 Jan 2025 14:39:35 +0000 (UTC) From: Herman Rimm <herman@HIDDEN> Date: Sat, 11 Jan 2025 15:38:48 +0100 Message-ID: <991ead37c954cea75fff524f1fad2c8d88c8e5bf.1736606198.git.herman@HIDDEN> X-Mailer: git-send-email 2.47.1 In-Reply-To: <9fab183f6a0ee9be09769e7f776f0b9c615b2c97.1736606198.git.herman@HIDDEN> References: <9fab183f6a0ee9be09769e7f776f0b9c615b2c97.1736606198.git.herman@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) * guix/import/crate.scm (crate->guix-package)[find-package-version]: Move to top-level. [dependency-name+version+yanked]: Adjust. (find-package-version): Take allow-yanked? argument. Use (let) loop, match, if instead of map, filter, min-element. Change-Id: I1d05f55a027241e7c5f62cc98a50a09b5639bdcf --- guix/import/crate.scm | 55 ++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index a7134b85722..d790126ef6e 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2023 Simon Tournier <zimon.toutoune@HIDDEN> ;;; Copyright © 2023, 2024 Efraim Flashner <efraim@HIDDEN> ;;; Copyright © 2023, 2024 David Elsing <david.elsing@HIDDEN> +;;; Copyright © 2025 Herman Rimm <herman@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -290,6 +291,31 @@ (define (nonyanked-crate-versions crate) (not (crate-version-yanked? entry))) (crate-versions crate))) +(define (find-package-version name range allow-yanked?) + "Find the latest existing package that fulfills the SemVer RANGE. If +ALLOW-YANKED? is #t, include packages marked as yanked at a lower +priority." + (set! range (string->semver-range range)) + (let loop ((packages (find-packages-by-name + (crate-name->package-name name))) + (semver #f) + (yanked? #f)) + (match packages + ((pkg packages ...) + (let ((pkg-yanked? (assoc-ref (package-properties pkg) + 'crate-version-yanked?))) + (if (or allow-yanked? (not pkg-yanked?)) + (let ((pkg-semver (string->semver (package-version pkg)))) + (if (and (or (not semver) + (and yanked? (not pkg-yanked?)) + (and (eq? yanked? pkg-yanked?) + (semver>? pkg-semver semver))) + (semver-range-contains? range pkg-semver)) + (loop packages pkg-semver pkg-yanked?) + (loop packages semver yanked?))) + (loop packages semver yanked?)))) + (() (and semver (list (semver->string semver) yanked?)))))) + (define* (crate->guix-package crate-name #:key version include-dev-deps? allow-yanked? #:allow-other-keys) @@ -316,32 +342,6 @@ (define* (crate->guix-package (or version (crate-latest-version crate)))) - ;; Find the highest existing package that fulfills the semver <range>. - ;; Packages previously marked as yanked take lower priority. - (define (find-package-version name range) - (let* ((semver-range (string->semver-range range)) - (version - (min-element - (filter (match-lambda ((semver yanked) - (and - (or allow-yanked? (not yanked)) - (semver-range-contains? semver-range semver)))) - (map (lambda (pkg) - (let ((version (package-version pkg))) - (list - (string->semver version) - (assoc-ref (package-properties pkg) - 'crate-version-yanked?)))) - (find-packages-by-name - (crate-name->package-name name)))) - (match-lambda* (((semver1 yanked1) (semver2 yanked2)) - (and (or (not yanked1) yanked2) - (or (not (eq? yanked1 yanked2)) - (semver>? semver1 semver2)))))))) - (and (not (eq? #f version)) - (match-let (((semver yanked) version)) - (list (semver->string semver) yanked))))) - ;; Find the highest version of a crate that fulfills the semver <range>. ;; If no matching non-yanked version has been found and allow-yanked? is #t, ;; also consider yanked packages. @@ -361,7 +361,8 @@ (define* (crate->guix-package (define (dependency-name+version+yanked dep) (let* ((name (crate-dependency-id dep)) (req (crate-dependency-requirement dep)) - (existing-version (find-package-version name req))) + (existing-version + (find-package-version name req allow-yanked?))) (if (and existing-version (not (second existing-version))) (cons name existing-version) (let* ((crate (lookup-crate* name)) -- 2.47.1
X-Loop: help-debbugs@HIDDEN Subject: [bug#75496] Acknowledgement ([PATCH rust-team 1/2] import: crate: Fix find-package-version.) Resent-From: Herman Rimm <herman@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: guix-patches@HIDDEN Resent-Date: Sat, 11 Jan 2025 15:58:02 +0000 Resent-Message-ID: <handler.75496.B75496.173661106017151 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 75496 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75496 <at> debbugs.gnu.org Cc: Efraim Flashner <efraim@HIDDEN>, Divya Ranjan Pattanaik <divya@HIDDEN> Received: via spool by 75496-submit <at> debbugs.gnu.org id=B75496.173661106017151 (code B ref 75496); Sat, 11 Jan 2025 15:58:02 +0000 Received: (at 75496) by debbugs.gnu.org; 11 Jan 2025 15:57:40 +0000 Received: from localhost ([127.0.0.1]:44546 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tWdro-0004SZ-2a for submit <at> debbugs.gnu.org; Sat, 11 Jan 2025 10:57:40 -0500 Received: from 81-205-150-117.fixed.kpn.net ([81.205.150.117]:49175 helo=email.rimm.ee) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <herman@HIDDEN>) id 1tWdrl-0004S0-7z for 75496 <at> debbugs.gnu.org; Sat, 11 Jan 2025 10:57:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rimm.ee; s=herman; t=1736611049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YOK82FMwvYehJGwO2t1pQ5XjlGCN5SYXdVvRuJO8koM=; b=c8EzbXUeZx0XZnnuDpvVGTZKQB8swVx7WSmAV5+jPdGx6lIi/X4gSvDJyxWg3rs9FT4q/0 t/NfoDv9WkTZdNs4GNENUF+T7+U77A9gndC9o0X5ue2ZEn5ywxOFJnTESz3lIztHoFvNKT zW59Hy7ZGzFKi9HH6smM+GOLDLWr2BuM4vbofDSjhG7OkHwTgLIz+7qL5JBoh/3b5cUJth FjrE3VK/pSYh8nerd/iA3oprekBbnB9d0V4JOoaXu8ALarLW/UtxMM19J47dYHLVk56mlx qWst45TcjYnkrA68B0MgnB8rJViElEhV3RzyHv/PadUUa3RM751Pr3tMuv7c8Q== Received: by 81-205-150-117.fixed.kpn.net (OpenSMTPD) with ESMTPSA id ffacd474 (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Sat, 11 Jan 2025 15:57:29 +0000 (UTC) Date: Sat, 11 Jan 2025 16:56:42 +0100 From: Herman Rimm <herman@HIDDEN> Message-ID: <z2xhrlh7mzs3c6uu2mpnlvvuihgo2afshzuo5lcm74ejbip7ep@nqkue6qdej3k> References: <9fab183f6a0ee9be09769e7f776f0b9c615b2c97.1736606198.git.herman@HIDDEN> <handler.75496.B.173660630029755.ack <at> debbugs.gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <handler.75496.B.173660630029755.ack <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Can [PATCH 1/2] be applied/merged to the master branch as well? Cheers, Herman
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.