diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2017-01-28 17:09:34 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2017-01-28 18:55:20 +0100 |
| commit | 55b2d921456e888f097bf4e43a3d25b112f3e563 (patch) | |
| tree | 5e2e834a2aa37f50dd27a33ae38a2f82c30091a7 /gnu | |
| parent | f9704f179a5160013c4a401dce3761714bba8e72 (diff) | |
Use 'mlambda' instead of 'memoize'.
* gnu/packages.scm (find-newest-available-packages): Use 'mlambda'
instead of (memoize (lambda ...) ...).
* gnu/packages/bootstrap.scm (package-with-bootstrap-guile): Likewise.
* guix/build-system/gnu.scm (package-with-explicit-inputs)[rewritten-input]:
Likewise.
* guix/build-system/python.scm (package-with-explicit-python)[transform]:
Likewise.
* guix/derivations.scm (derivation->string): Likewise.
* guix/gnu-maintenance.scm (gnu-package?): Likewise.
* guix/modules.scm (module-file-dependencies): Likewise.
* guix/scripts/graph.scm (standard-package-set): Likewise.
* guix/scripts/lint.scm (official-gnu-packages*): Likewise.
* guix/store.scm (store-regexp*): Likewise.
* guix/utils.scm (location): Likewise.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages.scm | 31 | ||||
| -rw-r--r-- | gnu/packages/bootstrap.scm | 35 |
2 files changed, 32 insertions, 34 deletions
diff --git a/gnu/packages.scm b/gnu/packages.scm index ec2473422f4..0aa289d56c0 100644 --- a/gnu/packages.scm +++ b/gnu/packages.scm | |||
| @@ -235,28 +235,27 @@ decreasing version order." | |||
| 235 | matching))))) | 235 | matching))))) |
| 236 | 236 | ||
| 237 | (define find-newest-available-packages | 237 | (define find-newest-available-packages |
| 238 | (memoize | 238 | (mlambda () |
| 239 | (lambda () | 239 | "Return a vhash keyed by package names, and with |
| 240 | "Return a vhash keyed by package names, and with | ||
| 241 | associated values of the form | 240 | associated values of the form |
| 242 | 241 | ||
| 243 | (newest-version newest-package ...) | 242 | (newest-version newest-package ...) |
| 244 | 243 | ||
| 245 | where the preferred package is listed first." | 244 | where the preferred package is listed first." |
| 246 | 245 | ||
| 247 | ;; FIXME: Currently, the preferred package is whichever one | 246 | ;; FIXME: Currently, the preferred package is whichever one |
| 248 | ;; was found last by 'fold-packages'. Find a better solution. | 247 | ;; was found last by 'fold-packages'. Find a better solution. |
| 249 | (fold-packages (lambda (p r) | 248 | (fold-packages (lambda (p r) |
| 250 | (let ((name (package-name p)) | 249 | (let ((name (package-name p)) |
| 251 | (version (package-version p))) | 250 | (version (package-version p))) |
| 252 | (match (vhash-assoc name r) | 251 | (match (vhash-assoc name r) |
| 253 | ((_ newest-so-far . pkgs) | 252 | ((_ newest-so-far . pkgs) |
| 254 | (case (version-compare version newest-so-far) | 253 | (case (version-compare version newest-so-far) |
| 255 | ((>) (vhash-cons name `(,version ,p) r)) | 254 | ((>) (vhash-cons name `(,version ,p) r)) |
| 256 | ((=) (vhash-cons name `(,version ,p ,@pkgs) r)) | 255 | ((=) (vhash-cons name `(,version ,p ,@pkgs) r)) |
| 257 | ((<) r))) | 256 | ((<) r))) |
| 258 | (#f (vhash-cons name `(,version ,p) r))))) | 257 | (#f (vhash-cons name `(,version ,p) r))))) |
| 259 | vlist-null)))) | 258 | vlist-null))) |
| 260 | 259 | ||
| 261 | (define (find-best-packages-by-name name version) | 260 | (define (find-best-packages-by-name name version) |
| 262 | "If version is #f, return the list of packages named NAME with the highest | 261 | "If version is #f, return the list of packages named NAME with the highest |
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index 7cde51fff80..c8d94c83036 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm | |||
| @@ -131,30 +131,29 @@ successful, or false to signal an error." | |||
| 131 | (license gpl3+))) | 131 | (license gpl3+))) |
| 132 | 132 | ||
| 133 | (define package-with-bootstrap-guile | 133 | (define package-with-bootstrap-guile |
| 134 | (memoize | 134 | (mlambda (p) |
| 135 | (lambda (p) | ||
| 136 | "Return a variant of P such that all its origins are fetched with | 135 | "Return a variant of P such that all its origins are fetched with |
| 137 | %BOOTSTRAP-GUILE." | 136 | %BOOTSTRAP-GUILE." |
| 138 | (define rewritten-input | 137 | (define rewritten-input |
| 139 | (match-lambda | 138 | (match-lambda |
| 140 | ((name (? origin? o)) | 139 | ((name (? origin? o)) |
| 141 | `(,name ,(bootstrap-origin o))) | 140 | `(,name ,(bootstrap-origin o))) |
| 142 | ((name (? package? p) sub-drvs ...) | 141 | ((name (? package? p) sub-drvs ...) |
| 143 | `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs)) | 142 | `(,name ,(package-with-bootstrap-guile p) ,@sub-drvs)) |
| 144 | (x x))) | 143 | (x x))) |
| 145 | 144 | ||
| 146 | (package (inherit p) | 145 | (package (inherit p) |
| 147 | (source (match (package-source p) | 146 | (source (match (package-source p) |
| 148 | ((? origin? o) (bootstrap-origin o)) | 147 | ((? origin? o) (bootstrap-origin o)) |
| 149 | (s s))) | 148 | (s s))) |
| 150 | (inputs (map rewritten-input | 149 | (inputs (map rewritten-input |
| 151 | (package-inputs p))) | 150 | (package-inputs p))) |
| 152 | (native-inputs (map rewritten-input | 151 | (native-inputs (map rewritten-input |
| 153 | (package-native-inputs p))) | 152 | (package-native-inputs p))) |
| 154 | (propagated-inputs (map rewritten-input | 153 | (propagated-inputs (map rewritten-input |
| 155 | (package-propagated-inputs p))) | 154 | (package-propagated-inputs p))) |
| 156 | (replacement (and=> (package-replacement p) | 155 | (replacement (and=> (package-replacement p) |
| 157 | package-with-bootstrap-guile)))))) | 156 | package-with-bootstrap-guile))))) |
| 158 | 157 | ||
| 159 | (define* (glibc-dynamic-linker | 158 | (define* (glibc-dynamic-linker |
| 160 | #:optional (system (or (and=> (%current-target-system) | 159 | #:optional (system (or (and=> (%current-target-system) |
