Archived
1
0
Fork 0

gnu: bootstrap: Memoize 'bootstrap-origin'.

* gnu/packages/bootstrap.scm (bootstrap-origin): Memoize with
'mlambdaq'.  This improves memoization of origins in (gnu packages
commencement).
This commit is contained in:
Ludovic Courtès 2019-11-03 17:59:28 +01:00
parent bf7b08c4fe
commit 7e1a74da93
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -149,41 +149,42 @@ for system '~a'")
;;; Helper procedures. ;;; Helper procedures.
;;; ;;;
(define (bootstrap-origin source) (define bootstrap-origin
"Return a variant of SOURCE, an <origin> instance, whose method uses (mlambdaq (source)
"Return a variant of SOURCE, an <origin> instance, whose method uses
%BOOTSTRAP-GUILE to do its job." %BOOTSTRAP-GUILE to do its job."
(define (boot fetch) (define (boot fetch)
(lambda* (url hash-algo hash (lambda* (url hash-algo hash
#:optional name #:key system) #:optional name #:key system)
(fetch url hash-algo hash name (fetch url hash-algo hash name
#:guile %bootstrap-guile #:guile %bootstrap-guile
#:system system))) #:system system)))
(define %bootstrap-patch-inputs (define %bootstrap-patch-inputs
;; Packages used when an <origin> has a non-empty 'patches' field. ;; Packages used when an <origin> has a non-empty 'patches' field.
`(("tar" ,%bootstrap-coreutils&co) `(("tar" ,%bootstrap-coreutils&co)
("xz" ,%bootstrap-coreutils&co) ("xz" ,%bootstrap-coreutils&co)
("bzip2" ,%bootstrap-coreutils&co) ("bzip2" ,%bootstrap-coreutils&co)
("gzip" ,%bootstrap-coreutils&co) ("gzip" ,%bootstrap-coreutils&co)
("patch" ,%bootstrap-coreutils&co))) ("patch" ,%bootstrap-coreutils&co)))
(let ((orig-method (origin-method source))) (let ((orig-method (origin-method source)))
(if (or (not (null? (origin-patches source))) (if (or (not (null? (origin-patches source)))
(origin-snippet source)) (origin-snippet source))
(origin (inherit source) (origin (inherit source)
(method (if (eq? orig-method url-fetch) (method (if (eq? orig-method url-fetch)
(boot url-fetch) (boot url-fetch)
orig-method)) orig-method))
(patch-guile %bootstrap-guile) (patch-guile %bootstrap-guile)
(patch-inputs %bootstrap-patch-inputs) (patch-inputs %bootstrap-patch-inputs)
;; Patches can be origins as well, so process them. ;; Patches can be origins as well, so process them.
(patches (map (match-lambda (patches (map (match-lambda
((? origin? patch) ((? origin? patch)
(bootstrap-origin patch)) (bootstrap-origin patch))
(patch patch)) (patch patch))
(origin-patches source)))) (origin-patches source))))
source))) source))))
(define* (package-from-tarball name source program-to-test description (define* (package-from-tarball name source program-to-test description
#:key snippet) #:key snippet)