From unknown Fri Jun 20 07:15:29 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#67960 <67960@debbugs.gnu.org> To: bug#67960 <67960@debbugs.gnu.org> Subject: Status: [PATCH 0/4] Improve the crate importer. Reply-To: bug#67960 <67960@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:15:29 +0000 retitle 67960 [PATCH 0/4] Improve the crate importer. reassign 67960 guix-patches submitter 67960 David Elsing severity 67960 normal tag 67960 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 16:59:48 2023 Received: (at submit) by debbugs.gnu.org; 21 Dec 2023 21:59:48 +0000 Received: from localhost ([127.0.0.1]:45608 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR52-0001zo-EB for submit@debbugs.gnu.org; Thu, 21 Dec 2023 16:59:48 -0500 Received: from lists.gnu.org ([2001:470:142::17]:48162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR50-0001zb-L5 for submit@debbugs.gnu.org; Thu, 21 Dec 2023 16:59:47 -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 ) id 1rGR4q-0003m0-EN for guix-patches@gnu.org; Thu, 21 Dec 2023 16:59:36 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rGR4o-00036f-7R for guix-patches@gnu.org; Thu, 21 Dec 2023 16:59:36 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id B82BE240101 for ; Thu, 21 Dec 2023 22:59:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703195967; bh=3KFATatliYlf/3vBo/K0V+oTi8dAQxTPik2/oTBsKd8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=o8lM8t44Ao9sKbI+AlN4cOFbF/csvAnjk32DkGkKt4nUbdVnB8AIIPnUEbsJs5CaG rMzW6eHvS2EJ+hg/EYHBaw92n9ZR+KBr8t1iHOL2OnBpPdSREZb3kFaRy2+YGphLR9 a+SrqVdeQEAMlcqXtTqPtiHREbwAb4kPdfGJ68TpR/Z/XuCG7cWkPcUaG4U2hqVcYn SjGpkMGunr+5flgaGg/BURiLN/Ab0YHJSWieRPIyZplQVOfixlNoIcCuCICexvnLZt bbdQzZcxvRtBgwHpAco/K9ZCROvtIUEmGIJGB+K6RExhFU9z5tpHlNr0FCW13eJQLC mDqfWJM2jzvgQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sx48b1mwLz6tvt; Thu, 21 Dec 2023 22:59:26 +0100 (CET) From: David Elsing To: guix-patches@gnu.org Subject: [PATCH 0/4] Improve the crate importer. Date: Thu, 21 Dec 2023 21:59:02 +0000 Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=185.67.36.66; envelope-from=david.elsing@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: David Elsing X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This patch series contains improvements to the crate importer. The first patch fixes the memoization in crate-recursive-import. The second patch allows for including the cargo-development-inputs also in recursively imported crates by specifying --recursive-dev-dependencies, such that the tests of all imported crates can be run. The third patch removes the dependency of a test in tests/crate.scm on an existing crate in gnu/packages/crates.io. Sometimes, it can happen that a crate requires a dependency for which only a yanked version exists, which is addressed in the fourth patch. Instead of simply failing, I changed the behavior to also import yanked versions if no non-yanked version exists. Then, they can be used anyway or be manually patched out from the dependent packages. Their packages obtain a different package name (including the full version) and a package property marking them as yanked. The logic to decide which version to use naturally became more complicated as a result. David Elsing (4): gnu: import: Fix memoization in crate-recursive-import. import: crate: Optionally import dev-dependencies recursively. tests: Mock find-packages-by-name in crate importer test. guix: import: Optionally import necessary yanked crates. doc/guix.texi | 7 + guix/import/crate.scm | 161 +++++++--- guix/read-print.scm | 1 + guix/scripts/import/crate.scm | 24 +- tests/crate.scm | 576 +++++++++++++++++++++++++++++----- 5 files changed, 653 insertions(+), 116 deletions(-) -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 17:02:42 2023 Received: (at 67960) by debbugs.gnu.org; 21 Dec 2023 22:02:42 +0000 Received: from localhost ([127.0.0.1]:45614 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7q-0004gt-1P for submit@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:42 -0500 Received: from mout02.posteo.de ([185.67.36.66]:43197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7n-0004gW-G2 for 67960@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:40 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 40CB2240105 for <67960@debbugs.gnu.org>; Thu, 21 Dec 2023 23:02:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703196148; bh=UV4KlIQQh1jOE4HaoulPcZQ3wHUJ5zlK7m8zckqJTC8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=aqlM0qCHLEogJ37ektND48kxW2J0TKYaLF390pcQrWBJdiTaYUSvQGK4nvJGMb+0L qw3C75tm0M1Ko4g5+C1MtJ3oQ/thREsKf3ijTO35Ghi9saUHeTaHw6iiSuOSnh/gpN zKtFS1rpmePVNZwv0kAim9qX7eorfYWnKHewhcoVJyQUMpGltkFZ5kfyIz2WBhMQow t5ZLDPhnIDXeaiKHEMzzS1eII+mqw+EfaOTKNKdA57O9pP+D2pWyMx0/PLX5tMLIJJ RAFfpgzUFpMB/YON1Ifv3Qlx6BYDFYtG3csCaXfMkG1125pKJur85rhRwf6NUNFrqS aYYEuoYB6V6cQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sx4D35mMtz6tw4; Thu, 21 Dec 2023 23:02:27 +0100 (CET) From: David Elsing To: 67960@debbugs.gnu.org Subject: [PATCH 1/4] gnu: import: Fix memoization in crate-recursive-import. Date: Thu, 21 Dec 2023 22:01:49 +0000 Message-ID: <7b04c6fca16b404565f8d4d019a76252eb66c50c.1703195451.git.david.elsing@posteo.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67960 Cc: David Elsing X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/import/crate.scm (crate-recursive-import): Apply memoize outside the lambda passed to recursive-import in order to actually use the memoization. --- guix/import/crate.scm | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 43823d006e..07874bdb26 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2022 Hartmut Goebel ;;; Copyright © 2023 Simon Tournier ;;; Copyright © 2023 Efraim Flashner +;;; Copyright © 2023 David Elsing ;;; ;;; This file is part of GNU Guix. ;;; @@ -328,15 +329,17 @@ (define (sort-map-dependencies deps) (values #f '()))) (define* (crate-recursive-import crate-name #:key version) - (recursive-import crate-name - #:repo->guix-package (lambda* params - ;; download development dependencies only for the top level package - (let ((include-dev-deps? (equal? (car params) crate-name)) - (crate->guix-package* (memoize crate->guix-package))) - (apply crate->guix-package* - (append params `(#:include-dev-deps? ,include-dev-deps?))))) - #:version version - #:guix-name crate-name->package-name)) + (recursive-import + crate-name + #:repo->guix-package + (let ((crate->guix-package* (memoize crate->guix-package))) + (lambda* params + ;; download development dependencies only for the top level package + (let ((include-dev-deps? (equal? (car params) crate-name))) + (apply crate->guix-package* + (append params `(#:include-dev-deps? ,include-dev-deps?)))))) + #:version version + #:guix-name crate-name->package-name)) (define (guix-package->crate-name package) "Return the crate name of PACKAGE." -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 17:02:46 2023 Received: (at 67960) by debbugs.gnu.org; 21 Dec 2023 22:02:46 +0000 Received: from localhost ([127.0.0.1]:45618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7t-0004hE-HL for submit@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:46 -0500 Received: from mout02.posteo.de ([185.67.36.66]:33167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7r-0004gh-0v for 67960@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:43 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 43A2B240103 for <67960@debbugs.gnu.org>; Thu, 21 Dec 2023 23:02:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703196153; bh=vIWSDFMaf2qGMHu+uoIQcd8H7KbxW2mof6vXpDXrOFk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=OTCKnPnX4RVGSqzUGfWorV7wml1AMN1iu90C3h4bPuCzNmZNHlzaBimhMMxYwxJYc DD2rIz6u3bhwk+vJr1SkXPSiNg8MRqrPBvAaYmoVuEFzB05jiYrl3E1Fi8iGJ91F/h oOko8G6WvylHDS5lu/3bvFyg97Wc4X+t9NNzRO6GB4abm40RyJEuKGiqzO1ENf4Hd6 mosN6ZPXOH+HlLZfNqIB5hTCAvtq0k4ELCxVjr3SUHJTb+Dm2re+tHiHp01/6rCWD2 n5L01w+WSG4ac0DYPkQ8r4H8aFWdH+bK6ZBjiH0h5xo2uUTVOIS510R/81XrtsTTw3 M5VQBtC8hUnjw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sx4D869LMz6tvr; Thu, 21 Dec 2023 23:02:32 +0100 (CET) From: David Elsing To: 67960@debbugs.gnu.org Subject: [PATCH 3/4] tests: Mock find-packages-by-name in crate importer test. Date: Thu, 21 Dec 2023 22:01:51 +0000 Message-ID: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67960 Cc: David Elsing X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * tests/crate.scm: Import only sha256 from (gcrypt hash) as gcrypt-sha256 to prevent a name collision. Rename test 'cargo-recursive-import' to 'crate-recursive-import' and 'cargo-recursive-import-hoors-existing-packages' to 'crate-recursive-import-honors-existing-packages'. Mock find-packages-by-name from (gnu packages). Adjust test to import fake 'bar' crate instead of doctool. (test-bar-crate): New variable. (test-bar-dependencies): New variable. (test-root-crate): Adjust sha256 -> gcrypt-sha256. (test-doctool-crate,test-doctool-dependencies): Remove variables. (rust-leaf-bob-3): New variable. --- tests/crate.scm | 203 +++++++++++++++++++++++++++--------------------- 1 file changed, 115 insertions(+), 88 deletions(-) diff --git a/tests/crate.scm b/tests/crate.scm index 1b9ad88358..e779f738b3 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -25,7 +25,9 @@ (define-module (test-crate) #:use-module (guix import crate) #:use-module (guix base32) #:use-module (guix build-system cargo) - #:use-module (gcrypt hash) + #:use-module ((gcrypt hash) + #:select ((sha256 . gcrypt-sha256))) + #:use-module (guix packages) #:use-module (guix tests) #:use-module (gnu packages) #:use-module (ice-9 iconv) @@ -38,6 +40,8 @@ (define-module (test-crate) ;; foo-1.0.0 ;; foo-1.0.3 ;; leaf-alice 0.7.5 +;; bar-1.0.0 +;; leaf-bob 3.0.1 ;; ;; root-1.0.0 ;; root-1.0.4 @@ -116,6 +120,40 @@ (define test-foo-dependencies ] }") +(define test-bar-crate + "{ + \"crate\": { + \"max_version\": \"1.0.0\", + \"name\": \"bar\", + \"description\": \"summary\", + \"homepage\": \"http://example.com\", + \"repository\": \"http://example.com\", + \"keywords\": [\"dummy\", \"test\"], + \"categories\": [\"test\"], + \"actual_versions\": [ + { \"id\": 234100, + \"num\": \"1.0.0\", + \"license\": \"MIT OR Apache-2.0\", + \"links\": { + \"dependencies\": \"/api/v1/crates/bar/1.0.0/dependencies\" + }, + \"yanked\": false + } + ] + } +}") + +(define test-bar-dependencies + "{ + \"dependencies\": [ + { + \"crate_id\": \"leaf-bob\", + \"kind\": \"normal\", + \"req\": \"3.0.1\" + } + ] +}") + (define test-root-crate "{ \"crate\": { @@ -399,7 +437,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/foo/1.0.3/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/foo/1.0.3/dependencies" (open-input-string test-foo-dependencies)) @@ -408,7 +446,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/dependencies" (open-input-string test-leaf-alice-dependencies)) @@ -442,7 +480,7 @@ (define have-guile-semver? (pk 'fail x #f))))) (unless have-guile-semver? (test-skip 1)) -(test-assert "cargo-recursive-import" +(test-assert "crate-recursive-import" ;; Replace network resources with sample data. (mock ((guix http-client) http-fetch (lambda (url . rest) @@ -452,7 +490,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/root/1.0.4/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/root/1.0.4/dependencies" (open-input-string test-root-dependencies)) @@ -461,7 +499,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/intermediate-a/1.0.42/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/intermediate-a/1.0.42/dependencies" (open-input-string test-intermediate-a-dependencies)) @@ -470,7 +508,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/intermediate-b/1.2.3/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/intermediate-b/1.2.3/dependencies" (open-input-string test-intermediate-b-dependencies)) @@ -479,7 +517,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/intermediate-c/1.0.1/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/intermediate-c/1.0.1/dependencies" (open-input-string test-intermediate-c-dependencies)) @@ -488,7 +526,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/dependencies" (open-input-string test-leaf-alice-dependencies)) @@ -497,7 +535,7 @@ (define have-guile-semver? ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/download" (set! test-source-hash (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/dependencies" (open-input-string test-leaf-bob-dependencies)) @@ -814,85 +852,74 @@ (define-public 'rust-root-1 -(define test-doctool-crate - "{ - \"crate\": { - \"max_version\": \"2.2.2\", - \"name\": \"leaf-bob\", - \"description\": \"summary\", - \"homepage\": \"http://example.com\", - \"repository\": \"http://example.com\", - \"keywords\": [\"dummy\", \"test\"], - \"categories\": [\"test\"] - \"actual_versions\": [ - { \"id\": 234280, - \"num\": \"2.2.2\", - \"license\": \"MIT OR Apache-2.0\", - \"links\": { - \"dependencies\": \"/api/v1/crates/doctool/2.2.2/dependencies\" - }, - \"yanked\": false - } - ] - } -}") - -;; FIXME: This test depends on some existing packages -(define test-doctool-dependencies - "{ - \"dependencies\": [ - { - \"crate_id\": \"docopt\", - \"kind\": \"normal\", - \"req\": \"^0.8.1\" - } - ] -}") - - -(test-assert "self-test: rust-docopt 0.8.x is gone, please adjust the test case" - (not (null? (find-packages-by-name "rust-docopt" "0.8")))) +(define rust-leaf-bob-3 + (package + (name "rust-leaf-bob") + (version "3.0.1") + (source #f) + (build-system #f) + (home-page #f) + (synopsis #f) + (description #f) + (license #f))) (unless have-guile-semver? (test-skip 1)) -(test-assert "cargo-recursive-import-hoors-existing-packages" - (mock ((guix http-client) http-fetch - (lambda (url . rest) - (match url - ("https://crates.io/api/v1/crates/doctool" - (open-input-string test-doctool-crate)) - ("https://crates.io/api/v1/crates/doctool/2.2.2/download" - (set! test-source-hash - (bytevector->nix-base32-string - (sha256 (string->bytevector "empty file\n" "utf-8")))) - (open-input-string "empty file\n")) - ("https://crates.io/api/v1/crates/doctool/2.2.2/dependencies" - (open-input-string test-doctool-dependencies)) - (_ (error "Unexpected URL: " url))))) - (match (crate-recursive-import "doctool") - (((define-public 'rust-doctool-2 - (package - (name "rust-doctool") - (version "2.2.2") - (source - (origin - (method url-fetch) - (uri (crate-uri "doctool" version)) - (file-name - (string-append name "-" version ".tar.gz")) - (sha256 - (base32 - (? string? hash))))) - (build-system cargo-build-system) - (arguments - ('quasiquote (#:cargo-inputs - (("rust-docopt" - ('unquote 'rust-docopt-0.8)))))) - (home-page "http://example.com") - (synopsis "summary") - (description "summary") - (license (list license:expat license:asl2.0))))) - #t) - (x - (pk 'fail x #f))))) +(test-assert "crate-recursive-import-honors-existing-packages" + (mock + ((gnu packages) find-packages-by-name + (lambda* (name #:optional version) + (match name + ("rust-leaf-bob" + (list rust-leaf-bob-3)) + (_ '())))) + (mock + ((guix http-client) http-fetch + (lambda (url . rest) + (match url + ("https://crates.io/api/v1/crates/bar" + (open-input-string test-bar-crate)) + ("https://crates.io/api/v1/crates/bar/1.0.0/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/bar/1.0.0/dependencies" + (open-input-string test-bar-dependencies)) + ("https://crates.io/api/v1/crates/leaf-bob" + (open-input-string test-leaf-bob-crate)) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.2/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.2/dependencies" + (open-input-string test-leaf-bob-dependencies)) + (_ (error "Unexpected URL: " url))))) + (match (crate-recursive-import "bar") + (((define-public 'rust-bar-1 + (package + (name "rust-bar") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (crate-uri "bar" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-inputs + (("rust-leaf-bob" + ('unquote 'rust-leaf-bob-3)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0))))) + #t) + (x + (pk 'fail x #f)))))) (test-end "crate") -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 17:02:50 2023 Received: (at 67960) by debbugs.gnu.org; 21 Dec 2023 22:02:51 +0000 Received: from localhost ([127.0.0.1]:45620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7x-0004hT-Oo for submit@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:50 -0500 Received: from mout02.posteo.de ([185.67.36.66]:59121) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7p-0004gc-8w for 67960@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:44 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 7761B240103 for <67960@debbugs.gnu.org>; Thu, 21 Dec 2023 23:02:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703196151; bh=ypS3YGMTYlH2BzJ9VbUqH7laHNlWak9KlOqJOPwdIWs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=CeoODpYeDxc0jgbYBP5Kz5L0DcXcQtaIPC2CTeMz0JuYYuWXLjR57ukZZJAxW1jwt K83p5dYTA9N2Z0v4JaFN1FipKx30MwRc9Ym09RyIoUy1kfOU83f3AFmO7PYYAkcLmA q2dsYTjSpgXNqVDPcK4LWQAmI6//lMIv/m4guKR4whoGV6lVV7vat1YijMxTAI5Izr Eini62hHYKEmkAwsN0uh6WM8r5AqJ5tz6XqRIdqAPvFGrtrmvoMbX9GFXLhsuh62Lc IkQlfrCoTI56H9uglFw4bpVRjtl6s8LoHGU3HMru2ysaruj038m2GzL9szQk7QTT0n bbeDabPuHBC6w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sx4D70WZvz6tvh; Thu, 21 Dec 2023 23:02:31 +0100 (CET) From: David Elsing To: 67960@debbugs.gnu.org Subject: [PATCH 2/4] import: crate: Optionally import dev-dependencies recursively. Date: Thu, 21 Dec 2023 22:01:50 +0000 Message-ID: <068ee00edf887f21bea0267064f729ecaff05190.1703195451.git.david.elsing@posteo.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67960 Cc: David Elsing X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) If --recursive-dev-dependencies is specified, development dependencies are also included for all recursivly imported packages. * doc/guix.texi (Invoking guix import): Mention --recursive-dev-dependencies. * guix/import/crate.scm (crate-recursive-import): Add recursive-dev-dependencies? argument. * guix/scripts/import/crate.scm (show-help, guix-import-crate): Add "--recursive-dev-dependencies". * tests/crate.scm: Test both #f and #t for #:recursive-dev-dependencies? in the 'cargo-recursive-import' test. (test-root-dependencies): Add intermediate-c as dev-dependency. (test-intermediate-c-crate,test-intermediate-c-dependencies): New variables. --- doc/guix.texi | 4 + guix/import/crate.scm | 7 +- guix/scripts/import/crate.scm | 12 +- tests/crate.scm | 228 +++++++++++++++++++++++++++++++++- 4 files changed, 244 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index b742a3d5b2..a19671643b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14512,6 +14512,10 @@ Additional options include: Traverse the dependency graph of the given upstream package recursively and generate package expressions for all those packages that are not yet in Guix. +@item --recursive-dev-dependencies +If @option{--recursive} is specified, also the recursively imported +packages contain their development dependencies, which are recursively +imported as well. @end table @item elm diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 07874bdb26..db5461312f 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -328,14 +328,17 @@ (define (sort-map-dependencies deps) (append cargo-inputs cargo-development-inputs))) (values #f '()))) -(define* (crate-recursive-import crate-name #:key version) +(define* (crate-recursive-import + crate-name #:key version recursive-dev-dependencies?) (recursive-import crate-name #:repo->guix-package (let ((crate->guix-package* (memoize crate->guix-package))) (lambda* params ;; download development dependencies only for the top level package - (let ((include-dev-deps? (equal? (car params) crate-name))) + (let ((include-dev-deps? + (or (equal? (car params) crate-name) + recursive-dev-dependencies?))) (apply crate->guix-package* (append params `(#:include-dev-deps? ,include-dev-deps?)))))) #:version version diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 038faa87db..b13b6636a6 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2019, 2020 Martin Becze ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2023 Simon Tournier +;;; Copyright © 2023 David Elsing ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,9 @@ (define (show-help) Import and convert the crates.io package for PACKAGE-NAME.\n")) (display (G_ " -r, --recursive import packages recursively")) + (display (G_ " + --recursive-dev-dependencies + include dev-dependencies recursively")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -67,6 +71,9 @@ (define %options (option '(#\r "recursive") #f #f (lambda (opt name arg result) (alist-cons 'recursive #t result))) + (option '("recursive-dev-dependencies") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive-dev-dependencies #t result))) %standard-import-options)) @@ -92,7 +99,10 @@ (define-values (name version) (package-name->name+version spec)) (match (if (assoc-ref opts 'recursive) - (crate-recursive-import name #:version version) + (crate-recursive-import + name #:version version + #:recursive-dev-dependencies? + (assoc-ref opts 'recursive-dev-dependencies)) (crate->guix-package name #:version version #:include-dev-deps? #t)) ((or #f '()) (leave (G_ "failed to download meta-data for package '~a'~%") diff --git a/tests/crate.scm b/tests/crate.scm index 5aea5efaf3..1b9ad88358 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019, 2020, 2022 Ludovic Courtès ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2023 Efraim Flashner +;;; Copyright © 2023 David Elsing ;;; ;;; This file is part of GNU Guix. ;;; @@ -40,10 +41,11 @@ (define-module (test-crate) ;; ;; root-1.0.0 ;; root-1.0.4 -;; intermediate-a 1.0.42 -;; intermeidate-b ^1.0.0 +;; intermediate-a 1.0.42 +;; intermediate-b ^1.0.0 ;; leaf-alice ^0.7 -;; leaf-bob ^3 +;; leaf-bob ^3 +;; intermediate-c 1 (dev-dependency) ;; ;; intermediate-a-1.0.40 ;; intermediate-a-1.0.42 @@ -55,6 +57,9 @@ (define-module (test-crate) ;; intermediate-b-1.2.3 ;; leaf-bob 3.0.1 ;; +;; intermediate-c-1.0.1 +;; leaf-alice 0.7.5 (dev-dependency) +;; ;; leaf-alice-0.7.3 ;; leaf-alice-0.7.5 ;; @@ -164,6 +169,11 @@ (define test-root-dependencies \"crate_id\": \"leaf-bob\", \"kind\": \"normal\", \"req\": \"^3\" + }, + { + \"crate_id\": \"intermediate-c\", + \"kind\": \"dev\", + \"req\": \"1\" } ] }") @@ -262,6 +272,40 @@ (define test-intermediate-b-dependencies ] }") +(define test-intermediate-c-crate + "{ + \"crate\": { + \"max_version\": \"1.0.1\", + \"name\": \"intermediate-c\", + \"description\": \"summary\", + \"homepage\": \"http://example.com\", + \"repository\": \"http://example.com\", + \"keywords\": [\"dummy\", \"test\"], + \"categories\": [\"test\"], + \"actual_versions\": [ + { \"id\": 234290, + \"num\": \"1.0.1\", + \"license\": \"MIT OR Apache-2.0\", + \"links\": { + \"dependencies\": \"/api/v1/crates/intermediate-c/1.0.1/dependencies\" + }, + \"yanked\": false + } + ] + } +}") + +(define test-intermediate-c-dependencies + "{ + \"dependencies\": [ + { + \"crate_id\": \"leaf-alice\", + \"kind\": \"dev\", + \"req\": \"0.7.5\" + } + ] +}") + (define test-leaf-alice-crate "{ \"crate\": { @@ -430,6 +474,15 @@ (define have-guile-semver? (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/intermediate-b/1.2.3/dependencies" (open-input-string test-intermediate-b-dependencies)) + ("https://crates.io/api/v1/crates/intermediate-c" + (open-input-string test-intermediate-c-crate)) + ("https://crates.io/api/v1/crates/intermediate-c/1.0.1/download" + (set! test-source-hash + (bytevector->nix-base32-string + (sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/intermediate-c/1.0.1/dependencies" + (open-input-string test-intermediate-c-dependencies)) ("https://crates.io/api/v1/crates/leaf-alice" (open-input-string test-leaf-alice-crate)) ("https://crates.io/api/v1/crates/leaf-alice/0.7.5/download" @@ -452,7 +505,27 @@ (define have-guile-semver? (match (crate-recursive-import "root") ;; rust-intermediate-b has no dependency on the rust-leaf-alice ;; package, so this is a valid ordering - (((define-public 'rust-leaf-alice-0.7 + (((define-public 'rust-intermediate-c-1 + (package + (name "rust-intermediate-c") + (version "1.0.1") + (source + (origin + (method url-fetch) + (uri (crate-uri "intermediate-c" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:skip-build? #t))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-leaf-alice-0.7 (package (name "rust-leaf-alice") (version "0.7.5") @@ -562,11 +635,158 @@ (define-public 'rust-root-1 ('unquote rust-intermediate-b-1)) ("rust-leaf-alice" ('unquote 'rust-leaf-alice-0.7)) + ("rust-leaf-bob" + ('unquote rust-leaf-bob-3))) + #:cargo-development-inputs + (("rust-intermediate-c" + ('unquote rust-intermediate-c-1)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0))))) + #t) + (x + (pk 'fail x #f))) + (match (crate-recursive-import "root" + #:recursive-dev-dependencies? #t) + ;; rust-intermediate-b has no dependency on the rust-leaf-alice + ;; package, so this is a valid ordering + (((define-public 'rust-intermediate-c-1 + (package + (name "rust-intermediate-c") + (version "1.0.1") + (source + (origin + (method url-fetch) + (uri (crate-uri "intermediate-c" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-development-inputs + (("rust-leaf-alice" + ('unquote rust-leaf-alice-0.7)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-leaf-alice-0.7 + (package + (name "rust-leaf-alice") + (version "0.7.5") + (source + (origin + (method url-fetch) + (uri (crate-uri "leaf-alice" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-leaf-bob-3 + (package + (name "rust-leaf-bob") + (version "3.0.1") + (source + (origin + (method url-fetch) + (uri (crate-uri "leaf-bob" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-intermediate-b-1 + (package + (name "rust-intermediate-b") + (version "1.2.3") + (source + (origin + (method url-fetch) + (uri (crate-uri "intermediate-b" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-inputs + (("rust-leaf-bob" + ('unquote rust-leaf-bob-3)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-intermediate-a-1 + (package + (name "rust-intermediate-a") + (version "1.0.42") + (source + (origin + (method url-fetch) + (uri (crate-uri "intermediate-a" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-inputs + (("rust-intermediate-b" + ('unquote rust-intermediate-b-1)) + ("rust-leaf-alice" + ('unquote 'rust-leaf-alice-0.7)) ("rust-leaf-bob" ('unquote rust-leaf-bob-3)))))) (home-page "http://example.com") (synopsis "summary") (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-root-1 + (package + (name "rust-root") + (version "1.0.4") + (source + (origin + (method url-fetch) + (uri (crate-uri "root" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-inputs + (("rust-intermediate-a" + ('unquote rust-intermediate-a-1)) + ("rust-intermediate-b" + ('unquote rust-intermediate-b-1)) + ("rust-leaf-alice" + ('unquote 'rust-leaf-alice-0.7)) + ("rust-leaf-bob" + ('unquote rust-leaf-bob-3))) + #:cargo-development-inputs + (("rust-intermediate-c" + ('unquote rust-intermediate-c-1)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") (license (list license:expat license:asl2.0))))) #t) (x -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Dec 21 17:02:52 2023 Received: (at 67960) by debbugs.gnu.org; 21 Dec 2023 22:02:52 +0000 Received: from localhost ([127.0.0.1]:45622 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7y-0004ha-Uo for submit@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:52 -0500 Received: from mout01.posteo.de ([185.67.36.65]:57003) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGR7s-0004gj-W6 for 67960@debbugs.gnu.org; Thu, 21 Dec 2023 17:02:46 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id DA432240027 for <67960@debbugs.gnu.org>; Thu, 21 Dec 2023 23:02:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1703196154; bh=kf/QQ3w2o3n41m+q1lqJnC3/E83qa71KG/PfIeEZkLY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version: Content-Transfer-Encoding:From; b=khquDJgR+/YoB7X7bvvv0wxph3szue740Crdr0RAUwmZNgFeWH0Ih9NPkRjjPgIHj acuyKCplauLnS/CxPbm+LiR++2C0MbvGNNIGXSwZ9UcynsPltvB14fNTfCagKrXIpn 1A+/9TuPshbwU18F8iu5XLkz7lrzMOzx5sRPtzvPoUNhi2G4w4s/ieoJBX9iVX5Wrb QZpYOvVDaRdrm3iif//G1z/JXVU7sOfy57E0OCCeCbFlLMP6hlTg9zcYoZM4n04n2s M7WFy8dV1s4yQZle/goeALUIW5gtTxk7ePRGmHqCQr97faSQ0uqPk6LRmewuCkh3aW CrFisQ92XOR6A== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Sx4DB23rzz6twM; Thu, 21 Dec 2023 23:02:34 +0100 (CET) From: David Elsing To: 67960@debbugs.gnu.org Subject: [PATCH 4/4] guix: import: Optionally import necessary yanked crates. Date: Thu, 21 Dec 2023 22:01:52 +0000 Message-ID: <7b351acd4d85a1b934ac898c217fe7b9b40bedf5.1703195451.git.david.elsing@posteo.net> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 67960 Cc: David Elsing X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * doc/guix.texi (Invoking guix import): Mention '--allow-yanked'. * guix/import/crate.scm (make-crate-sexp): Add yanked? argument. For yanked packages, use the full version suffixed by "-yanked" for generated variable names and add a comment and package property. (crate->guix-package): Add allow-yanked? argument and if it is set to #t, allow importing yanked crates if no other version matching the requirements exists. [find-package-version]: Packages previously marked as yanked are only included if allow-yanked? is #t and then take the lowest priority. [find-crate-version]: If allow-yanked? is #t, also consider yanked versions with the lowest priority. [dependency-name+version]: Rename to ... [dependency-name+version+yanked] ...this. Honor allow-yanked? and choose between an existing package and an upstream package. Exit with an error message if no version fulfilling the requirement is found. [version*]: Exit with an error message if the crate version is not found. (cargo-recursive-import): Add allow-yanked? argument. * guix/read-print.scm: Export . * guix/scripts/import/crate.scm: Add "--allow-yanked". * tests/crate.scm: Add test 'crate-recursive-import-only-yanked-available'. [sort-map-dependencies]: Adjust accordingly. [remove-yanked-info]: New variable. Adjust test 'crate-recursive-import-honors-existing-packages'. (test-bar-dependencies): Add yanked dev-dependencies. (test-leaf-bob-crate): Add yanked versions. (rust-leaf-bob-3.0.2-yanked): New variable. --- doc/guix.texi | 3 + guix/import/crate.scm | 139 ++++++++++++++++++------ guix/read-print.scm | 1 + guix/scripts/import/crate.scm | 14 ++- tests/crate.scm | 193 +++++++++++++++++++++++++++++++++- 5 files changed, 310 insertions(+), 40 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a19671643b..da36f90e9b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14516,6 +14516,9 @@ in Guix. If @option{--recursive} is specified, also the recursively imported packages contain their development dependencies, which are recursively imported as well. +@item --allow-yanked +If no non-yanked version of a crate is available, use the latest yanked +version instead instead of aborting. @end table @item elm diff --git a/guix/import/crate.scm b/guix/import/crate.scm index db5461312f..e3b8286350 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -26,12 +26,15 @@ (define-module (guix import crate) #:use-module (guix base32) #:use-module (guix build-system cargo) + #:use-module (guix diagnostics) #:use-module (gcrypt hash) #:use-module (guix http-client) + #:use-module (guix i18n) #:use-module (guix import json) #:use-module (guix import utils) #:use-module (guix memoization) #:use-module (guix packages) + #:use-module (guix read-print) #:use-module (guix upstream) #:use-module (guix utils) #:use-module (gnu packages) @@ -41,6 +44,7 @@ (define-module (guix import crate) #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) #:use-module (srfi srfi-26) + #:use-module (srfi srfi-69) #:use-module (srfi srfi-71) #:export (crate->guix-package guix-package->crate-name @@ -100,7 +104,7 @@ (define-json-mapping make-crate-dependency ;; Autoload Guile-Semver so we only have a soft dependency. (module-autoload! (current-module) - '(semver) '(string->semver semver->string semversemver semver->string semversemver-range semver-range-contains?)) @@ -165,16 +169,18 @@ (define (version->semver-prefix version) (list-matches "^(0+\\.){,2}[0-9]+" version)))) (define* (make-crate-sexp #:key name version cargo-inputs cargo-development-inputs - home-page synopsis description license build?) + home-page synopsis description license build? yanked?) "Return the `package' s-expression for a rust package with the given NAME, VERSION, CARGO-INPUTS, CARGO-DEVELOPMENT-INPUTS, HOME-PAGE, SYNOPSIS, DESCRIPTION, and LICENSE." (define (format-inputs inputs) (map (match-lambda - ((name version) + ((name version yanked) (list (crate-name->package-name name) - (version->semver-prefix version)))) + (if yanked + (string-append version "-yanked") + (version->semver-prefix version))))) inputs)) (let* ((port (http-fetch (crate-uri name version))) @@ -184,6 +190,9 @@ (define (format-inputs inputs) (pkg `(package (name ,guix-name) (version ,version) + ,@(if yanked? + `(,(comment "; This version was yanked!\n" #t)) + '()) (source (origin (method url-fetch) (uri (crate-uri ,name version)) @@ -191,6 +200,9 @@ (define (format-inputs inputs) (sha256 (base32 ,(bytevector->nix-base32-string (port-sha256 port)))))) + ,@(if yanked? + `((properties '((crate-version-yanked? . #t)))) + '()) (build-system cargo-build-system) ,@(maybe-arguments (append (if build? '() @@ -207,7 +219,10 @@ (define (format-inputs inputs) ((license) license) (_ `(list ,@license))))))) (close-port port) - (package->definition pkg (version->semver-prefix version)))) + (package->definition pkg + (if yanked? + (string-append version "-yanked") + (version->semver-prefix version))))) (define (string->license string) (filter-map (lambda (license) @@ -218,8 +233,9 @@ (define (string->license string) 'unknown-license!))) (string-split string (string->char-set " /")))) -(define* (crate->guix-package crate-name #:key version include-dev-deps? - #:allow-other-keys) +(define* (crate->guix-package + crate-name + #:key version include-dev-deps? allow-yanked? #:allow-other-keys) "Fetch the metadata for CRATE-NAME from crates.io, and return the `package' s-expression corresponding to that package, or #f on failure. When VERSION is specified, convert it into a semver range and attempt to fetch @@ -243,63 +259,112 @@ (define version-number (or version (crate-latest-version crate)))) - ;; find the highest existing package that fulfills the semver + ;; Find the highest existing package that fulfills the semver + ;; . Packages previously marked as yanked take lower priority. (define (find-package-version name range) (let* ((semver-range (string->semver-range range)) - (versions + (package-versions (sort - (filter (lambda (version) - (semver-range-contains? semver-range version)) + (filter (match-lambda ((semver yanked) + (and + (or allow-yanked? (not yanked)) + (semver-range-contains? semver-range semver)))) (map (lambda (pkg) - (string->semver (package-version 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)))) - semverstring (last versions))))) - - ;; Find the highest version of a crate that fulfills the semver - ;; and hasn't been yanked. + (match-lambda* (((semver1 yanked1) (semver2 yanked2)) + (or + (and yanked1 (not yanked2)) + (and + (eq? yanked1 yanked2) + (semverstring semver) yanked))))) + + ;; Find the highest version of a crate that fulfills the semver . If + ;; no matching non-yanked version has been found and allow-yanked? is #t, + ;; also consider yanked packages. (define (find-crate-version crate range) (let* ((semver-range (string->semver-range range)) (versions (sort (filter (lambda (entry) (and - (not (crate-version-yanked? (second entry))) - (semver-range-contains? semver-range (first entry)))) + (or allow-yanked? (not (crate-version-yanked? (second entry)))) + (semver-range-contains? semver-range (first entry)))) (map (lambda (ver) (list (string->semver (crate-version-number ver)) ver)) (crate-versions crate))) - (match-lambda* (((semver _) ...) - (apply semversemver (first existing-version)) + (string->semver (crate-version-number ver))) + (begin + (warning (G_ "~A: version ~a is no longer yanked~%") name (first existing-version)) + (cons name existing-version)) + (list name + (crate-version-number ver) + (crate-version-yanked? ver))) + (begin + (warning (G_ "~A: using existing version ~a, which was yanked~%") name (first existing-version)) + (cons name existing-version))) + (begin + (unless ver + (leave (G_ "~A: no version found for requirement ~a~%") name req)) + (if (crate-version-yanked? ver) + (warning (G_ "~A: imported version ~a was yanked~%") name (crate-version-number ver))) + (list name + (crate-version-number ver) + (crate-version-yanked? ver)))))))) (define version* (and crate - (find-crate-version crate version-number))) + (or + (find-crate-version crate version-number) + (leave (G_ "~A: version ~a not found~%") crate-name version-number)))) ;; sort and map the dependencies to a list containing ;; pairs of (name version) (define (sort-map-dependencies deps) - (sort (map dependency-name+version + (sort (map dependency-name+version+yanked deps) - (match-lambda* (((name _) ...) + (match-lambda* (((name _ _) ...) (apply string-ci (crate-version-license version*) string->license)) - (append cargo-inputs cargo-development-inputs))) + (append + (remove-yanked-info cargo-inputs) + (remove-yanked-info cargo-development-inputs)))) (values #f '()))) (define* (crate-recursive-import - crate-name #:key version recursive-dev-dependencies?) + crate-name #:key version recursive-dev-dependencies? allow-yanked?) (recursive-import crate-name #:repo->guix-package @@ -340,7 +408,8 @@ (define* (crate-recursive-import (or (equal? (car params) crate-name) recursive-dev-dependencies?))) (apply crate->guix-package* - (append params `(#:include-dev-deps? ,include-dev-deps?)))))) + (append params `(#:include-dev-deps? ,include-dev-deps? + #:allow-yanked? ,allow-yanked?)))))) #:version version #:guix-name crate-name->package-name)) diff --git a/guix/read-print.scm b/guix/read-print.scm index 690f5dacdd..6421b79737 100644 --- a/guix/read-print.scm +++ b/guix/read-print.scm @@ -46,6 +46,7 @@ (define-module (guix read-print) page-break page-break? + comment comment? comment->string diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index b13b6636a6..082a973aee 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -51,6 +51,10 @@ (define (show-help) (display (G_ " --recursive-dev-dependencies include dev-dependencies recursively")) + (display (G_ " + --allow-yanked + allow importing yanked crates if no alternative + satisfying the version requirement exists")) (newline) (display (G_ " -h, --help display this help and exit")) @@ -74,6 +78,9 @@ (define %options (option '("recursive-dev-dependencies") #f #f (lambda (opt name arg result) (alist-cons 'recursive-dev-dependencies #t result))) + (option '("allow-yanked") #f #f + (lambda (opt name arg result) + (alist-cons 'allow-yanked #t result))) %standard-import-options)) @@ -102,8 +109,11 @@ (define-values (name version) (crate-recursive-import name #:version version #:recursive-dev-dependencies? - (assoc-ref opts 'recursive-dev-dependencies)) - (crate->guix-package name #:version version #:include-dev-deps? #t)) + (assoc-ref opts 'recursive-dev-dependencies) + #:allow-yanked? (assoc-ref opts 'allow-yanked)) + (crate->guix-package + name #:version version #:include-dev-deps? #t + #:allow-yanked? (assoc-ref opts 'allow-yanked))) ((or #f '()) (leave (G_ "failed to download meta-data for package '~a'~%") (if version diff --git a/tests/crate.scm b/tests/crate.scm index e779f738b3..ce2f08aade 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -28,6 +28,7 @@ (define-module (test-crate) #:use-module ((gcrypt hash) #:select ((sha256 . gcrypt-sha256))) #:use-module (guix packages) + #:use-module (guix read-print) #:use-module (guix tests) #:use-module (gnu packages) #:use-module (ice-9 iconv) @@ -42,6 +43,8 @@ (define-module (test-crate) ;; leaf-alice 0.7.5 ;; bar-1.0.0 ;; leaf-bob 3.0.1 +;; leaf-bob 3.0.2 (dev-dependency) +;; leaf-bob 4.0.0 (dev-dependency) ;; ;; root-1.0.0 ;; root-1.0.4 @@ -68,6 +71,8 @@ (define-module (test-crate) ;; leaf-alice-0.7.5 ;; ;; leaf-bob-3.0.1 +;; leaf-bob-3.0.2 (yanked) +;; leaf-bob-4.0.0 (yanked) (define test-foo-crate @@ -150,6 +155,16 @@ (define test-bar-dependencies \"crate_id\": \"leaf-bob\", \"kind\": \"normal\", \"req\": \"3.0.1\" + }, + { + \"crate_id\": \"leaf-bob\", + \"kind\": \"dev\", + \"req\": \"^3.0.2\" + }, + { + \"crate_id\": \"leaf-bob\", + \"kind\": \"dev\", + \"req\": \"^4.0.0\" } ] }") @@ -398,6 +413,22 @@ (define test-leaf-bob-crate \"dependencies\": \"/api/v1/crates/leaf-bob/3.0.1/dependencies\" }, \"yanked\": false + }, + { \"id\": 234281, + \"num\": \"3.0.2\", + \"license\": \"MIT OR Apache-2.0\", + \"links\": { + \"dependencies\": \"/api/v1/crates/leaf-bob/3.0.2/dependencies\" + }, + \"yanked\": true + }, + { \"id\": 234282, + \"num\": \"4.0.0\", + \"license\": \"MIT OR Apache-2.0\", + \"links\": { + \"dependencies\": \"/api/v1/crates/leaf-bob/4.0.0/dependencies\" + }, + \"yanked\": true } ] } @@ -863,6 +894,18 @@ (define rust-leaf-bob-3 (description #f) (license #f))) +(define rust-leaf-bob-3.0.2-yanked + (package + (name "rust-leaf-bob") + (version "3.0.2") + (source #f) + (properties '((crate-version-yanked? . #t))) + (build-system #f) + (home-page #f) + (synopsis #f) + (description #f) + (license #f))) + (unless have-guile-semver? (test-skip 1)) (test-assert "crate-recursive-import-honors-existing-packages" (mock @@ -870,7 +913,7 @@ (define rust-leaf-bob-3 (lambda* (name #:optional version) (match name ("rust-leaf-bob" - (list rust-leaf-bob-3)) + (list rust-leaf-bob-3 rust-leaf-bob-3.0.2-yanked)) (_ '())))) (mock ((guix http-client) http-fetch @@ -894,8 +937,16 @@ (define rust-leaf-bob-3 (open-input-string "empty file\n")) ("https://crates.io/api/v1/crates/leaf-bob/3.0.2/dependencies" (open-input-string test-leaf-bob-dependencies)) + ("https://crates.io/api/v1/crates/leaf-bob/4.0.0/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/leaf-bob/4.0.0/dependencies" + (open-input-string test-leaf-bob-dependencies)) (_ (error "Unexpected URL: " url))))) - (match (crate-recursive-import "bar") + (match (crate-recursive-import "bar" + #:allow-yanked? #t) (((define-public 'rust-bar-1 (package (name "rust-bar") @@ -913,7 +964,12 @@ (define rust-leaf-bob-3 (arguments ('quasiquote (#:cargo-inputs (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3)))))) + ('unquote 'rust-leaf-bob-3))) + #:cargo-development-inputs + (("rust-leaf-bob" + ('unquote 'rust-leaf-bob-3.0.2-yanked)) + ("rust-leaf-bob" + ('unquote 'rust-leaf-bob-4.0.0-yanked)))))) (home-page "http://example.com") (synopsis "summary") (description "summary") @@ -922,4 +978,135 @@ (define rust-leaf-bob-3 (x (pk 'fail x #f)))))) +(unless have-guile-semver? (test-skip 1)) +(test-assert "crate-import-only-yanked-available" + (mock + ((guix http-client) http-fetch + (lambda (url . rest) + (match url + ("https://crates.io/api/v1/crates/bar" + (open-input-string test-bar-crate)) + ("https://crates.io/api/v1/crates/bar/1.0.0/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/bar/1.0.0/dependencies" + (open-input-string test-bar-dependencies)) + ("https://crates.io/api/v1/crates/leaf-bob" + (open-input-string test-leaf-bob-crate)) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.1/dependencies" + (open-input-string test-leaf-bob-dependencies)) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.2/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/leaf-bob/3.0.2/dependencies" + (open-input-string test-leaf-bob-dependencies)) + ("https://crates.io/api/v1/crates/leaf-bob/4.0.0/download" + (set! test-source-hash + (bytevector->nix-base32-string + (gcrypt-sha256 (string->bytevector "empty file\n" "utf-8")))) + (open-input-string "empty file\n")) + ("https://crates.io/api/v1/crates/leaf-bob/4.0.0/dependencies" + (open-input-string test-leaf-bob-dependencies)) + (_ (error "Unexpected URL: " url))))) + (match (crate-recursive-import "bar" + #:recursive-dev-dependencies? #t + #:allow-yanked? #t) + (((define-public 'rust-leaf-bob-4.0.0-yanked + (package + (name "rust-leaf-bob") + (version "4.0.0") + ($ "; This version was yanked!\n" #t) + (source + (origin + (method url-fetch) + (uri (crate-uri "leaf-bob" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (properties ('quote (('crate-version-yanked? . #t)))) + (build-system cargo-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-leaf-bob-3.0.2-yanked + (package + (name "rust-leaf-bob") + (version "3.0.2") + ($ "; This version was yanked!\n" #t) + (source + (origin + (method url-fetch) + (uri (crate-uri "leaf-bob" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (properties ('quote (('crate-version-yanked? . #t)))) + (build-system cargo-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-leaf-bob-3 + (package + (name "rust-leaf-bob") + (version "3.0.1") + (source + (origin + (method url-fetch) + (uri (crate-uri "leaf-bob" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0)))) + (define-public 'rust-bar-1 + (package + (name "rust-bar") + (version "1.0.0") + (source + (origin + (method url-fetch) + (uri (crate-uri "bar" version)) + (file-name + (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + (? string? hash))))) + (build-system cargo-build-system) + (arguments + ('quasiquote (#:cargo-inputs + (("rust-leaf-bob" + ('unquote 'rust-leaf-bob-3))) + #:cargo-development-inputs + (("rust-leaf-bob" + ('unquote 'rust-leaf-bob-3.0.2-yanked)) + ("rust-leaf-bob" + ('unquote 'rust-leaf-bob-4.0.0-yanked)))))) + (home-page "http://example.com") + (synopsis "summary") + (description "summary") + (license (list license:expat license:asl2.0))))) + #t) + (x + (pk 'fail (pretty-print-with-comments (current-output-port) x) #f))))) + (test-end "crate") -- 2.41.0 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 02 15:39:18 2024 Received: (at 67960) by debbugs.gnu.org; 2 Jan 2024 20:39:18 +0000 Received: from localhost ([127.0.0.1]:51431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rKlXh-0005Vh-R5 for submit@debbugs.gnu.org; Tue, 02 Jan 2024 15:39:18 -0500 Received: from mailtransmit05.runbox.com ([2a0c:5a00:149::26]:52782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rKlXe-0005VN-GD for 67960@debbugs.gnu.org; Tue, 02 Jan 2024 15:39:16 -0500 Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1rKlXT-00FSnh-Hi for 67960@debbugs.gnu.org; Tue, 02 Jan 2024 21:39:03 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Transfer-Encoding:Content-Type:Subject:From:Cc:To: MIME-Version:Date:Message-ID; bh=llznJb+27J+eX0NP1s15FTIPfPkUI0Rk7pX0sT6IPZU= ; b=kv7UPSyiAkTy22QDlKlFRVChrcSUdZD6uNU++vuXykFy+XGC5PlraOx1QeIjFe/xXweDAYt2v y/3zEG0O/J4oQg3nKYkYVc2c9lVihW7CC4KUgXJlPCn0qGtyFMnSOm1MoKlIPQUlgBhaXLjih29Gk hwk99zwOKYfbBt1VhYJuI4RxD/ktf5kh+eWiGn9OgCXpTSSc3xObbUaO1fLy+zoupcnSsNeydAAFy tAE7/QlCHPKCcADABCls1hLJ873Yu+J1S7Rj0G+2+eVo9VgWukl6w57ubdyoHmpq7qX4a9+IBqw5g +2DBk550PBTjTPNsLHJkq+nH9Fr/XurXSDkRDg==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1rKlXS-0003HM-Ot; Tue, 02 Jan 2024 21:39:02 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (1176697)] (TLS1.2:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.93) id 1rKlX9-004ceI-At; Tue, 02 Jan 2024 21:38:43 +0100 Message-ID: <0b7bf1fc-7657-4afc-8149-d8af0f19c483@runbox.com> Date: Tue, 2 Jan 2024 15:38:41 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: 67960@debbugs.gnu.org From: Jaeme Sifat Subject: Re: [PATCH 0/4] Improve the crate importer. Autocrypt: addr=jaeme@runbox.com; keydata= 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 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 67960 Cc: david.elsing@posteo.net, efraim@flashner.co.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) I've used this to great effect when writing my crates and the test file passes. This should definitely be merged into master soon as this is a necessity for me when writing crate definitions. Thanks for fixing the crate importer, it will be vital when trying to port things like `iced-0.10` and `nushell-0.88` into rust-team. What do you think Efraim? -- Jaeme From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 09 02:44:37 2024 Received: (at 67960-done) by debbugs.gnu.org; 9 Jan 2024 07:44:37 +0000 Received: from localhost ([127.0.0.1]:38198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rN6mr-0004K8-2k for submit@debbugs.gnu.org; Tue, 09 Jan 2024 02:44:37 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:45225) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rN6mn-0004Jt-Jm for 67960-done@debbugs.gnu.org; Tue, 09 Jan 2024 02:44:36 -0500 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40e4f7119ebso3577545e9.2 for <67960-done@debbugs.gnu.org>; Mon, 08 Jan 2024 23:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704786261; x=1705391061; darn=debbugs.gnu.org; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=eoyQG5Y5pvO597C/UFo5oiK0iYCVBnPkEUGfLHw+Mac=; b=H2HUe9Dl8/fACWohY7tCsWL4dbWfxJo4B/UyrELNJg/9772KGE4Y2EVXT0TfE4QMEw 3obIIDGx3KTeD5r1uVj7C4SsmP7oX5QX6jHeK++0AATy3l+K/jhL3GgUD1e035A/5HlV cssrbbkh8wywqLuFE4PlIVRnUSpwhd0Edja0fj0bgojbMbI9vZ0h2wLzANqp4bFmuH6w 2FElasAsH5l+5V+yJiOgK5TqPAgA84NeF6KMVnvITxZm9kpVZ2TJLlfBm4E2l1C8JlYE PpA+6zsZEJZddUmA34o273QnSaw7DHb9r569FcjrqwztTdWNxHg32dbPFYEtq34faaJn kehw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704786261; x=1705391061; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eoyQG5Y5pvO597C/UFo5oiK0iYCVBnPkEUGfLHw+Mac=; b=ZAMNnt+l1UIBgWduA1TQ7IVEgBJTHo7EF4eqh/BprPkPbHbhDu0VCsIb+92caNM/FP 5QtDCTtLNCC7D90yLFrqRjebJrMRT62ahX/NEZg27w8RPdOndfQpEPHwpWUFrAtAxvDJ M0dp9RT8N071AnGpoYYrEZmmAGyCRwGUXurL5vnonyv/crEu455ZXy/++rYRjDcJ2xNQ v+c5mWZg0IfuFRPtHU5vdhkZ0OmhiqaG4zvzRVkwx5RUujERkuU2fDlyamFfZe/qRkO5 fnp+hjiA+i68klYU9YKNEawYEuYF+4LQA1nZ3AZqrMnOxIIZWkiGNUQu4cyQlXyuakqW KQTg== X-Gm-Message-State: AOJu0Yx7ZAUzgFWFDWgS+ryti6R45K63n+mhGjNHat6Va8kRqckHgBWH UzJPJUYtyvVNoUDvFc0sdfv9paRZ1cSLJaRo X-Google-Smtp-Source: AGHT+IGx9xrpHbA80tPWKSL3OdJsexH6YxUZTVE/BTGBiKv1BeWLyX2rSREhKBTnTBjLurl7EyghGA== X-Received: by 2002:a7b:c5d4:0:b0:40d:8cd1:16dd with SMTP id n20-20020a7bc5d4000000b0040d8cd116ddmr2518314wmk.248.1704786260701; Mon, 08 Jan 2024 23:44:20 -0800 (PST) Received: from localhost ([141.226.15.142]) by smtp.gmail.com with ESMTPSA id h10-20020adff4ca000000b0033668b27f8fsm1641252wrp.4.2024.01.08.23.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 23:44:20 -0800 (PST) Date: Tue, 9 Jan 2024 09:44:18 +0200 From: Efraim Flashner To: Jaeme Sifat Subject: Re: [PATCH 0/4] Improve the crate importer. Message-ID: Mail-Followup-To: Efraim Flashner , Jaeme Sifat , 67960-done@debbugs.gnu.org, david.elsing@posteo.net References: <0b7bf1fc-7657-4afc-8149-d8af0f19c483@runbox.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FNs1ByARduMLhOxs" Content-Disposition: inline In-Reply-To: <0b7bf1fc-7657-4afc-8149-d8af0f19c483@runbox.com> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 67960-done Cc: david.elsing@posteo.net, 67960-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) --FNs1ByARduMLhOxs Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 02, 2024 at 03:38:41PM -0500, Jaeme Sifat wrote: > I've used this to great effect when writing my crates and the test file > passes. This should definitely be merged into master soon as this is a > necessity for me when writing crate definitions. >=20 > Thanks for fixing the crate importer, it will be vital when trying to port > things like `iced-0.10` and `nushell-0.88` into rust-team. >=20 >=20 > What do you think Efraim? Looks good to me. Patches pushed! --=20 Efraim Flashner =D7=A8=D7=A0=D7=A9=D7=9C=D7=A4 = =D7=9D=D7=99=D7=A8=D7=A4=D7=90 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --FNs1ByARduMLhOxs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmWc+VIACgkQQarn3Mo9 g1EWrA//fnGoxYa12P6mofqI+Q0vn5BFSq/vNFs5005ONREN/oOGhO9QNnNbbJMx dBrKeSbKniQbD1m54wLYSWYlN4t04lVhxvgdtN0o/s0UF39Vp62YQBDg0fSiWy82 FJavRfnxvnC0W8+NIlq0rSKS4+wruw0JvngIiKAcavXk54N14BiR4XNXVxaHS5eh YCmY3ZBP8W/I701bly76Wa8LxPqwQFRxhpY3WZlBWejXHoGFSZfffs5EUWF7HG8m bztQEj5OiMaOaobVe8MK1uMQbjI7i8/euTFrmGU2pD+SF0/6CAWgGRV7MeuLsjKZ gLgrRkZ5vK5wpUsBj//+GPoALo8P0fjnj+RawM2ChTRFqcXXYNBH/35ITyWu2x0z b5jrQl7ZIAVjSxym1CUwaaTXPVwh8hT2U2BEH40wmgeqHG7vr4naOcX3YFRBO2sl mA7uE1od5ciUO4x2lyKukR6OsJJ+SqhfDih3v4Ta/d9xFUVO/ldsx+l5MnT5Z48G 9lVzo71DMBEbRYnaDtgVvSBGxY/w8BK+HApZnvzMEdZa3juGeU9APQlnqFhjMwnz bsr4QPiPBV/syJbu7mkdPWP7iD5ZJReIzO46s/DepnlmwUpijYbs+09WnkSkUiCC PfpB9qfAyRrAXSB/Mp2h9t4G8J2FPOLg4oeBkSxKAnYOdYUfs/8= =dyE/ -----END PGP SIGNATURE----- --FNs1ByARduMLhOxs-- From unknown Fri Jun 20 07:15:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 06 Feb 2024 12:24:12 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator