diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2015-11-08 21:57:42 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2015-11-08 22:21:19 +0100 |
| commit | b68d2dbf0850d52e393f902dd64371cde85515a8 (patch) | |
| tree | 7d568ea40ce06e1ae918b94c20548b85c0895d3c | |
| parent | d8c97beb064cd710e182adec478861e62c80902f (diff) | |
refresh: Discard PyPI updater when Guile-JSON is missing.
Reported by Sleep_Walker and Mathieu Lirzin <mthl@gnu.org>.
* guix/scripts/refresh.scm (maybe-updater, list-updaters): New macros.
(%updaters): Use 'list-updaters' instead of 'list'. Make
%PYPI-UPDATER conditional.
| -rw-r--r-- | guix/scripts/refresh.scm | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 3984a0bde10..8c2ca811758 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm | |||
| @@ -30,7 +30,6 @@ | |||
| 30 | #:use-module ((guix gnu-maintenance) #:select (%gnu-updater)) | 30 | #:use-module ((guix gnu-maintenance) #:select (%gnu-updater)) |
| 31 | #:use-module (guix import elpa) | 31 | #:use-module (guix import elpa) |
| 32 | #:use-module (guix import cran) | 32 | #:use-module (guix import cran) |
| 33 | #:use-module (guix import pypi) | ||
| 34 | #:use-module (guix gnupg) | 33 | #:use-module (guix gnupg) |
| 35 | #:use-module (gnu packages) | 34 | #:use-module (gnu packages) |
| 36 | #:use-module ((gnu packages commencement) #:select (%final-inputs)) | 35 | #:use-module ((gnu packages commencement) #:select (%final-inputs)) |
| @@ -149,12 +148,43 @@ specified with `--select'.\n")) | |||
| 149 | ;;; Updates. | 148 | ;;; Updates. |
| 150 | ;;; | 149 | ;;; |
| 151 | 150 | ||
| 151 | (define-syntax maybe-updater | ||
| 152 | ;; Helper macro for 'list-udpaters'. | ||
| 153 | (lambda (s) | ||
| 154 | (syntax-case s (=>) | ||
| 155 | ((_ ((module => updater) rest ...) (result ...)) | ||
| 156 | (let ((met? (false-if-exception | ||
| 157 | (resolve-interface (syntax->datum #'module))))) | ||
| 158 | (if met? | ||
| 159 | #'(maybe-updater (rest ...) | ||
| 160 | (result ... (@ module updater))) | ||
| 161 | #'(maybe-updater (rest ...) (result ...))))) | ||
| 162 | ((_ (updater rest ...) (result ...)) | ||
| 163 | #'(maybe-updater (rest ...) (result ... updater))) | ||
| 164 | ((_ () result) | ||
| 165 | #'result)))) | ||
| 166 | |||
| 167 | (define-syntax-rule (list-updaters updaters ...) | ||
| 168 | "Expand to '(list UPDATERS ...)' but only the subset of UPDATERS that are | ||
| 169 | either unconditional, or have their requirement met. | ||
| 170 | |||
| 171 | A conditional updater has this form: | ||
| 172 | |||
| 173 | ((SOME MODULE) => UPDATER) | ||
| 174 | |||
| 175 | meaning that UPDATER is added to the list if and only if (SOME MODULE) could | ||
| 176 | be resolved at macro expansion time. | ||
| 177 | |||
| 178 | This is a way to discard at macro expansion time updaters that depend on | ||
| 179 | unavailable optional dependencies such as Guile-JSON." | ||
| 180 | (maybe-updater (updaters ...) (list))) | ||
| 181 | |||
| 152 | (define %updaters | 182 | (define %updaters |
| 153 | ;; List of "updaters" used by default. They are consulted in this order. | 183 | ;; List of "updaters" used by default. They are consulted in this order. |
| 154 | (list %gnu-updater | 184 | (list-updaters %gnu-updater |
| 155 | %elpa-updater | 185 | %elpa-updater |
| 156 | %cran-updater | 186 | %cran-updater |
| 157 | %pypi-updater)) | 187 | ((guix import pypi) => %pypi-updater))) |
| 158 | 188 | ||
| 159 | (define (lookup-updater name) | 189 | (define (lookup-updater name) |
| 160 | "Return the updater called NAME." | 190 | "Return the updater called NAME." |
