diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2021-04-28 11:51:33 +0200 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-04-28 11:53:32 +0200 |
| commit | 996b5edf51c132764ca8122d401c5bb2b8d2e3c5 (patch) | |
| tree | 4568598436f893872911dab3f4dc5bc6c222feb8 /gnu | |
| parent | 93242b54e4eff90432df9de4841297f19b358e55 (diff) | |
ci: Factorize image->job procedure.
* gnu/ci.scm (image-jobs): Extract ->job procedure into ...
(image->job): ... this new procedure.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/ci.scm | 68 |
1 files changed, 38 insertions, 30 deletions
diff --git a/gnu/ci.scm b/gnu/ci.scm index babbb60f810..9e4f0a8c82c 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm | |||
| @@ -66,7 +66,10 @@ | |||
| 66 | #:use-module (srfi srfi-1) | 66 | #:use-module (srfi srfi-1) |
| 67 | #:use-module (srfi srfi-26) | 67 | #:use-module (srfi srfi-26) |
| 68 | #:use-module (ice-9 match) | 68 | #:use-module (ice-9 match) |
| 69 | #:export (%core-packages | 69 | #:export (derivation->job |
| 70 | image->job | ||
| 71 | |||
| 72 | %core-packages | ||
| 70 | %cross-targets | 73 | %cross-targets |
| 71 | channel-source->package | 74 | channel-source->package |
| 72 | cuirass-jobs)) | 75 | cuirass-jobs)) |
| @@ -232,43 +235,48 @@ SYSTEM." | |||
| 232 | (define (hours hours) | 235 | (define (hours hours) |
| 233 | (* 3600 hours)) | 236 | (* 3600 hours)) |
| 234 | 237 | ||
| 238 | (define* (image->job store image | ||
| 239 | #:key name system) | ||
| 240 | "Return the job for IMAGE on SYSTEM. If NAME is passed, use it as job name, | ||
| 241 | otherwise use the IMAGE name." | ||
| 242 | (let* ((image-name (or name | ||
| 243 | (symbol->string (image-name image)))) | ||
| 244 | (name (string-append image-name "." system)) | ||
| 245 | (drv (run-with-store store | ||
| 246 | (mbegin %store-monad | ||
| 247 | (set-guile-for-build (default-guile)) | ||
| 248 | (lower-object (system-image image)))))) | ||
| 249 | (parameterize ((%graft? #f)) | ||
| 250 | (derivation->job name drv)))) | ||
| 251 | |||
| 235 | (define (image-jobs store system) | 252 | (define (image-jobs store system) |
| 236 | "Return a list of jobs that build images for SYSTEM." | 253 | "Return a list of jobs that build images for SYSTEM." |
| 237 | (define (->job name drv) | ||
| 238 | (let ((name (string-append name "." system))) | ||
| 239 | (parameterize ((%graft? #f)) | ||
| 240 | (derivation->job name drv)))) | ||
| 241 | |||
| 242 | (define (build-image image) | ||
| 243 | (run-with-store store | ||
| 244 | (mbegin %store-monad | ||
| 245 | (set-guile-for-build (default-guile)) | ||
| 246 | (lower-object (system-image image))))) | ||
| 247 | |||
| 248 | (define MiB | 254 | (define MiB |
| 249 | (expt 2 20)) | 255 | (expt 2 20)) |
| 250 | 256 | ||
| 251 | (if (member system %guix-system-supported-systems) | 257 | (if (member system %guix-system-supported-systems) |
| 252 | `(,(->job "usb-image" | 258 | `(,(image->job store |
| 253 | (build-image | 259 | (image |
| 254 | (image | 260 | (inherit efi-disk-image) |
| 255 | (inherit efi-disk-image) | 261 | (operating-system installation-os)) |
| 256 | (operating-system installation-os)))) | 262 | #:name "usb-image" |
| 257 | ,(->job "iso9660-image" | 263 | #:system system) |
| 258 | (build-image | 264 | ,(image->job |
| 259 | (image | 265 | store |
| 260 | (inherit (image-with-label | 266 | (image |
| 261 | iso9660-image | 267 | (inherit (image-with-label |
| 262 | (string-append "GUIX_" system "_" | 268 | iso9660-image |
| 263 | (if (> (string-length %guix-version) 7) | 269 | (string-append "GUIX_" system "_" |
| 264 | (substring %guix-version 0 7) | 270 | (if (> (string-length %guix-version) 7) |
| 265 | %guix-version)))) | 271 | (substring %guix-version 0 7) |
| 266 | (operating-system installation-os)))) | 272 | %guix-version)))) |
| 273 | (operating-system installation-os)) | ||
| 274 | #:name "iso9660-image" | ||
| 275 | #:system system) | ||
| 267 | ;; Only cross-compile Guix System images from x86_64-linux for now. | 276 | ;; Only cross-compile Guix System images from x86_64-linux for now. |
| 268 | ,@(if (string=? system "x86_64-linux") | 277 | ,@(if (string=? system "x86_64-linux") |
| 269 | (map (lambda (image) | 278 | (map (cut image->job store <> |
| 270 | (->job (symbol->string (image-name image)) | 279 | #:system system) |
| 271 | (build-image image))) | ||
| 272 | %guix-system-images) | 280 | %guix-system-images) |
| 273 | '())) | 281 | '())) |
| 274 | '())) | 282 | '())) |
