Commit | Line | Data |
---|---|---|
59fb5c1c | 1 | ;;; GNU Guix --- Functional package management for GNU |
a3619079 | 2 | ;;; Copyright © 2012-2022 Ludovic Courtès <ludo@gnu.org> |
db2785cd | 3 | ;;; Copyright © 2017, 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
f71b0a00 | 4 | ;;; Copyright © 2018, 2019 Clément Lassieur <clement@lassieur.org> |
f43ec1c5 | 5 | ;;; Copyright © 2020 Julien Lepiller <julien@lepiller.eu> |
76bea3f8 | 6 | ;;; Copyright © 2020, 2021 Mathieu Othacehe <othacehe@gnu.org> |
59fb5c1c LC |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
11 | ;;; under the terms of the GNU General Public License as published by | |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
15 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | (define-module (gnu ci) | |
5bce4c82 | 24 | #:use-module (guix build-system channel) |
59fb5c1c | 25 | #:use-module (guix config) |
5bce4c82 | 26 | #:autoload (guix describe) (package-channels) |
59fb5c1c | 27 | #:use-module (guix store) |
59fb5c1c LC |
28 | #:use-module (guix profiles) |
29 | #:use-module (guix packages) | |
6756c64a | 30 | #:autoload (guix transformations) (tunable-package? tuned-package) |
7e6d8d36 | 31 | #:use-module (guix channels) |
f43ec1c5 | 32 | #:use-module (guix config) |
59fb5c1c LC |
33 | #:use-module (guix derivations) |
34 | #:use-module (guix monads) | |
dd1ee160 | 35 | #:use-module (guix gexp) |
59fb5c1c | 36 | #:use-module (guix ui) |
b5f8c2c8 LC |
37 | #:use-module ((guix licenses) |
38 | #:select (gpl3+ license? license-name)) | |
59fb5c1c | 39 | #:use-module ((guix utils) #:select (%current-system)) |
22b9734b | 40 | #:use-module ((guix scripts system) #:select (read-operating-system)) |
59fb5c1c | 41 | #:use-module ((guix scripts pack) |
ebe9d660 | 42 | #:select (self-contained-tarball)) |
59fb5c1c LC |
43 | #:use-module (gnu bootloader) |
44 | #:use-module (gnu bootloader u-boot) | |
ebe9d660 | 45 | #:use-module (gnu compression) |
f19cf27c | 46 | #:use-module (gnu image) |
59fb5c1c LC |
47 | #:use-module (gnu packages) |
48 | #:use-module (gnu packages gcc) | |
49 | #:use-module (gnu packages base) | |
50 | #:use-module (gnu packages gawk) | |
51 | #:use-module (gnu packages guile) | |
52 | #:use-module (gnu packages gettext) | |
53 | #:use-module (gnu packages compression) | |
54 | #:use-module (gnu packages multiprecision) | |
55 | #:use-module (gnu packages make-bootstrap) | |
56 | #:use-module (gnu packages package-management) | |
dab819d5 | 57 | #:use-module (guix platform) |
59fb5c1c | 58 | #:use-module (gnu system) |
f19cf27c | 59 | #:use-module (gnu system image) |
59fb5c1c LC |
60 | #:use-module (gnu system vm) |
61 | #:use-module (gnu system install) | |
b06ba9e0 | 62 | #:use-module (gnu system images hurd) |
846e5240 | 63 | #:use-module (gnu system images novena) |
8a4f1eef | 64 | #:use-module (gnu system images pine64) |
17d9a91e | 65 | #:use-module (gnu system images pinebook-pro) |
59fb5c1c LC |
66 | #:use-module (gnu tests) |
67 | #:use-module (srfi srfi-1) | |
68 | #:use-module (srfi srfi-26) | |
69 | #:use-module (ice-9 match) | |
996b5edf MO |
70 | #:export (derivation->job |
71 | image->job | |
72 | ||
73 | %core-packages | |
3034f3d0 MO |
74 | |
75 | arguments->systems | |
76bea3f8 | 76 | cuirass-jobs)) |
59fb5c1c LC |
77 | |
78 | ;;; Commentary: | |
79 | ;;; | |
76bea3f8 | 80 | ;;; This file defines build jobs for Cuirass. |
59fb5c1c LC |
81 | ;;; |
82 | ;;; Code: | |
83 | ||
76bea3f8 MO |
84 | (define* (derivation->job name drv |
85 | #:key | |
76bea3f8 | 86 | (max-silent-time 3600) |
688a4db0 | 87 | (timeout (* 5 3600))) |
14ada964 | 88 | "Return a Cuirass job called NAME and describing DRV. |
76bea3f8 MO |
89 | |
90 | MAX-SILENT-TIME and TIMEOUT are build options passed to the daemon when | |
91 | building the derivation." | |
92 | `((#:job-name . ,name) | |
93 | (#:derivation . ,(derivation-file-name drv)) | |
e4c02ac7 MO |
94 | (#:inputs . ,(map (compose derivation-file-name |
95 | derivation-input-derivation) | |
96 | (derivation-inputs drv))) | |
76bea3f8 MO |
97 | (#:outputs . ,(filter-map |
98 | (lambda (res) | |
99 | (match res | |
100 | ((name . path) | |
101 | `(,name . ,path)))) | |
102 | (derivation->output-paths drv))) | |
103 | (#:nix-name . ,(derivation-name drv)) | |
104 | (#:system . ,(derivation-system drv)) | |
76bea3f8 MO |
105 | (#:max-silent-time . ,max-silent-time) |
106 | (#:timeout . ,timeout))) | |
107 | ||
108 | (define* (package-job store job-name package system | |
6756c64a | 109 | #:key cross? target (suffix "")) |
59fb5c1c | 110 | "Return a job called JOB-NAME that builds PACKAGE on SYSTEM." |
6756c64a | 111 | (let ((job-name (string-append job-name "." system suffix))) |
76bea3f8 MO |
112 | (parameterize ((%graft? #f)) |
113 | (let* ((drv (if cross? | |
114 | (package-cross-derivation store package target system | |
115 | #:graft? #f) | |
116 | (package-derivation store package system | |
117 | #:graft? #f))) | |
118 | (max-silent-time (or (assoc-ref (package-properties package) | |
119 | 'max-silent-time) | |
120 | 3600)) | |
121 | (timeout (or (assoc-ref (package-properties package) | |
122 | 'timeout) | |
123 | 72000))) | |
124 | (derivation->job job-name drv | |
125 | #:max-silent-time max-silent-time | |
126 | #:timeout timeout))))) | |
59fb5c1c LC |
127 | |
128 | (define (package-cross-job store job-name package target system) | |
129 | "Return a job called TARGET.JOB-NAME that cross-builds PACKAGE for TARGET on | |
130 | SYSTEM." | |
39f1486e | 131 | (let ((name (string-append target "." job-name))) |
76bea3f8 MO |
132 | (package-job store name package system |
133 | #:cross? #t | |
134 | #:target target))) | |
59fb5c1c LC |
135 | |
136 | (define %core-packages | |
137 | ;; Note: Don't put the '-final' package variants because (1) that's | |
138 | ;; implicit, and (2) they cannot be cross-built (due to the explicit input | |
139 | ;; chain.) | |
9ac9df25 | 140 | (list gcc-8 gcc-9 gcc-10 gcc-11 glibc binutils |
59fb5c1c | 141 | gmp mpfr mpc coreutils findutils diffutils patch sed grep |
32750e8c | 142 | gawk gnu-gettext hello guile-2.2 guile-3.0 zlib gzip xz guix |
59fb5c1c LC |
143 | %bootstrap-binaries-tarball |
144 | %binutils-bootstrap-tarball | |
145 | (%glibc-bootstrap-tarball) | |
146 | %gcc-bootstrap-tarball | |
147 | %guile-bootstrap-tarball | |
148 | %bootstrap-tarballs)) | |
149 | ||
ac815ecd LC |
150 | (define (commencement-packages system) |
151 | "Return the list of bootstrap packages from the commencement module for | |
152 | SYSTEM." | |
153 | ;; Only include packages supported on SYSTEM. For example, the Mes | |
154 | ;; bootstrap graph is currently not supported on ARM so it should be | |
155 | ;; excluded. | |
156 | (filter (lambda (obj) | |
157 | (and (package? obj) | |
158 | (supported-package? obj system))) | |
159 | (module-map (lambda (sym var) | |
160 | (variable-ref var)) | |
161 | (resolve-module '(gnu packages commencement))))) | |
df49fe2a | 162 | |
668a5198 LC |
163 | (define (packages-to-cross-build target) |
164 | "Return the list of packages to cross-build for TARGET." | |
165 | ;; Don't cross-build the bootstrap tarballs for MinGW. | |
166 | (if (string-contains target "mingw") | |
167 | (drop-right %core-packages 6) | |
168 | %core-packages)) | |
59fb5c1c | 169 | |
3046e73b LC |
170 | (define (cross-jobs store system) |
171 | "Return a list of cross-compilation jobs for SYSTEM." | |
172 | (define (from-32-to-64? target) | |
173 | ;; Return true if SYSTEM is 32-bit and TARGET is 64-bit. This hack | |
174 | ;; prevents known-to-fail cross-builds from i686-linux or armhf-linux to | |
175 | ;; mips64el-linux-gnuabi64. | |
176 | (and (or (string-prefix? "i686-" system) | |
177 | (string-prefix? "i586-" system) | |
178 | (string-prefix? "armhf-" system)) | |
179 | (string-contains target "64"))) ;x86_64, mips64el, aarch64, etc. | |
180 | ||
181 | (define (same? target) | |
182 | ;; Return true if SYSTEM and TARGET are the same thing. This is so we | |
183 | ;; don't try to cross-compile to 'mips64el-linux-gnu' from | |
184 | ;; 'mips64el-linux'. | |
185 | (or (string-contains target system) | |
186 | (and (string-prefix? "armhf" system) ;armhf-linux | |
187 | (string-prefix? "arm" target)))) ;arm-linux-gnueabihf | |
188 | ||
189 | (define (pointless? target) | |
190 | ;; Return #t if it makes no sense to cross-build to TARGET from SYSTEM. | |
191 | (match system | |
192 | ((or "x86_64-linux" "i686-linux") | |
193 | (if (string-contains target "mingw") | |
194 | (not (string=? "x86_64-linux" system)) | |
195 | #f)) | |
196 | (_ | |
197 | ;; Don't try to cross-compile from non-Intel platforms: this isn't | |
198 | ;; very useful and these are often brittle configurations. | |
199 | #t))) | |
200 | ||
201 | (define (either proc1 proc2 proc3) | |
202 | (lambda (x) | |
203 | (or (proc1 x) (proc2 x) (proc3 x)))) | |
204 | ||
205 | (append-map (lambda (target) | |
206 | (map (lambda (package) | |
207 | (package-cross-job store (job-name package) | |
208 | package target system)) | |
50b99c90 | 209 | (packages-to-cross-build target))) |
3046e73b | 210 | (remove (either from-32-to-64? same? pointless?) |
dd970122 | 211 | (targets)))) |
3046e73b | 212 | |
76bea3f8 MO |
213 | (define* (guix-jobs store systems #:key source commit) |
214 | "Return a list of jobs for Guix itself." | |
215 | (define build | |
216 | (primitive-load (string-append source "/build-aux/build-self.scm"))) | |
217 | ||
218 | (map | |
219 | (lambda (system) | |
220 | (let ((name (string->symbol | |
221 | (string-append "guix." system))) | |
222 | (drv (run-with-store store | |
223 | (build source #:version commit #:system system | |
224 | #:pull-version 1 | |
225 | #:guile-version "2.2")))) | |
226 | (derivation->job name drv))) | |
227 | systems)) | |
228 | ||
b06ba9e0 MO |
229 | ;; Architectures that are able to build or cross-build Guix System images. |
230 | ;; This does not mean that other architectures are not supported, only that | |
231 | ;; they are often not fast enough to support Guix System images building. | |
232 | (define %guix-system-supported-systems | |
233 | '("x86_64-linux" "i686-linux")) | |
59fb5c1c | 234 | |
b06ba9e0 | 235 | (define %guix-system-images |
8a4f1eef | 236 | (list hurd-barebones-qcow2-image |
17d9a91e | 237 | pine64-barebones-raw-image |
846e5240 DM |
238 | pinebook-pro-barebones-raw-image |
239 | novena-barebones-raw-image)) | |
59fb5c1c | 240 | |
fc2fa7ad MO |
241 | (define (hours hours) |
242 | (* 3600 hours)) | |
243 | ||
996b5edf MO |
244 | (define* (image->job store image |
245 | #:key name system) | |
246 | "Return the job for IMAGE on SYSTEM. If NAME is passed, use it as job name, | |
247 | otherwise use the IMAGE name." | |
248 | (let* ((image-name (or name | |
249 | (symbol->string (image-name image)))) | |
250 | (name (string-append image-name "." system)) | |
251 | (drv (run-with-store store | |
252 | (mbegin %store-monad | |
253 | (set-guile-for-build (default-guile)) | |
7c2b09f9 | 254 | (lower-object (system-image image) system))))) |
996b5edf MO |
255 | (parameterize ((%graft? #f)) |
256 | (derivation->job name drv)))) | |
257 | ||
5bbb9af5 MO |
258 | (define* (image-jobs store system |
259 | #:key source commit) | |
14ada964 | 260 | "Return a list of jobs that build images for SYSTEM." |
59fb5c1c LC |
261 | (define MiB |
262 | (expt 2 20)) | |
263 | ||
5bbb9af5 MO |
264 | (parameterize ((current-guix-package |
265 | (channel-source->package source #:commit commit))) | |
266 | (if (member system %guix-system-supported-systems) | |
267 | `(,(image->job store | |
268 | (image | |
269 | (inherit efi-disk-image) | |
270 | (operating-system installation-os)) | |
271 | #:name "usb-image" | |
272 | #:system system) | |
273 | ,(image->job | |
274 | store | |
275 | (image | |
276 | (inherit (image-with-label | |
277 | iso9660-image | |
278 | (string-append "GUIX_" system "_" | |
279 | (if (> (string-length %guix-version) 7) | |
280 | (substring %guix-version 0 7) | |
281 | %guix-version)))) | |
282 | (operating-system installation-os)) | |
283 | #:name "iso9660-image" | |
284 | #:system system) | |
285 | ;; Only cross-compile Guix System images from x86_64-linux for now. | |
286 | ,@(if (string=? system "x86_64-linux") | |
287 | (map (cut image->job store <> | |
288 | #:system system) | |
289 | %guix-system-images) | |
290 | '())) | |
291 | '()))) | |
59fb5c1c | 292 | |
7e6d8d36 LC |
293 | (define* (system-test-jobs store system |
294 | #:key source commit) | |
59fb5c1c | 295 | "Return a list of jobs for the system tests." |
59fb5c1c | 296 | (define (->job test) |
fc37346f MO |
297 | (let ((name (string-append "test." (system-test-name test) |
298 | "." system)) | |
299 | (drv (run-with-store store | |
300 | (mbegin %store-monad | |
301 | (set-current-system system) | |
302 | (set-grafting #f) | |
303 | (set-guile-for-build (default-guile)) | |
304 | (system-test-value test))))) | |
76bea3f8 | 305 | |
fc37346f | 306 | (derivation->job name drv))) |
59fb5c1c | 307 | |
b06ba9e0 | 308 | (if (member system %guix-system-supported-systems) |
7e6d8d36 LC |
309 | ;; Override the value of 'current-guix' used by system tests. Using a |
310 | ;; channel instance makes tests that rely on 'current-guix' less | |
311 | ;; expensive. It also makes sure we get a valid Guix package when this | |
312 | ;; code is not running from a checkout. | |
fc37346f MO |
313 | (parameterize ((current-guix-package |
314 | (channel-source->package source #:commit commit))) | |
315 | (map ->job (all-system-tests))) | |
59fb5c1c LC |
316 | '())) |
317 | ||
318 | (define (tarball-jobs store system) | |
76bea3f8 | 319 | "Return jobs to build the self-contained Guix binary tarball." |
59fb5c1c | 320 | (define (->job name drv) |
76bea3f8 MO |
321 | (let ((name (string-append name "." system))) |
322 | (parameterize ((%graft? #f)) | |
14ada964 | 323 | (derivation->job name drv)))) |
59fb5c1c LC |
324 | |
325 | ;; XXX: Add a job for the stable Guix? | |
76bea3f8 MO |
326 | (list |
327 | (->job "binary-tarball" | |
328 | (run-with-store store | |
329 | (mbegin %store-monad | |
330 | (set-guile-for-build (default-guile)) | |
331 | (>>= (profile-derivation (packages->manifest (list guix))) | |
332 | (lambda (profile) | |
333 | (self-contained-tarball "guix-binary" profile | |
2ccb715a | 334 | #:profile-name "current-guix" |
76bea3f8 MO |
335 | #:localstatedir? #t |
336 | #:compressor | |
337 | (lookup-compressor "xz"))))) | |
338 | #:system system)))) | |
59fb5c1c LC |
339 | |
340 | (define job-name | |
341 | ;; Return the name of a package's job. | |
76bea3f8 | 342 | package-name) |
59fb5c1c LC |
343 | |
344 | (define package->job | |
345 | (let ((base-packages | |
346 | (delete-duplicates | |
347 | (append-map (match-lambda | |
76bea3f8 MO |
348 | ((_ package _ ...) |
349 | (match (package-transitive-inputs package) | |
350 | (((_ inputs _ ...) ...) | |
351 | inputs)))) | |
59fb5c1c | 352 | (%final-inputs))))) |
6756c64a | 353 | (lambda* (store package system #:key (suffix "")) |
59fb5c1c | 354 | "Return a job for PACKAGE on SYSTEM, or #f if this combination is not |
6756c64a | 355 | valid. Append SUFFIX to the job name." |
59fb5c1c | 356 | (cond ((member package base-packages) |
76bea3f8 | 357 | (package-job store (string-append "base." (job-name package)) |
6756c64a | 358 | package system #:suffix suffix)) |
59fb5c1c LC |
359 | ((supported-package? package system) |
360 | (let ((drv (package-derivation store package system | |
361 | #:graft? #f))) | |
362 | (and (substitutable-derivation? drv) | |
363 | (package-job store (job-name package) | |
6756c64a | 364 | package system #:suffix suffix)))) |
59fb5c1c LC |
365 | (else |
366 | #f))))) | |
367 | ||
6756c64a LC |
368 | (define %x86-64-micro-architectures |
369 | ;; Micro-architectures for which we build tuned variants. | |
370 | '("westmere" "ivybridge" "haswell" "skylake" "skylake-avx512")) | |
371 | ||
372 | (define (tuned-package-jobs store package system) | |
373 | "Return a list of jobs for PACKAGE tuned for SYSTEM's micro-architectures." | |
374 | (filter-map (lambda (micro-architecture) | |
375 | (define suffix | |
376 | (string-append "." micro-architecture)) | |
377 | ||
378 | (package->job store | |
379 | (tuned-package package micro-architecture) | |
380 | system | |
381 | #:suffix suffix)) | |
382 | (match system | |
383 | ("x86_64-linux" %x86-64-micro-architectures) | |
384 | (_ '())))) | |
385 | ||
59fb5c1c LC |
386 | (define (all-packages) |
387 | "Return the list of packages to build." | |
388 | (define (adjust package result) | |
389 | (cond ((package-replacement package) | |
f00ff8db LC |
390 | ;; XXX: If PACKAGE and its replacement have the same name/version, |
391 | ;; then both Cuirass jobs will have the same name, which | |
392 | ;; effectively means that the second one will be ignored. Thus, | |
393 | ;; return the replacement first. | |
394 | (cons* (package-replacement package) ;build both | |
395 | package | |
59fb5c1c LC |
396 | result)) |
397 | ((package-superseded package) | |
398 | result) ;don't build it | |
399 | (else | |
400 | (cons package result)))) | |
401 | ||
402 | (fold-packages adjust | |
403 | (fold adjust '() ;include base packages | |
404 | (match (%final-inputs) | |
405 | (((labels packages _ ...) ...) | |
406 | packages))) | |
407 | #:select? (const #t))) ;include hidden packages | |
408 | ||
76bea3f8 | 409 | (define (arguments->manifests arguments channels) |
59fb5c1c | 410 | "Return the list of manifests extracted from ARGUMENTS." |
862af8c2 MO |
411 | (map (lambda (manifest) |
412 | (any (lambda (checkout) | |
413 | (let ((path (in-vicinity checkout manifest))) | |
414 | (and (file-exists? path) | |
415 | path))) | |
416 | (map channel-url channels))) | |
76bea3f8 | 417 | arguments)) |
59fb5c1c | 418 | |
688a4db0 LC |
419 | (define (manifests->jobs store manifests) |
420 | "Return the list of jobs for the entries in MANIFESTS, a list of file | |
421 | names." | |
59fb5c1c LC |
422 | (define (load-manifest manifest) |
423 | (save-module-excursion | |
424 | (lambda () | |
425 | (set-current-module (make-user-module '((guix profiles) (gnu)))) | |
426 | (primitive-load manifest)))) | |
427 | ||
688a4db0 LC |
428 | (define (manifest-entry-job-name entry) |
429 | (string-append (manifest-entry-name entry) "-" | |
430 | (manifest-entry-version entry))) | |
431 | ||
432 | (define (manifest-entry->job entry) | |
433 | (let* ((obj (manifest-entry-item entry)) | |
434 | (drv (parameterize ((%graft? #f)) | |
435 | (run-with-store store | |
436 | (lower-object obj)))) | |
437 | (max-silent-time (or (and (package? obj) | |
438 | (assoc-ref (package-properties obj) | |
439 | 'max-silent-time)) | |
440 | 3600)) | |
441 | (timeout (or (and (package? obj) | |
442 | (assoc-ref (package-properties obj) 'timeout)) | |
443 | (* 5 3600)))) | |
444 | (derivation->job (manifest-entry-job-name entry) drv | |
445 | #:max-silent-time max-silent-time | |
446 | #:timeout timeout))) | |
447 | ||
448 | (map manifest-entry->job | |
449 | (delete-duplicates | |
450 | (append-map (compose manifest-entries load-manifest) | |
451 | manifests) | |
452 | manifest-entry=?))) | |
59fb5c1c | 453 | |
3034f3d0 MO |
454 | (define (arguments->systems arguments) |
455 | "Return the systems list from ARGUMENTS." | |
456 | (match (assoc-ref arguments 'systems) | |
457 | (#f %cuirass-supported-systems) | |
458 | ((lst ...) lst) | |
459 | ((? string? str) (call-with-input-string str read)))) | |
460 | ||
59fb5c1c LC |
461 | \f |
462 | ;;; | |
76bea3f8 | 463 | ;;; Cuirass entry point. |
59fb5c1c LC |
464 | ;;; |
465 | ||
76bea3f8 MO |
466 | (define (cuirass-jobs store arguments) |
467 | "Register Cuirass jobs." | |
59fb5c1c | 468 | (define subset |
76bea3f8 | 469 | (assoc-ref arguments 'subset)) |
59fb5c1c LC |
470 | |
471 | (define systems | |
3034f3d0 | 472 | (arguments->systems arguments)) |
59fb5c1c | 473 | |
76bea3f8 MO |
474 | (define channels |
475 | (let ((channels (assq-ref arguments 'channels))) | |
476 | (map sexp->channel channels))) | |
477 | ||
478 | (define guix | |
479 | (find guix-channel? channels)) | |
7e6d8d36 LC |
480 | |
481 | (define commit | |
76bea3f8 | 482 | (channel-commit guix)) |
7e6d8d36 LC |
483 | |
484 | (define source | |
76bea3f8 | 485 | (channel-url guix)) |
7e6d8d36 | 486 | |
59fb5c1c LC |
487 | ;; Turn off grafts. Grafting is meant to happen on the user's machines. |
488 | (parameterize ((%graft? #f)) | |
489 | ;; Return one job for each package, except bootstrap packages. | |
76bea3f8 MO |
490 | (append-map |
491 | (lambda (system) | |
492 | (format (current-error-port) | |
493 | "evaluating for '~a' (heap size: ~a MiB)...~%" | |
494 | system | |
495 | (round | |
496 | (/ (assoc-ref (gc-stats) 'heap-size) | |
497 | (expt 2. 20)))) | |
498 | (invalidate-derivation-caches!) | |
499 | (match subset | |
500 | ('all | |
501 | ;; Build everything, including replacements. | |
502 | (let ((all (all-packages)) | |
6756c64a LC |
503 | (jobs (lambda (package) |
504 | (match (package->job store package system) | |
505 | (#f '()) | |
506 | (main-job | |
507 | (cons main-job | |
508 | (if (tunable-package? package) | |
509 | (tuned-package-jobs store package system) | |
510 | '()))))))) | |
76bea3f8 | 511 | (append |
6756c64a | 512 | (append-map jobs all) |
76bea3f8 MO |
513 | (cross-jobs store system)))) |
514 | ('core | |
515 | ;; Build core packages only. | |
516 | (append | |
517 | (map (lambda (package) | |
518 | (package-job store (job-name package) | |
519 | package system)) | |
ac815ecd | 520 | (append (commencement-packages system) %core-packages)) |
76bea3f8 MO |
521 | (cross-jobs store system))) |
522 | ('guix | |
523 | ;; Build Guix modules only. | |
524 | (guix-jobs store systems | |
525 | #:source source | |
526 | #:commit commit)) | |
527 | ('hello | |
528 | ;; Build hello package only. | |
529 | (let ((hello (specification->package "hello"))) | |
530 | (list (package-job store (job-name hello) | |
531 | hello system)))) | |
2afc79b5 MO |
532 | ('images |
533 | ;; Build Guix System images only. | |
5bbb9af5 MO |
534 | (image-jobs store system |
535 | #:source source | |
536 | #:commit commit)) | |
2afc79b5 MO |
537 | ('system-tests |
538 | ;; Build Guix System tests only. | |
539 | (system-test-jobs store system | |
540 | #:source source | |
541 | #:commit commit)) | |
542 | ('tarball | |
543 | ;; Build Guix tarball only. | |
544 | (tarball-jobs store system)) | |
f97e220b MO |
545 | (('custom . modules) |
546 | ;; Build custom modules jobs only. | |
547 | (append-map | |
548 | (lambda (module) | |
549 | (let ((proc (module-ref | |
550 | (resolve-interface module) | |
551 | 'cuirass-jobs))) | |
552 | (proc store arguments))) | |
553 | modules)) | |
61a11653 MO |
554 | (('channels . channels) |
555 | ;; Build only the packages from CHANNELS. | |
556 | (let ((all (all-packages))) | |
557 | (filter-map | |
558 | (lambda (package) | |
cbfcbb79 MO |
559 | (any (lambda (channel) |
560 | (and (member (channel-name channel) channels) | |
561 | (package->job store package system))) | |
562 | (package-channels package))) | |
61a11653 | 563 | all))) |
76bea3f8 MO |
564 | (('packages . rest) |
565 | ;; Build selected list of packages only. | |
566 | (let ((packages (map specification->package rest))) | |
567 | (map (lambda (package) | |
568 | (package-job store (job-name package) | |
569 | package system)) | |
570 | packages))) | |
571 | (('manifests . rest) | |
572 | ;; Build packages in the list of manifests. | |
688a4db0 LC |
573 | (let ((manifests (arguments->manifests rest channels))) |
574 | (manifests->jobs store manifests))) | |
76bea3f8 MO |
575 | (else |
576 | (error "unknown subset" subset)))) | |
577 | systems))) |