diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2021-03-10 08:48:19 +0100 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-03-10 08:49:48 +0100 |
| commit | 76bea3f8bcd951ded88dfb7f8cad5bc3e5a1701f (patch) | |
| tree | 22968402c681697e3fd23e5988d5e79f64a9b1a5 /gnu/ci.scm | |
| parent | 4399b1cf572b1e23ac80a7b7d63daee34a77e104 (diff) | |
ci: Remove hydra support.
This removes hydra support to use Cuirass as the only continuous integration
system.
* build-aux/hydra/gnu-system.scm: Remove it.
* build-aux/hydra/guix-modular.scm: Ditto.
* build-aux/hydra/guix.scm: Ditto.
* build-aux/cuirass/hydra-to-cuirass.scm: Ditto.
* Makefile.am (EXTRA_DIST): Update it.
(hydra-jobs.scm): Remove it.
(cuirass-jobs.scm): Update it.
* build-aux/hydra/evaluate.scm: Move it to ...
* build-aux/cuirass/evaluate.scm: ... here.
* build-aux/cuirass/guix-modular.scm: Remove it.
* build-aux/cuirass/gnu-system.scm: Ditto.
* guix/packages.scm (%hydra-supported-systems): Rename it to ...
(%cuirass-supported-systems): ... this variable.
* build-aux/check-final-inputs-self-contained: Adapt it.
* etc/release-manifest.scm: Ditto.
* gnu/ci.scm (package->alist): Remove it.
(derivation->job): New procedure.
(package-job, package-cross-job, cross-jobs, image-jobs, system-test-jobs,
tarball-jobs): Use it.
(guix-jobs): New procedure.
(hydra-jobs): Rename it to ...
(cuirass-jobs): ... this procedure.
Diffstat (limited to 'gnu/ci.scm')
| -rw-r--r-- | gnu/ci.scm | 452 |
1 files changed, 205 insertions, 247 deletions
diff --git a/gnu/ci.scm b/gnu/ci.scm index 96bff648750..6edcdd0e19d 100644 --- a/gnu/ci.scm +++ b/gnu/ci.scm | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | ;;; Copyright © 2017, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> | 3 | ;;; Copyright © 2017, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
| 4 | ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org> | 4 | ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org> |
| 5 | ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> | 5 | ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> |
| 6 | ;;; Copyright © 2020 Mathieu Othacehe <othacehe@gnu.org> | 6 | ;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org> |
| 7 | ;;; | 7 | ;;; |
| 8 | ;;; This file is part of GNU Guix. | 8 | ;;; This file is part of GNU Guix. |
| 9 | ;;; | 9 | ;;; |
| @@ -21,6 +21,7 @@ | |||
| 21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | 21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | ||
| 23 | (define-module (gnu ci) | 23 | (define-module (gnu ci) |
| 24 | #:use-module (guix channels) | ||
| 24 | #:use-module (guix config) | 25 | #:use-module (guix config) |
| 25 | #:use-module (guix store) | 26 | #:use-module (guix store) |
| 26 | #:use-module (guix grafts) | 27 | #:use-module (guix grafts) |
| @@ -64,67 +65,69 @@ | |||
| 64 | #:use-module (srfi srfi-1) | 65 | #:use-module (srfi srfi-1) |
| 65 | #:use-module (srfi srfi-26) | 66 | #:use-module (srfi srfi-26) |
| 66 | #:use-module (ice-9 match) | 67 | #:use-module (ice-9 match) |
| 67 | #:export (%cross-targets | 68 | #:export (%core-packages |
| 69 | %cross-targets | ||
| 68 | channel-source->package | 70 | channel-source->package |
| 69 | hydra-jobs)) | 71 | cuirass-jobs)) |
| 70 | 72 | ||
| 71 | ;;; Commentary: | 73 | ;;; Commentary: |
| 72 | ;;; | 74 | ;;; |
| 73 | ;;; This file defines build jobs for the Hydra and Cuirass continuation | 75 | ;;; This file defines build jobs for Cuirass. |
| 74 | ;;; integration tools. | ||
| 75 | ;;; | 76 | ;;; |
| 76 | ;;; Code: | 77 | ;;; Code: |
| 77 | 78 | ||
| 78 | (define* (package->alist store package system | 79 | (define* (derivation->job name drv |
| 79 | #:optional (package-derivation package-derivation)) | 80 | #:key |
| 80 | "Convert PACKAGE to an alist suitable for Hydra." | 81 | period |
| 81 | (parameterize ((%graft? #f)) | 82 | (max-silent-time 3600) |
| 82 | (let ((drv (package-derivation store package system | 83 | (timeout 3600)) |
| 83 | #:graft? #f))) | 84 | "Return a Cuirass job called NAME and describing DRV. PERIOD is the minimal |
| 84 | `((derivation . ,(derivation-file-name drv)) | 85 | duration that must separate two evaluations of the same job. If PERIOD is |
| 85 | (log . ,(log-file store (derivation-file-name drv))) | 86 | false, then the job will be evaluated as soon as possible. |
| 86 | (outputs . ,(filter-map (lambda (res) | 87 | |
| 87 | (match res | 88 | MAX-SILENT-TIME and TIMEOUT are build options passed to the daemon when |
| 88 | ((name . path) | 89 | building the derivation." |
| 89 | `(,name . ,path)))) | 90 | `((#:job-name . ,name) |
| 90 | (derivation->output-paths drv))) | 91 | (#:derivation . ,(derivation-file-name drv)) |
| 91 | (nix-name . ,(derivation-name drv)) | 92 | (#:outputs . ,(filter-map |
| 92 | (system . ,(derivation-system drv)) | 93 | (lambda (res) |
| 93 | (description . ,(package-synopsis package)) | 94 | (match res |
| 94 | (long-description . ,(package-description package)) | 95 | ((name . path) |
| 95 | 96 | `(,name . ,path)))) | |
| 96 | ;; XXX: Hydra ignores licenses that are not a <license> structure or a | 97 | (derivation->output-paths drv))) |
| 97 | ;; list thereof. | 98 | (#:nix-name . ,(derivation-name drv)) |
| 98 | (license . ,(let loop ((license (package-license package))) | 99 | (#:system . ,(derivation-system drv)) |
| 99 | (match license | 100 | (#:period . ,period) |
| 100 | ((? license?) | 101 | (#:max-silent-time . ,max-silent-time) |
| 101 | (license-name license)) | 102 | (#:timeout . ,timeout))) |
| 102 | ((lst ...) | 103 | |
| 103 | (map loop license))))) | 104 | (define* (package-job store job-name package system |
| 104 | 105 | #:key cross? target) | |
| 105 | (home-page . ,(package-home-page package)) | ||
| 106 | (maintainers . ("bug-guix@gnu.org")) | ||
| 107 | (max-silent-time . ,(or (assoc-ref (package-properties package) | ||
| 108 | 'max-silent-time) | ||
| 109 | 3600)) ;1 hour by default | ||
| 110 | (timeout . ,(or (assoc-ref (package-properties package) 'timeout) | ||
| 111 | 72000)))))) ;20 hours by default | ||
| 112 | |||
| 113 | (define (package-job store job-name package system) | ||
| 114 | "Return a job called JOB-NAME that builds PACKAGE on SYSTEM." | 106 | "Return a job called JOB-NAME that builds PACKAGE on SYSTEM." |
| 115 | (let ((job-name (symbol-append job-name (string->symbol ".") | 107 | (let ((job-name (string-append job-name "." system))) |
| 116 | (string->symbol system)))) | 108 | (parameterize ((%graft? #f)) |
| 117 | `(,job-name . ,(cut package->alist store package system)))) | 109 | (let* ((drv (if cross? |
| 110 | (package-cross-derivation store package target system | ||
| 111 | #:graft? #f) | ||
| 112 | (package-derivation store package system | ||
| 113 | #:graft? #f))) | ||
| 114 | (max-silent-time (or (assoc-ref (package-properties package) | ||
| 115 | 'max-silent-time) | ||
| 116 | 3600)) | ||
| 117 | (timeout (or (assoc-ref (package-properties package) | ||
| 118 | 'timeout) | ||
| 119 | 72000))) | ||
| 120 | (derivation->job job-name drv | ||
| 121 | #:max-silent-time max-silent-time | ||
| 122 | #:timeout timeout))))) | ||
| 118 | 123 | ||
| 119 | (define (package-cross-job store job-name package target system) | 124 | (define (package-cross-job store job-name package target system) |
| 120 | "Return a job called TARGET.JOB-NAME that cross-builds PACKAGE for TARGET on | 125 | "Return a job called TARGET.JOB-NAME that cross-builds PACKAGE for TARGET on |
| 121 | SYSTEM." | 126 | SYSTEM." |
| 122 | `(,(symbol-append (string->symbol target) (string->symbol ".") job-name | 127 | (let ((name (string-append target "." job-name "." system))) |
| 123 | (string->symbol ".") (string->symbol system)) . | 128 | (package-job store name package system |
| 124 | ,(cute package->alist store package system | 129 | #:cross? #t |
| 125 | (lambda* (store package system #:key graft?) | 130 | #:target target))) |
| 126 | (package-cross-derivation store package target system | ||
| 127 | #:graft? graft?))))) | ||
| 128 | 131 | ||
| 129 | (define %core-packages | 132 | (define %core-packages |
| 130 | ;; Note: Don't put the '-final' package variants because (1) that's | 133 | ;; Note: Don't put the '-final' package variants because (1) that's |
| @@ -200,6 +203,22 @@ SYSTEM." | |||
| 200 | (remove (either from-32-to-64? same? pointless?) | 203 | (remove (either from-32-to-64? same? pointless?) |
| 201 | %cross-targets))) | 204 | %cross-targets))) |
| 202 | 205 | ||
| 206 | (define* (guix-jobs store systems #:key source commit) | ||
| 207 | "Return a list of jobs for Guix itself." | ||
| 208 | (define build | ||
| 209 | (primitive-load (string-append source "/build-aux/build-self.scm"))) | ||
| 210 | |||
| 211 | (map | ||
| 212 | (lambda (system) | ||
| 213 | (let ((name (string->symbol | ||
| 214 | (string-append "guix." system))) | ||
| 215 | (drv (run-with-store store | ||
| 216 | (build source #:version commit #:system system | ||
| 217 | #:pull-version 1 | ||
| 218 | #:guile-version "2.2")))) | ||
| 219 | (derivation->job name drv))) | ||
| 220 | systems)) | ||
| 221 | |||
| 203 | ;; Architectures that are able to build or cross-build Guix System images. | 222 | ;; Architectures that are able to build or cross-build Guix System images. |
| 204 | ;; This does not mean that other architectures are not supported, only that | 223 | ;; This does not mean that other architectures are not supported, only that |
| 205 | ;; they are often not fast enough to support Guix System images building. | 224 | ;; they are often not fast enough to support Guix System images building. |
| @@ -219,32 +238,11 @@ SYSTEM." | |||
| 219 | "Return a list of jobs that build images for SYSTEM. Those jobs are | 238 | "Return a list of jobs that build images for SYSTEM. Those jobs are |
| 220 | expensive in storage and I/O operations, hence their periodicity is limited by | 239 | expensive in storage and I/O operations, hence their periodicity is limited by |
| 221 | passing the PERIOD argument." | 240 | passing the PERIOD argument." |
| 222 | (define (->alist drv) | ||
| 223 | `((derivation . ,(derivation-file-name drv)) | ||
| 224 | (log . ,(log-file store (derivation-file-name drv))) | ||
| 225 | (outputs . ,(filter-map (lambda (res) | ||
| 226 | (match res | ||
| 227 | ((name . path) | ||
| 228 | `(,name . ,path)))) | ||
| 229 | (derivation->output-paths drv))) | ||
| 230 | (nix-name . ,(derivation-name drv)) | ||
| 231 | (system . ,(derivation-system drv)) | ||
| 232 | (description . "Stand-alone image of the GNU system") | ||
| 233 | (long-description . "This is a demo stand-alone image of the GNU | ||
| 234 | system.") | ||
| 235 | (license . ,(license-name gpl3+)) | ||
| 236 | (period . ,(hours 48)) | ||
| 237 | (max-silent-time . 3600) | ||
| 238 | (timeout . 3600) | ||
| 239 | (home-page . ,%guix-home-page-url) | ||
| 240 | (maintainers . ("bug-guix@gnu.org")))) | ||
| 241 | |||
| 242 | (define (->job name drv) | 241 | (define (->job name drv) |
| 243 | (let ((name (symbol-append name (string->symbol ".") | 242 | (let ((name (string-append name "." system))) |
| 244 | (string->symbol system)))) | 243 | (parameterize ((%graft? #f)) |
| 245 | `(,name . ,(lambda () | 244 | (derivation->job name drv |
| 246 | (parameterize ((%graft? #f)) | 245 | #:period (hours 48))))) |
| 247 | (->alist drv)))))) | ||
| 248 | 246 | ||
| 249 | (define (build-image image) | 247 | (define (build-image image) |
| 250 | (run-with-store store | 248 | (run-with-store store |
| @@ -256,25 +254,26 @@ system.") | |||
| 256 | (expt 2 20)) | 254 | (expt 2 20)) |
| 257 | 255 | ||
| 258 | (if (member system %guix-system-supported-systems) | 256 | (if (member system %guix-system-supported-systems) |
| 259 | `(,(->job 'usb-image | 257 | `(,(->job "usb-image" |
| 260 | (build-image | 258 | (build-image |
| 261 | (image | 259 | (image |
| 262 | (inherit efi-disk-image) | 260 | (inherit efi-disk-image) |
| 263 | (operating-system installation-os)))) | 261 | (operating-system installation-os)))) |
| 264 | ,(->job 'iso9660-image | 262 | ,(->job "iso9660-image" |
| 265 | (build-image | 263 | (build-image |
| 266 | (image | 264 | (image |
| 267 | (inherit (image-with-label | 265 | (inherit (image-with-label |
| 268 | iso9660-image | 266 | iso9660-image |
| 269 | (string-append "GUIX_" system "_" | 267 | (string-append "GUIX_" system "_" |
| 270 | (if (> (string-length %guix-version) 7) | 268 | (if (> (string-length %guix-version) 7) |
| 271 | (substring %guix-version 0 7) | 269 | (substring %guix-version 0 7) |
| 272 | %guix-version)))) | 270 | %guix-version)))) |
| 273 | (operating-system installation-os)))) | 271 | (operating-system installation-os)))) |
| 274 | ;; Only cross-compile Guix System images from x86_64-linux for now. | 272 | ;; Only cross-compile Guix System images from x86_64-linux for now. |
| 275 | ,@(if (string=? system "x86_64-linux") | 273 | ,@(if (string=? system "x86_64-linux") |
| 276 | (map (lambda (image) | 274 | (map (lambda (image) |
| 277 | (->job (image-name image) (build-image image))) | 275 | (->job (symbol->string (image-name image)) |
| 276 | (build-image image))) | ||
| 278 | %guix-system-images) | 277 | %guix-system-images) |
| 279 | '())) | 278 | '())) |
| 280 | '())) | 279 | '())) |
| @@ -322,112 +321,72 @@ system.") | |||
| 322 | (define* (system-test-jobs store system | 321 | (define* (system-test-jobs store system |
| 323 | #:key source commit) | 322 | #:key source commit) |
| 324 | "Return a list of jobs for the system tests." | 323 | "Return a list of jobs for the system tests." |
| 325 | (define (test->thunk test) | ||
| 326 | (lambda () | ||
| 327 | (define drv | ||
| 328 | (run-with-store store | ||
| 329 | (mbegin %store-monad | ||
| 330 | (set-current-system system) | ||
| 331 | (set-grafting #f) | ||
| 332 | (set-guile-for-build (default-guile)) | ||
| 333 | (system-test-value test)))) | ||
| 334 | |||
| 335 | ;; Those tests are extremely expensive in I/O operations and storage | ||
| 336 | ;; size, use the "period" attribute to run them with a period of at | ||
| 337 | ;; least 48 hours. | ||
| 338 | `((derivation . ,(derivation-file-name drv)) | ||
| 339 | (log . ,(log-file store (derivation-file-name drv))) | ||
| 340 | (outputs . ,(filter-map (lambda (res) | ||
| 341 | (match res | ||
| 342 | ((name . path) | ||
| 343 | `(,name . ,path)))) | ||
| 344 | (derivation->output-paths drv))) | ||
| 345 | (nix-name . ,(derivation-name drv)) | ||
| 346 | (system . ,(derivation-system drv)) | ||
| 347 | (description . ,(format #f "Guix '~a' system test" | ||
| 348 | (system-test-name test))) | ||
| 349 | (long-description . ,(system-test-description test)) | ||
| 350 | (license . ,(license-name gpl3+)) | ||
| 351 | (period . ,(hours 48)) | ||
| 352 | (max-silent-time . 3600) | ||
| 353 | (timeout . 3600) | ||
| 354 | (home-page . ,%guix-home-page-url) | ||
| 355 | (maintainers . ("bug-guix@gnu.org"))))) | ||
| 356 | |||
| 357 | (define (->job test) | 324 | (define (->job test) |
| 358 | (let ((name (string->symbol | 325 | (parameterize ((current-guix-package |
| 359 | (string-append "test." (system-test-name test) | 326 | (channel-source->package source #:commit commit))) |
| 360 | "." system)))) | 327 | (let ((name (string-append "test." (system-test-name test) |
| 361 | (cons name (test->thunk test)))) | 328 | "." system)) |
| 329 | (drv (run-with-store store | ||
| 330 | (mbegin %store-monad | ||
| 331 | (set-current-system system) | ||
| 332 | (set-grafting #f) | ||
| 333 | (set-guile-for-build (default-guile)) | ||
| 334 | (system-test-value test))))) | ||
| 335 | |||
| 336 | ;; Those tests are extremely expensive in I/O operations and storage | ||
| 337 | ;; size, use the "period" attribute to run them with a period of at | ||
| 338 | ;; least 48 hours. | ||
| 339 | (derivation->job name drv | ||
| 340 | #:period (hours 24))))) | ||
| 362 | 341 | ||
| 363 | (if (member system %guix-system-supported-systems) | 342 | (if (member system %guix-system-supported-systems) |
| 364 | ;; Override the value of 'current-guix' used by system tests. Using a | 343 | ;; Override the value of 'current-guix' used by system tests. Using a |
| 365 | ;; channel instance makes tests that rely on 'current-guix' less | 344 | ;; channel instance makes tests that rely on 'current-guix' less |
| 366 | ;; expensive. It also makes sure we get a valid Guix package when this | 345 | ;; expensive. It also makes sure we get a valid Guix package when this |
| 367 | ;; code is not running from a checkout. | 346 | ;; code is not running from a checkout. |
| 368 | (parameterize ((current-guix-package | 347 | (map ->job (all-system-tests)) |
| 369 | (channel-source->package source #:commit commit))) | ||
| 370 | (map ->job (all-system-tests))) | ||
| 371 | '())) | 348 | '())) |
| 372 | 349 | ||
| 373 | (define (tarball-jobs store system) | 350 | (define (tarball-jobs store system) |
| 374 | "Return Hydra jobs to build the self-contained Guix binary tarball." | 351 | "Return jobs to build the self-contained Guix binary tarball." |
| 375 | (define (->alist drv) | ||
| 376 | `((derivation . ,(derivation-file-name drv)) | ||
| 377 | (log . ,(log-file store (derivation-file-name drv))) | ||
| 378 | (outputs . ,(filter-map (lambda (res) | ||
| 379 | (match res | ||
| 380 | ((name . path) | ||
| 381 | `(,name . ,path)))) | ||
| 382 | (derivation->output-paths drv))) | ||
| 383 | (nix-name . ,(derivation-name drv)) | ||
| 384 | (system . ,(derivation-system drv)) | ||
| 385 | (description . "Stand-alone binary Guix tarball") | ||
| 386 | (long-description . "This is a tarball containing binaries of Guix and | ||
| 387 | all its dependencies, and ready to be installed on \"foreign\" distributions.") | ||
| 388 | (license . ,(license-name gpl3+)) | ||
| 389 | (home-page . ,%guix-home-page-url) | ||
| 390 | (maintainers . ("bug-guix@gnu.org")) | ||
| 391 | (period . ,(hours 24)))) | ||
| 392 | |||
| 393 | (define (->job name drv) | 352 | (define (->job name drv) |
| 394 | (let ((name (symbol-append name (string->symbol ".") | 353 | (let ((name (string-append name "." system))) |
| 395 | (string->symbol system)))) | 354 | (parameterize ((%graft? #f)) |
| 396 | `(,name . ,(lambda () | 355 | (derivation->job name drv |
| 397 | (parameterize ((%graft? #f)) | 356 | #:period (hours 24))))) |
| 398 | (->alist drv)))))) | ||
| 399 | 357 | ||
| 400 | ;; XXX: Add a job for the stable Guix? | 358 | ;; XXX: Add a job for the stable Guix? |
| 401 | (list (->job 'binary-tarball | 359 | (list |
| 402 | (run-with-store store | 360 | (->job "binary-tarball" |
| 403 | (mbegin %store-monad | 361 | (run-with-store store |
| 404 | (set-guile-for-build (default-guile)) | 362 | (mbegin %store-monad |
| 405 | (>>= (profile-derivation (packages->manifest (list guix))) | 363 | (set-guile-for-build (default-guile)) |
| 406 | (lambda (profile) | 364 | (>>= (profile-derivation (packages->manifest (list guix))) |
| 407 | (self-contained-tarball "guix-binary" profile | 365 | (lambda (profile) |
| 408 | #:localstatedir? #t | 366 | (self-contained-tarball "guix-binary" profile |
| 409 | #:compressor | 367 | #:localstatedir? #t |
| 410 | (lookup-compressor "xz"))))) | 368 | #:compressor |
| 411 | #:system system)))) | 369 | (lookup-compressor "xz"))))) |
| 370 | #:system system)))) | ||
| 412 | 371 | ||
| 413 | (define job-name | 372 | (define job-name |
| 414 | ;; Return the name of a package's job. | 373 | ;; Return the name of a package's job. |
| 415 | (compose string->symbol package-name)) | 374 | package-name) |
| 416 | 375 | ||
| 417 | (define package->job | 376 | (define package->job |
| 418 | (let ((base-packages | 377 | (let ((base-packages |
| 419 | (delete-duplicates | 378 | (delete-duplicates |
| 420 | (append-map (match-lambda | 379 | (append-map (match-lambda |
| 421 | ((_ package _ ...) | 380 | ((_ package _ ...) |
| 422 | (match (package-transitive-inputs package) | 381 | (match (package-transitive-inputs package) |
| 423 | (((_ inputs _ ...) ...) | 382 | (((_ inputs _ ...) ...) |
| 424 | inputs)))) | 383 | inputs)))) |
| 425 | (%final-inputs))))) | 384 | (%final-inputs))))) |
| 426 | (lambda (store package system) | 385 | (lambda (store package system) |
| 427 | "Return a job for PACKAGE on SYSTEM, or #f if this combination is not | 386 | "Return a job for PACKAGE on SYSTEM, or #f if this combination is not |
| 428 | valid." | 387 | valid." |
| 429 | (cond ((member package base-packages) | 388 | (cond ((member package base-packages) |
| 430 | (package-job store (symbol-append 'base. (job-name package)) | 389 | (package-job store (string-append "base." (job-name package)) |
| 431 | package system)) | 390 | package system)) |
| 432 | ((supported-package? package system) | 391 | ((supported-package? package system) |
| 433 | (let ((drv (package-derivation store package system | 392 | (let ((drv (package-derivation store package system |
| @@ -461,14 +420,19 @@ valid." | |||
| 461 | packages))) | 420 | packages))) |
| 462 | #:select? (const #t))) ;include hidden packages | 421 | #:select? (const #t))) ;include hidden packages |
| 463 | 422 | ||
| 464 | (define (arguments->manifests arguments) | 423 | (define (arguments->manifests arguments channels) |
| 465 | "Return the list of manifests extracted from ARGUMENTS." | 424 | "Return the list of manifests extracted from ARGUMENTS." |
| 425 | (define (channel-name->checkout name) | ||
| 426 | (let ((channel (find (lambda (channel) | ||
| 427 | (eq? (channel-name channel) name)) | ||
| 428 | channels))) | ||
| 429 | (channel-url channel))) | ||
| 430 | |||
| 466 | (map (match-lambda | 431 | (map (match-lambda |
| 467 | ((input-name . relative-path) | 432 | ((name . path) |
| 468 | (let* ((checkout (assq-ref arguments (string->symbol input-name))) | 433 | (let ((checkout (channel-name->checkout name))) |
| 469 | (base (assq-ref checkout 'file-name))) | 434 | (in-vicinity checkout path)))) |
| 470 | (in-vicinity base relative-path)))) | 435 | arguments)) |
| 471 | (assq-ref arguments 'manifests))) | ||
| 472 | 436 | ||
| 473 | (define (manifests->packages store manifests) | 437 | (define (manifests->packages store manifests) |
| 474 | "Return the list of packages found in MANIFESTS." | 438 | "Return the list of packages found in MANIFESTS." |
| @@ -484,100 +448,94 @@ valid." | |||
| 484 | load-manifest) | 448 | load-manifest) |
| 485 | manifests)))) | 449 | manifests)))) |
| 486 | 450 | ||
| 487 | (define (find-current-checkout arguments) | ||
| 488 | "Find the first checkout of ARGUMENTS that provided the current file. | ||
| 489 | Return #f if no such checkout is found." | ||
| 490 | (let ((current-root | ||
| 491 | (canonicalize-path | ||
| 492 | (string-append (dirname (current-filename)) "/..")))) | ||
| 493 | (find (lambda (argument) | ||
| 494 | (and=> (assq-ref argument 'file-name) | ||
| 495 | (lambda (name) | ||
| 496 | (string=? name current-root)))) arguments))) | ||
| 497 | |||
| 498 | 451 | ||
| 499 | ;;; | 452 | ;;; |
| 500 | ;;; Hydra entry point. | 453 | ;;; Cuirass entry point. |
| 501 | ;;; | 454 | ;;; |
| 502 | 455 | ||
| 503 | (define (hydra-jobs store arguments) | 456 | (define (cuirass-jobs store arguments) |
| 504 | "Return Hydra jobs." | 457 | "Register Cuirass jobs." |
| 505 | (define subset | 458 | (define subset |
| 506 | (match (assoc-ref arguments 'subset) | 459 | (assoc-ref arguments 'subset)) |
| 507 | ("core" 'core) ; only build core packages | ||
| 508 | ("hello" 'hello) ; only build hello | ||
| 509 | (((? string?) (? string?) ...) 'list) ; only build selected list of packages | ||
| 510 | ("manifests" 'manifests) ; only build packages in the list of manifests | ||
| 511 | (_ 'all))) ; build everything | ||
| 512 | 460 | ||
| 513 | (define systems | 461 | (define systems |
| 514 | (match (assoc-ref arguments 'systems) | 462 | (match (assoc-ref arguments 'systems) |
| 515 | (#f %hydra-supported-systems) | 463 | (#f %cuirass-supported-systems) |
| 516 | ((lst ...) lst) | 464 | ((lst ...) lst) |
| 517 | ((? string? str) (call-with-input-string str read)))) | 465 | ((? string? str) (call-with-input-string str read)))) |
| 518 | 466 | ||
| 519 | (define checkout | 467 | (define channels |
| 520 | (or (find-current-checkout arguments) | 468 | (let ((channels (assq-ref arguments 'channels))) |
| 521 | (assq-ref arguments 'superior-guix-checkout))) | 469 | (map sexp->channel channels))) |
| 470 | |||
| 471 | (define guix | ||
| 472 | (find guix-channel? channels)) | ||
| 522 | 473 | ||
| 523 | (define commit | 474 | (define commit |
| 524 | (assq-ref checkout 'revision)) | 475 | (channel-commit guix)) |
| 525 | 476 | ||
| 526 | (define source | 477 | (define source |
| 527 | (assq-ref checkout 'file-name)) | 478 | (channel-url guix)) |
| 528 | 479 | ||
| 529 | ;; Turn off grafts. Grafting is meant to happen on the user's machines. | 480 | ;; Turn off grafts. Grafting is meant to happen on the user's machines. |
| 530 | (parameterize ((%graft? #f)) | 481 | (parameterize ((%graft? #f)) |
| 531 | ;; Return one job for each package, except bootstrap packages. | 482 | ;; Return one job for each package, except bootstrap packages. |
| 532 | (append-map (lambda (system) | 483 | (append-map |
| 533 | (format (current-error-port) | 484 | (lambda (system) |
| 534 | "evaluating for '~a' (heap size: ~a MiB)...~%" | 485 | (format (current-error-port) |
| 535 | system | 486 | "evaluating for '~a' (heap size: ~a MiB)...~%" |
| 536 | (round | 487 | system |
| 537 | (/ (assoc-ref (gc-stats) 'heap-size) | 488 | (round |
| 538 | (expt 2. 20)))) | 489 | (/ (assoc-ref (gc-stats) 'heap-size) |
| 539 | (invalidate-derivation-caches!) | 490 | (expt 2. 20)))) |
| 540 | (case subset | 491 | (invalidate-derivation-caches!) |
| 541 | ((all) | 492 | (match subset |
| 542 | ;; Build everything, including replacements. | 493 | ('all |
| 543 | (let ((all (all-packages)) | 494 | ;; Build everything, including replacements. |
| 544 | (job (lambda (package) | 495 | (let ((all (all-packages)) |
| 545 | (package->job store package | 496 | (job (lambda (package) |
| 546 | system)))) | 497 | (package->job store package system)))) |
| 547 | (append (filter-map job all) | 498 | (append |
| 548 | (image-jobs store system) | 499 | (filter-map job all) |
| 549 | (system-test-jobs store system | 500 | (image-jobs store system) |
| 550 | #:source source | 501 | (system-test-jobs store system |
| 551 | #:commit commit) | 502 | #:source source |
| 552 | (tarball-jobs store system) | 503 | #:commit commit) |
| 553 | (cross-jobs store system)))) | 504 | (tarball-jobs store system) |
| 554 | ((core) | 505 | (cross-jobs store system)))) |
| 555 | ;; Build core packages only. | 506 | ('core |
| 556 | (append (map (lambda (package) | 507 | ;; Build core packages only. |
| 557 | (package-job store (job-name package) | 508 | (append |
| 558 | package system)) | 509 | (map (lambda (package) |
| 559 | %core-packages) | 510 | (package-job store (job-name package) |
| 560 | (cross-jobs store system))) | 511 | package system)) |
| 561 | ((hello) | 512 | %core-packages) |
| 562 | ;; Build hello package only. | 513 | (cross-jobs store system))) |
| 563 | (let ((hello (specification->package "hello"))) | 514 | ('guix |
| 564 | (list (package-job store (job-name hello) hello system)))) | 515 | ;; Build Guix modules only. |
| 565 | ((list) | 516 | (guix-jobs store systems |
| 566 | ;; Build selected list of packages only. | 517 | #:source source |
| 567 | (let* ((names (assoc-ref arguments 'subset)) | 518 | #:commit commit)) |
| 568 | (packages (map specification->package names))) | 519 | ('hello |
| 569 | (map (lambda (package) | 520 | ;; Build hello package only. |
| 570 | (package-job store (job-name package) | 521 | (let ((hello (specification->package "hello"))) |
| 571 | package system)) | 522 | (list (package-job store (job-name hello) |
| 572 | packages))) | 523 | hello system)))) |
| 573 | ((manifests) | 524 | (('packages . rest) |
| 574 | ;; Build packages in the list of manifests. | 525 | ;; Build selected list of packages only. |
| 575 | (let* ((manifests (arguments->manifests arguments)) | 526 | (let ((packages (map specification->package rest))) |
| 576 | (packages (manifests->packages store manifests))) | 527 | (map (lambda (package) |
| 577 | (map (lambda (package) | 528 | (package-job store (job-name package) |
| 578 | (package-job store (job-name package) | 529 | package system)) |
| 579 | package system)) | 530 | packages))) |
| 580 | packages))) | 531 | (('manifests . rest) |
| 581 | (else | 532 | ;; Build packages in the list of manifests. |
| 582 | (error "unknown subset" subset)))) | 533 | (let* ((manifests (arguments->manifests rest channels)) |
| 583 | systems))) | 534 | (packages (manifests->packages store manifests))) |
| 535 | (map (lambda (package) | ||
| 536 | (package-job store (job-name package) | ||
| 537 | package system)) | ||
| 538 | packages))) | ||
| 539 | (else | ||
| 540 | (error "unknown subset" subset)))) | ||
| 541 | systems))) | ||
