Commit | Line | Data |
---|---|---|
59fb5c1c | 1 | ;;; GNU Guix --- Functional package management for GNU |
2032d847 | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 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> |
59fb5c1c LC |
6 | ;;; |
7 | ;;; This file is part of GNU Guix. | |
8 | ;;; | |
9 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
10 | ;;; under the terms of the GNU General Public License as published by | |
11 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
12 | ;;; your option) any later version. | |
13 | ;;; | |
14 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
15 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | ;;; GNU General Public License for more details. | |
18 | ;;; | |
19 | ;;; You should have received a copy of the GNU General Public License | |
20 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
21 | ||
22 | (define-module (gnu ci) | |
23 | #:use-module (guix config) | |
24 | #:use-module (guix store) | |
25 | #:use-module (guix grafts) | |
26 | #:use-module (guix profiles) | |
27 | #:use-module (guix packages) | |
7e6d8d36 | 28 | #:use-module (guix channels) |
f43ec1c5 | 29 | #:use-module (guix config) |
59fb5c1c | 30 | #:use-module (guix derivations) |
7e6d8d36 | 31 | #:use-module (guix build-system) |
59fb5c1c | 32 | #:use-module (guix monads) |
dd1ee160 | 33 | #:use-module (guix gexp) |
59fb5c1c | 34 | #:use-module (guix ui) |
b5f8c2c8 LC |
35 | #:use-module ((guix licenses) |
36 | #:select (gpl3+ license? license-name)) | |
59fb5c1c LC |
37 | #:use-module ((guix utils) #:select (%current-system)) |
38 | #:use-module ((guix scripts system) #:select (read-operating-system)) | |
39 | #:use-module ((guix scripts pack) | |
40 | #:select (lookup-compressor self-contained-tarball)) | |
41 | #:use-module (gnu bootloader) | |
42 | #:use-module (gnu bootloader u-boot) | |
f19cf27c | 43 | #:use-module (gnu image) |
59fb5c1c LC |
44 | #:use-module (gnu packages) |
45 | #:use-module (gnu packages gcc) | |
46 | #:use-module (gnu packages base) | |
47 | #:use-module (gnu packages gawk) | |
48 | #:use-module (gnu packages guile) | |
49 | #:use-module (gnu packages gettext) | |
50 | #:use-module (gnu packages compression) | |
51 | #:use-module (gnu packages multiprecision) | |
52 | #:use-module (gnu packages make-bootstrap) | |
53 | #:use-module (gnu packages package-management) | |
54 | #:use-module (gnu system) | |
f19cf27c | 55 | #:use-module (gnu system image) |
59fb5c1c LC |
56 | #:use-module (gnu system vm) |
57 | #:use-module (gnu system install) | |
b06ba9e0 | 58 | #:use-module (gnu system images hurd) |
59fb5c1c LC |
59 | #:use-module (gnu tests) |
60 | #:use-module (srfi srfi-1) | |
61 | #:use-module (srfi srfi-26) | |
62 | #:use-module (ice-9 match) | |
f292c501 LC |
63 | #:export (%cross-targets |
64 | channel-source->package | |
887fd835 | 65 | hydra-jobs)) |
59fb5c1c LC |
66 | |
67 | ;;; Commentary: | |
68 | ;;; | |
69 | ;;; This file defines build jobs for the Hydra and Cuirass continuation | |
70 | ;;; integration tools. | |
71 | ;;; | |
72 | ;;; Code: | |
73 | ||
74 | (define* (package->alist store package system | |
75 | #:optional (package-derivation package-derivation)) | |
76 | "Convert PACKAGE to an alist suitable for Hydra." | |
77 | (parameterize ((%graft? #f)) | |
3ca014d1 MO |
78 | (let ((drv (package-derivation store package system |
79 | #:graft? #f))) | |
80 | `((derivation . ,(derivation-file-name drv)) | |
81 | (nix-name . ,(derivation-name drv)) | |
82 | (system . ,(derivation-system drv)) | |
83 | (description . ,(package-synopsis package)) | |
84 | (long-description . ,(package-description package)) | |
b5f8c2c8 | 85 | |
3ca014d1 MO |
86 | ;; XXX: Hydra ignores licenses that are not a <license> structure or a |
87 | ;; list thereof. | |
88 | (license . ,(let loop ((license (package-license package))) | |
89 | (match license | |
90 | ((? license?) | |
91 | (license-name license)) | |
92 | ((lst ...) | |
93 | (map loop license))))) | |
b5f8c2c8 | 94 | |
3ca014d1 MO |
95 | (home-page . ,(package-home-page package)) |
96 | (maintainers . ("bug-guix@gnu.org")) | |
97 | (max-silent-time . ,(or (assoc-ref (package-properties package) | |
98 | 'max-silent-time) | |
99 | 3600)) ;1 hour by default | |
100 | (timeout . ,(or (assoc-ref (package-properties package) 'timeout) | |
101 | 72000)))))) ;20 hours by default | |
59fb5c1c LC |
102 | |
103 | (define (package-job store job-name package system) | |
104 | "Return a job called JOB-NAME that builds PACKAGE on SYSTEM." | |
105 | (let ((job-name (symbol-append job-name (string->symbol ".") | |
106 | (string->symbol system)))) | |
107 | `(,job-name . ,(cut package->alist store package system)))) | |
108 | ||
109 | (define (package-cross-job store job-name package target system) | |
110 | "Return a job called TARGET.JOB-NAME that cross-builds PACKAGE for TARGET on | |
111 | SYSTEM." | |
112 | `(,(symbol-append (string->symbol target) (string->symbol ".") job-name | |
113 | (string->symbol ".") (string->symbol system)) . | |
114 | ,(cute package->alist store package system | |
115 | (lambda* (store package system #:key graft?) | |
116 | (package-cross-derivation store package target system | |
117 | #:graft? graft?))))) | |
118 | ||
119 | (define %core-packages | |
120 | ;; Note: Don't put the '-final' package variants because (1) that's | |
121 | ;; implicit, and (2) they cannot be cross-built (due to the explicit input | |
122 | ;; chain.) | |
84f38f03 | 123 | (list gcc-7 gcc-8 gcc-9 gcc-10 glibc binutils |
59fb5c1c LC |
124 | gmp mpfr mpc coreutils findutils diffutils patch sed grep |
125 | gawk gnu-gettext hello guile-2.0 guile-2.2 zlib gzip xz | |
126 | %bootstrap-binaries-tarball | |
127 | %binutils-bootstrap-tarball | |
128 | (%glibc-bootstrap-tarball) | |
129 | %gcc-bootstrap-tarball | |
130 | %guile-bootstrap-tarball | |
131 | %bootstrap-tarballs)) | |
132 | ||
668a5198 LC |
133 | (define (packages-to-cross-build target) |
134 | "Return the list of packages to cross-build for TARGET." | |
135 | ;; Don't cross-build the bootstrap tarballs for MinGW. | |
136 | (if (string-contains target "mingw") | |
137 | (drop-right %core-packages 6) | |
138 | %core-packages)) | |
59fb5c1c LC |
139 | |
140 | (define %cross-targets | |
141 | '("mips64el-linux-gnu" | |
59fb5c1c LC |
142 | "arm-linux-gnueabihf" |
143 | "aarch64-linux-gnu" | |
144 | "powerpc-linux-gnu" | |
2032d847 | 145 | "riscv64-linux-gnu" |
59fb5c1c | 146 | "i586-pc-gnu" ;aka. GNU/Hurd |
67dac6b8 CD |
147 | "i686-w64-mingw32" |
148 | "x86_64-w64-mingw32")) | |
59fb5c1c | 149 | |
3046e73b LC |
150 | (define (cross-jobs store system) |
151 | "Return a list of cross-compilation jobs for SYSTEM." | |
152 | (define (from-32-to-64? target) | |
153 | ;; Return true if SYSTEM is 32-bit and TARGET is 64-bit. This hack | |
154 | ;; prevents known-to-fail cross-builds from i686-linux or armhf-linux to | |
155 | ;; mips64el-linux-gnuabi64. | |
156 | (and (or (string-prefix? "i686-" system) | |
157 | (string-prefix? "i586-" system) | |
158 | (string-prefix? "armhf-" system)) | |
159 | (string-contains target "64"))) ;x86_64, mips64el, aarch64, etc. | |
160 | ||
161 | (define (same? target) | |
162 | ;; Return true if SYSTEM and TARGET are the same thing. This is so we | |
163 | ;; don't try to cross-compile to 'mips64el-linux-gnu' from | |
164 | ;; 'mips64el-linux'. | |
165 | (or (string-contains target system) | |
166 | (and (string-prefix? "armhf" system) ;armhf-linux | |
167 | (string-prefix? "arm" target)))) ;arm-linux-gnueabihf | |
168 | ||
169 | (define (pointless? target) | |
170 | ;; Return #t if it makes no sense to cross-build to TARGET from SYSTEM. | |
171 | (match system | |
172 | ((or "x86_64-linux" "i686-linux") | |
173 | (if (string-contains target "mingw") | |
174 | (not (string=? "x86_64-linux" system)) | |
175 | #f)) | |
176 | (_ | |
177 | ;; Don't try to cross-compile from non-Intel platforms: this isn't | |
178 | ;; very useful and these are often brittle configurations. | |
179 | #t))) | |
180 | ||
181 | (define (either proc1 proc2 proc3) | |
182 | (lambda (x) | |
183 | (or (proc1 x) (proc2 x) (proc3 x)))) | |
184 | ||
185 | (append-map (lambda (target) | |
186 | (map (lambda (package) | |
187 | (package-cross-job store (job-name package) | |
188 | package target system)) | |
50b99c90 | 189 | (packages-to-cross-build target))) |
3046e73b LC |
190 | (remove (either from-32-to-64? same? pointless?) |
191 | %cross-targets))) | |
192 | ||
b06ba9e0 MO |
193 | ;; Architectures that are able to build or cross-build Guix System images. |
194 | ;; This does not mean that other architectures are not supported, only that | |
195 | ;; they are often not fast enough to support Guix System images building. | |
196 | (define %guix-system-supported-systems | |
197 | '("x86_64-linux" "i686-linux")) | |
59fb5c1c | 198 | |
b06ba9e0 | 199 | (define %guix-system-images |
3d0e8750 | 200 | (list hurd-barebones-qcow2-image)) |
59fb5c1c | 201 | |
b06ba9e0 MO |
202 | (define (image-jobs store system) |
203 | "Return a list of jobs that build images for SYSTEM." | |
59fb5c1c LC |
204 | (define (->alist drv) |
205 | `((derivation . ,(derivation-file-name drv)) | |
3ca014d1 MO |
206 | (nix-name . ,(derivation-name drv)) |
207 | (system . ,(derivation-system drv)) | |
b06ba9e0 MO |
208 | (description . "Stand-alone image of the GNU system") |
209 | (long-description . "This is a demo stand-alone image of the GNU | |
59fb5c1c | 210 | system.") |
b5f8c2c8 | 211 | (license . ,(license-name gpl3+)) |
59fb5c1c LC |
212 | (max-silent-time . 600) |
213 | (timeout . 3600) | |
214 | (home-page . ,%guix-home-page-url) | |
215 | (maintainers . ("bug-guix@gnu.org")))) | |
216 | ||
217 | (define (->job name drv) | |
218 | (let ((name (symbol-append name (string->symbol ".") | |
219 | (string->symbol system)))) | |
220 | `(,name . ,(lambda () | |
221 | (parameterize ((%graft? #f)) | |
222 | (->alist drv)))))) | |
223 | ||
b06ba9e0 MO |
224 | (define (build-image image) |
225 | (run-with-store store | |
226 | (mbegin %store-monad | |
227 | (set-guile-for-build (default-guile)) | |
228 | (lower-object (system-image image))))) | |
229 | ||
59fb5c1c LC |
230 | (define MiB |
231 | (expt 2 20)) | |
232 | ||
b06ba9e0 MO |
233 | (if (member system %guix-system-supported-systems) |
234 | `(,(->job 'usb-image | |
235 | (build-image | |
236 | (image | |
237 | (inherit efi-disk-image) | |
b06ba9e0 MO |
238 | (operating-system installation-os)))) |
239 | ,(->job 'iso9660-image | |
240 | (build-image | |
241 | (image | |
f43ec1c5 JL |
242 | (inherit (image-with-label |
243 | iso9660-image | |
7596ae10 JL |
244 | (string-append "GUIX_" system "_" |
245 | (if (> (string-length %guix-version) 7) | |
246 | (substring %guix-version 0 7) | |
247 | %guix-version)))) | |
b06ba9e0 MO |
248 | (operating-system installation-os)))) |
249 | ;; Only cross-compile Guix System images from x86_64-linux for now. | |
250 | ,@(if (string=? system "x86_64-linux") | |
251 | (map (lambda (image) | |
252 | (->job (image-name image) (build-image image))) | |
253 | %guix-system-images) | |
254 | '())) | |
1189f405 | 255 | '())) |
59fb5c1c | 256 | |
7e6d8d36 LC |
257 | (define channel-build-system |
258 | ;; Build system used to "convert" a channel instance to a package. | |
259 | (let* ((build (lambda* (store name inputs | |
dd1ee160 | 260 | #:key source commit system |
c3ab921e | 261 | #:allow-other-keys) |
7e6d8d36 | 262 | (run-with-store store |
bc8b2ffd LC |
263 | ;; SOURCE can be a lowerable object such as <local-file> |
264 | ;; or a file name. Adjust accordingly. | |
265 | (mlet* %store-monad ((source (if (string? source) | |
266 | (return source) | |
267 | (lower-object source))) | |
dd1ee160 LC |
268 | (instance |
269 | -> (checkout->channel-instance | |
270 | source #:commit commit))) | |
271 | (channel-instances->derivation (list instance))) | |
c3ab921e | 272 | #:system system))) |
dd1ee160 LC |
273 | (lower (lambda* (name #:key system source commit |
274 | #:allow-other-keys) | |
7e6d8d36 LC |
275 | (bag |
276 | (name name) | |
277 | (system system) | |
278 | (build build) | |
dd1ee160 LC |
279 | (arguments `(#:source ,source |
280 | #:commit ,commit)))))) | |
7e6d8d36 LC |
281 | (build-system (name 'channel) |
282 | (description "Turn a channel instance into a package.") | |
283 | (lower lower)))) | |
284 | ||
dd1ee160 LC |
285 | (define* (channel-source->package source #:key commit) |
286 | "Return a package for the given channel SOURCE, a lowerable object." | |
7e6d8d36 LC |
287 | (package |
288 | (inherit guix) | |
dd1ee160 | 289 | (version (string-append (package-version guix) "+")) |
7e6d8d36 | 290 | (build-system channel-build-system) |
dd1ee160 LC |
291 | (arguments `(#:source ,source |
292 | #:commit ,commit)) | |
7e6d8d36 LC |
293 | (inputs '()) |
294 | (native-inputs '()) | |
295 | (propagated-inputs '()))) | |
296 | ||
297 | (define* (system-test-jobs store system | |
298 | #:key source commit) | |
59fb5c1c LC |
299 | "Return a list of jobs for the system tests." |
300 | (define (test->thunk test) | |
301 | (lambda () | |
302 | (define drv | |
303 | (run-with-store store | |
304 | (mbegin %store-monad | |
305 | (set-current-system system) | |
306 | (set-grafting #f) | |
307 | (set-guile-for-build (default-guile)) | |
308 | (system-test-value test)))) | |
309 | ||
310 | `((derivation . ,(derivation-file-name drv)) | |
3ca014d1 MO |
311 | (nix-name . ,(derivation-name drv)) |
312 | (system . ,(derivation-system drv)) | |
59e80445 | 313 | (description . ,(format #f "Guix '~a' system test" |
59fb5c1c LC |
314 | (system-test-name test))) |
315 | (long-description . ,(system-test-description test)) | |
b5f8c2c8 | 316 | (license . ,(license-name gpl3+)) |
59fb5c1c LC |
317 | (max-silent-time . 600) |
318 | (timeout . 3600) | |
319 | (home-page . ,%guix-home-page-url) | |
320 | (maintainers . ("bug-guix@gnu.org"))))) | |
321 | ||
322 | (define (->job test) | |
323 | (let ((name (string->symbol | |
324 | (string-append "test." (system-test-name test) | |
325 | "." system)))) | |
326 | (cons name (test->thunk test)))) | |
327 | ||
b06ba9e0 | 328 | (if (member system %guix-system-supported-systems) |
7e6d8d36 LC |
329 | ;; Override the value of 'current-guix' used by system tests. Using a |
330 | ;; channel instance makes tests that rely on 'current-guix' less | |
331 | ;; expensive. It also makes sure we get a valid Guix package when this | |
332 | ;; code is not running from a checkout. | |
333 | (parameterize ((current-guix-package | |
dd1ee160 | 334 | (channel-source->package source #:commit commit))) |
7e6d8d36 | 335 | (map ->job (all-system-tests))) |
59fb5c1c LC |
336 | '())) |
337 | ||
338 | (define (tarball-jobs store system) | |
339 | "Return Hydra jobs to build the self-contained Guix binary tarball." | |
340 | (define (->alist drv) | |
341 | `((derivation . ,(derivation-file-name drv)) | |
3ca014d1 MO |
342 | (nix-name . ,(derivation-name drv)) |
343 | (system . ,(derivation-system drv)) | |
59fb5c1c LC |
344 | (description . "Stand-alone binary Guix tarball") |
345 | (long-description . "This is a tarball containing binaries of Guix and | |
59e80445 | 346 | all its dependencies, and ready to be installed on \"foreign\" distributions.") |
b5f8c2c8 | 347 | (license . ,(license-name gpl3+)) |
59fb5c1c LC |
348 | (home-page . ,%guix-home-page-url) |
349 | (maintainers . ("bug-guix@gnu.org")))) | |
350 | ||
351 | (define (->job name drv) | |
352 | (let ((name (symbol-append name (string->symbol ".") | |
353 | (string->symbol system)))) | |
354 | `(,name . ,(lambda () | |
355 | (parameterize ((%graft? #f)) | |
356 | (->alist drv)))))) | |
357 | ||
358 | ;; XXX: Add a job for the stable Guix? | |
359 | (list (->job 'binary-tarball | |
360 | (run-with-store store | |
361 | (mbegin %store-monad | |
362 | (set-guile-for-build (default-guile)) | |
363 | (>>= (profile-derivation (packages->manifest (list guix))) | |
364 | (lambda (profile) | |
365 | (self-contained-tarball "guix-binary" profile | |
366 | #:localstatedir? #t | |
367 | #:compressor | |
368 | (lookup-compressor "xz"))))) | |
369 | #:system system)))) | |
370 | ||
371 | (define job-name | |
372 | ;; Return the name of a package's job. | |
373 | (compose string->symbol | |
374 | (cut package-full-name <> "-"))) | |
375 | ||
376 | (define package->job | |
377 | (let ((base-packages | |
378 | (delete-duplicates | |
379 | (append-map (match-lambda | |
380 | ((_ package _ ...) | |
381 | (match (package-transitive-inputs package) | |
382 | (((_ inputs _ ...) ...) | |
383 | inputs)))) | |
384 | (%final-inputs))))) | |
385 | (lambda (store package system) | |
386 | "Return a job for PACKAGE on SYSTEM, or #f if this combination is not | |
387 | valid." | |
388 | (cond ((member package base-packages) | |
389 | (package-job store (symbol-append 'base. (job-name package)) | |
390 | package system)) | |
391 | ((supported-package? package system) | |
392 | (let ((drv (package-derivation store package system | |
393 | #:graft? #f))) | |
394 | (and (substitutable-derivation? drv) | |
395 | (package-job store (job-name package) | |
396 | package system)))) | |
397 | (else | |
398 | #f))))) | |
399 | ||
400 | (define (all-packages) | |
401 | "Return the list of packages to build." | |
402 | (define (adjust package result) | |
403 | (cond ((package-replacement package) | |
f00ff8db LC |
404 | ;; XXX: If PACKAGE and its replacement have the same name/version, |
405 | ;; then both Cuirass jobs will have the same name, which | |
406 | ;; effectively means that the second one will be ignored. Thus, | |
407 | ;; return the replacement first. | |
408 | (cons* (package-replacement package) ;build both | |
409 | package | |
59fb5c1c LC |
410 | result)) |
411 | ((package-superseded package) | |
412 | result) ;don't build it | |
413 | (else | |
414 | (cons package result)))) | |
415 | ||
416 | (fold-packages adjust | |
417 | (fold adjust '() ;include base packages | |
418 | (match (%final-inputs) | |
419 | (((labels packages _ ...) ...) | |
420 | packages))) | |
421 | #:select? (const #t))) ;include hidden packages | |
422 | ||
423 | (define (arguments->manifests arguments) | |
424 | "Return the list of manifests extracted from ARGUMENTS." | |
425 | (map (match-lambda | |
426 | ((input-name . relative-path) | |
427 | (let* ((checkout (assq-ref arguments (string->symbol input-name))) | |
428 | (base (assq-ref checkout 'file-name))) | |
429 | (in-vicinity base relative-path)))) | |
430 | (assq-ref arguments 'manifests))) | |
431 | ||
432 | (define (manifests->packages store manifests) | |
433 | "Return the list of packages found in MANIFESTS." | |
434 | (define (load-manifest manifest) | |
435 | (save-module-excursion | |
436 | (lambda () | |
437 | (set-current-module (make-user-module '((guix profiles) (gnu)))) | |
438 | (primitive-load manifest)))) | |
439 | ||
440 | (delete-duplicates! | |
441 | (map manifest-entry-item | |
442 | (append-map (compose manifest-entries | |
443 | load-manifest) | |
444 | manifests)))) | |
445 | ||
f71b0a00 CL |
446 | (define (find-current-checkout arguments) |
447 | "Find the first checkout of ARGUMENTS that provided the current file. | |
448 | Return #f if no such checkout is found." | |
449 | (let ((current-root | |
450 | (canonicalize-path | |
451 | (string-append (dirname (current-filename)) "/..")))) | |
452 | (find (lambda (argument) | |
453 | (and=> (assq-ref argument 'file-name) | |
454 | (lambda (name) | |
455 | (string=? name current-root)))) arguments))) | |
456 | ||
59fb5c1c LC |
457 | \f |
458 | ;;; | |
459 | ;;; Hydra entry point. | |
460 | ;;; | |
461 | ||
462 | (define (hydra-jobs store arguments) | |
463 | "Return Hydra jobs." | |
464 | (define subset | |
465 | (match (assoc-ref arguments 'subset) | |
466 | ("core" 'core) ; only build core packages | |
467 | ("hello" 'hello) ; only build hello | |
468 | (((? string?) (? string?) ...) 'list) ; only build selected list of packages | |
469 | ("manifests" 'manifests) ; only build packages in the list of manifests | |
470 | (_ 'all))) ; build everything | |
471 | ||
472 | (define systems | |
473 | (match (assoc-ref arguments 'systems) | |
474 | (#f %hydra-supported-systems) | |
475 | ((lst ...) lst) | |
476 | ((? string? str) (call-with-input-string str read)))) | |
477 | ||
7e6d8d36 | 478 | (define checkout |
f71b0a00 CL |
479 | (or (find-current-checkout arguments) |
480 | (assq-ref arguments 'superior-guix-checkout))) | |
7e6d8d36 LC |
481 | |
482 | (define commit | |
483 | (assq-ref checkout 'revision)) | |
484 | ||
485 | (define source | |
486 | (assq-ref checkout 'file-name)) | |
487 | ||
59fb5c1c LC |
488 | ;; Turn off grafts. Grafting is meant to happen on the user's machines. |
489 | (parameterize ((%graft? #f)) | |
490 | ;; Return one job for each package, except bootstrap packages. | |
491 | (append-map (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 | (case subset | |
500 | ((all) | |
501 | ;; Build everything, including replacements. | |
502 | (let ((all (all-packages)) | |
503 | (job (lambda (package) | |
504 | (package->job store package | |
505 | system)))) | |
506 | (append (filter-map job all) | |
b06ba9e0 | 507 | (image-jobs store system) |
7e6d8d36 LC |
508 | (system-test-jobs store system |
509 | #:source source | |
510 | #:commit commit) | |
59fb5c1c | 511 | (tarball-jobs store system) |
3046e73b | 512 | (cross-jobs store system)))) |
59fb5c1c LC |
513 | ((core) |
514 | ;; Build core packages only. | |
515 | (append (map (lambda (package) | |
516 | (package-job store (job-name package) | |
517 | package system)) | |
518 | %core-packages) | |
3046e73b | 519 | (cross-jobs store system))) |
59fb5c1c LC |
520 | ((hello) |
521 | ;; Build hello package only. | |
db2785cd JN |
522 | (let ((hello (specification->package "hello"))) |
523 | (list (package-job store (job-name hello) hello system)))) | |
59fb5c1c LC |
524 | ((list) |
525 | ;; Build selected list of packages only. | |
db2785cd JN |
526 | (let* ((names (assoc-ref arguments 'subset)) |
527 | (packages (map specification->package names))) | |
528 | (map (lambda (package) | |
529 | (package-job store (job-name package) | |
530 | package system)) | |
531 | packages))) | |
59fb5c1c LC |
532 | ((manifests) |
533 | ;; Build packages in the list of manifests. | |
534 | (let* ((manifests (arguments->manifests arguments)) | |
535 | (packages (manifests->packages store manifests))) | |
536 | (map (lambda (package) | |
537 | (package-job store (job-name package) | |
538 | package system)) | |
539 | packages))) | |
540 | (else | |
541 | (error "unknown subset" subset)))) | |
542 | systems))) |