diff options
| -rw-r--r-- | gnu/ci.scm | 94 |
1 files changed, 60 insertions, 34 deletions
diff --git a/gnu/ci.scm b/gnu/ci.scm index babbb60f810..c5de25e70ec 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm | |||
| @@ -66,9 +66,14 @@ | |||
| 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 |
| 75 | |||
| 76 | arguments->systems | ||
| 72 | cuirass-jobs)) | 77 | cuirass-jobs)) |
| 73 | 78 | ||
| 74 | ;;; Commentary: | 79 | ;;; Commentary: |
| @@ -87,6 +92,9 @@ MAX-SILENT-TIME and TIMEOUT are build options passed to the daemon when | |||
| 87 | building the derivation." | 92 | building the derivation." |
| 88 | `((#:job-name . ,name) | 93 | `((#:job-name . ,name) |
| 89 | (#:derivation . ,(derivation-file-name drv)) | 94 | (#:derivation . ,(derivation-file-name drv)) |
| 95 | (#:inputs . ,(map (compose derivation-file-name | ||
| 96 | derivation-input-derivation) | ||
| 97 | (derivation-inputs drv))) | ||
| 90 | (#:outputs . ,(filter-map | 98 | (#:outputs . ,(filter-map |
| 91 | (lambda (res) | 99 | (lambda (res) |
| 92 | (match res | 100 | (match res |
| @@ -232,43 +240,48 @@ SYSTEM." | |||
| 232 | (define (hours hours) | 240 | (define (hours hours) |
| 233 | (* 3600 hours)) | 241 | (* 3600 hours)) |
| 234 | 242 | ||
| 243 | (define* (image->job store image | ||
| 244 | #:key name system) | ||
| 245 | "Return the job for IMAGE on SYSTEM. If NAME is passed, use it as job name, | ||
| 246 | otherwise use the IMAGE name." | ||
| 247 | (let* ((image-name (or name | ||
| 248 | (symbol->string (image-name image)))) | ||
| 249 | (name (string-append image-name "." system)) | ||
| 250 | (drv (run-with-store store | ||
| 251 | (mbegin %store-monad | ||
| 252 | (set-guile-for-build (default-guile)) | ||
| 253 | (lower-object (system-image image)))))) | ||
| 254 | (parameterize ((%graft? #f)) | ||
| 255 | (derivation->job name drv)))) | ||
| 256 | |||
| 235 | (define (image-jobs store system) | 257 | (define (image-jobs store system) |
| 236 | "Return a list of jobs that build images for SYSTEM." | 258 | "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 | 259 | (define MiB |
| 249 | (expt 2 20)) | 260 | (expt 2 20)) |
| 250 | 261 | ||
| 251 | (if (member system %guix-system-supported-systems) | 262 | (if (member system %guix-system-supported-systems) |
| 252 | `(,(->job "usb-image" | 263 | `(,(image->job store |
| 253 | (build-image | 264 | (image |
| 254 | (image | 265 | (inherit efi-disk-image) |
| 255 | (inherit efi-disk-image) | 266 | (operating-system installation-os)) |
| 256 | (operating-system installation-os)))) | 267 | #:name "usb-image" |
| 257 | ,(->job "iso9660-image" | 268 | #:system system) |
| 258 | (build-image | 269 | ,(image->job |
| 259 | (image | 270 | store |
| 260 | (inherit (image-with-label | 271 | (image |
| 261 | iso9660-image | 272 | (inherit (image-with-label |
| 262 | (string-append "GUIX_" system "_" | 273 | iso9660-image |
| 263 | (if (> (string-length %guix-version) 7) | 274 | (string-append "GUIX_" system "_" |
| 264 | (substring %guix-version 0 7) | 275 | (if (> (string-length %guix-version) 7) |
| 265 | %guix-version)))) | 276 | (substring %guix-version 0 7) |
| 266 | (operating-system installation-os)))) | 277 | %guix-version)))) |
| 278 | (operating-system installation-os)) | ||
| 279 | #:name "iso9660-image" | ||
| 280 | #:system system) | ||
| 267 | ;; Only cross-compile Guix System images from x86_64-linux for now. | 281 | ;; Only cross-compile Guix System images from x86_64-linux for now. |
| 268 | ,@(if (string=? system "x86_64-linux") | 282 | ,@(if (string=? system "x86_64-linux") |
| 269 | (map (lambda (image) | 283 | (map (cut image->job store <> |
| 270 | (->job (symbol->string (image-name image)) | 284 | #:system system) |
| 271 | (build-image image))) | ||
| 272 | %guix-system-images) | 285 | %guix-system-images) |
| 273 | '())) | 286 | '())) |
| 274 | '())) | 287 | '())) |
| @@ -435,6 +448,13 @@ valid." | |||
| 435 | load-manifest) | 448 | load-manifest) |
| 436 | manifests)))) | 449 | manifests)))) |
| 437 | 450 | ||
| 451 | (define (arguments->systems arguments) | ||
| 452 | "Return the systems list from ARGUMENTS." | ||
| 453 | (match (assoc-ref arguments 'systems) | ||
| 454 | (#f %cuirass-supported-systems) | ||
| 455 | ((lst ...) lst) | ||
| 456 | ((? string? str) (call-with-input-string str read)))) | ||
| 457 | |||
| 438 | 458 | ||
| 439 | ;;; | 459 | ;;; |
| 440 | ;;; Cuirass entry point. | 460 | ;;; Cuirass entry point. |
| @@ -446,10 +466,7 @@ valid." | |||
| 446 | (assoc-ref arguments 'subset)) | 466 | (assoc-ref arguments 'subset)) |
| 447 | 467 | ||
| 448 | (define systems | 468 | (define systems |
| 449 | (match (assoc-ref arguments 'systems) | 469 | (arguments->systems arguments)) |
| 450 | (#f %cuirass-supported-systems) | ||
| 451 | ((lst ...) lst) | ||
| 452 | ((? string? str) (call-with-input-string str read)))) | ||
| 453 | 470 | ||
| 454 | (define channels | 471 | (define channels |
| 455 | (let ((channels (assq-ref arguments 'channels))) | 472 | (let ((channels (assq-ref arguments 'channels))) |
| @@ -514,6 +531,15 @@ valid." | |||
| 514 | ('tarball | 531 | ('tarball |
| 515 | ;; Build Guix tarball only. | 532 | ;; Build Guix tarball only. |
| 516 | (tarball-jobs store system)) | 533 | (tarball-jobs store system)) |
| 534 | (('custom . modules) | ||
| 535 | ;; Build custom modules jobs only. | ||
| 536 | (append-map | ||
| 537 | (lambda (module) | ||
| 538 | (let ((proc (module-ref | ||
| 539 | (resolve-interface module) | ||
| 540 | 'cuirass-jobs))) | ||
| 541 | (proc store arguments))) | ||
| 542 | modules)) | ||
| 517 | (('channels . channels) | 543 | (('channels . channels) |
| 518 | ;; Build only the packages from CHANNELS. | 544 | ;; Build only the packages from CHANNELS. |
| 519 | (let ((all (all-packages))) | 545 | (let ((all (all-packages))) |
