From: David Elsing <david.elsing@posteo.net>
To: 67960@debbugs.gnu.org
Cc: David Elsing <david.elsing@posteo.net>
Subject: [bug#67960] [PATCH 1/4] gnu: import: Fix memoization in crate-recursive-import.
Date: Thu, 21 Dec 2023 22:01:49 +0000 [thread overview]
Message-ID: <7b04c6fca16b404565f8d4d019a76252eb66c50c.1703195451.git.david.elsing@posteo.net> (raw)
In-Reply-To: <cover.1703195451.git.david.elsing@posteo.net>
* 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 <h.goebel@crazy-compilers.com>
;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2023 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
;;;
;;; 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
next prev parent reply other threads:[~2023-12-21 22:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 21:59 [bug#67960] [PATCH 0/4] Improve the crate importer David Elsing
2023-12-21 22:01 ` David Elsing [this message]
2023-12-21 22:01 ` [bug#67960] [PATCH 2/4] import: crate: Optionally import dev-dependencies recursively David Elsing
2023-12-21 22:01 ` [bug#67960] [PATCH 3/4] tests: Mock find-packages-by-name in crate importer test David Elsing
2023-12-21 22:01 ` [bug#67960] [PATCH 4/4] guix: import: Optionally import necessary yanked crates David Elsing
2024-01-02 20:38 ` [bug#67960] [PATCH 0/4] Improve the crate importer Jaeme Sifat via Guix-patches via
2024-01-09 7:44 ` bug#67960: " Efraim Flashner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7b04c6fca16b404565f8d4d019a76252eb66c50c.1703195451.git.david.elsing@posteo.net \
--to=david.elsing@posteo.net \
--cc=67960@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).