| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 |
|
| 19 | |
| 20 | |
| 21 | |
| 22 |
|
| 23 | (use-modules (guix store)
|
| 24 | (guix grafts)
|
| 25 | (guix packages)
|
| 26 | (guix derivations)
|
| 27 | (guix ui)
|
| 28 | (gnu packages commencement)
|
| 29 | (ice-9 match)
|
| 30 | (srfi srfi-1)
|
| 31 | (srfi srfi-26))
|
| 32 |
|
| 33 | (define (final-inputs store system)
|
| 34 | "Return the list of outputs directories of the final inputs for SYSTEM."
|
| 35 | (append-map (match-lambda
|
| 36 | ((or (name package) (name package _))
|
| 37 | (let ((drv (package-derivation store package system)))
|
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | (filter-map (match-lambda
|
| 43 | (("debug" . directory)
|
| 44 | (if (string=? "glibc" (package-name package))
|
| 45 | #f
|
| 46 | directory))
|
| 47 | (("include" . directory)
|
| 48 | (if (string=? "bash" (package-name package))
|
| 49 | #f
|
| 50 | directory))
|
| 51 | ((_ . directory) directory))
|
| 52 | (derivation->output-paths drv)))))
|
| 53 | (%final-inputs system)))
|
| 54 |
|
| 55 | (define (assert-valid-substitute substitute)
|
| 56 | "Make sure SUBSTITUTE does not refer to any bootstrap inputs, and bail out
|
| 57 | if it does."
|
| 58 | (let ((references (substitutable-references substitute)))
|
| 59 | (when (any (cut string-contains <> "boot") references)
|
| 60 | (leave (G_ "'~a' refers to bootstrap inputs: ~s~%")
|
| 61 | (substitutable-path substitute) references))))
|
| 62 |
|
| 63 | (define (test-final-inputs store system)
|
| 64 | "Check whether the final inputs for SYSTEM are clean---i.e., they don't
|
| 65 | refer to the bootstrap tools."
|
| 66 | (format #t "checking final inputs for '~a'...~%" system)
|
| 67 | (let* ((inputs (final-inputs store system))
|
| 68 | (available (substitutable-path-info store inputs)))
|
| 69 | (for-each (lambda (dir)
|
| 70 | (unless (find (lambda (substitute)
|
| 71 | (string=? (substitutable-path substitute)
|
| 72 | dir))
|
| 73 | available)
|
| 74 | (leave (G_ "~a (system: ~a) has no substitute~%")
|
| 75 | dir system)))
|
| 76 | inputs)
|
| 77 |
|
| 78 | (for-each assert-valid-substitute available)))
|
| 79 |
|
| 80 | |
| 81 | (with-store store
|
| 82 | (parameterize ((%graft? #f))
|
| 83 | (set-build-options store #:use-substitutes? #t)
|
| 84 |
|
| 85 | (for-each (cut test-final-inputs store <>)
|
| 86 | %cuirass-supported-systems)))
|