Remove extraneous case-lambda comments + other misc docs fixes

This commit is contained in:
puck 2024-10-04 02:37:42 +00:00
parent 26444abf95
commit c0f0024ac9
4 changed files with 22 additions and 21 deletions

View file

@ -23,6 +23,7 @@
zilch-magic-counters)
(begin
;; The daemon connection used by `(zilch magic)`.
(define *daemon*
(make-parameter
(parameterize
@ -33,16 +34,18 @@
(make-daemon-link in-port out-port))))))
(daemon-wop-handshake (*daemon*))
;; If set to `#f`, `store-path-for-ca-drv*` will not generate
;; content-addressed derivations.
(define *use-ca* (make-parameter #t))
;; A vector of counters, counting the amount of derivations made, built, and read
;; A vector of counters, counting the amount of derivations made, built, and IFD'd.
(define zilch-magic-counters (vector 0 0 0))
(define (increment-counter index)
(vector-set! zilch-magic-counters index (+ 1 (vector-ref zilch-magic-counters index))))
;; Represents a reference to an output path of a derivation, or a source file.
;; if output is "", drv is the store path to a source file.
;; if `output` is `""`, `drv` is the store path to a source file.
(define-record-type <store-path>
(make-store-path drv output written)
store-path?
@ -59,11 +62,14 @@
(define (store-path-path path)
(derivation-output-path (cdr (assoc (store-path-output path) (derivation-outputs (store-path-drv path))))))
;; Makes sure the derivation referenced by this store path exists in the daemon.
(define (store-path-materialize path)
(unless (store-path-written path)
(write-drv-to-daemon (store-path-drv path))
(set-store-path-written! path #t)))
;; Returns the output path of this store path; fetching it from the daemon if
;; the derivation is content-addressed.
(define (store-path-realisation path)
(define drv (store-path-drv path))
(define output (store-path-output path))
@ -89,7 +95,7 @@
(daemon-wop-add-text-to-store (*daemon*) (string-append (derivation-name drv) ".drv") (get-output-string out) (derivation-path-references drv))))
(make-store-path path "" #t))
;; Returns a store path representing the text..
;; Returns a store path representing the text.
(define (store-path-for-text name text)
(increment-counter 0)
(define goal-path (make-text-path "sha256" (sha256 text) name '()))
@ -140,6 +146,7 @@
(define drv (make-ca-derivation name platform input-drvs input-srcs (zexp-evaluation-value collected-builder) (zexp-evaluation-value collected-env) outputs))
(map (lambda (l) (cons (car l) (make-store-path drv (car l) #f))) (derivation-outputs drv)))
;; Calls either `store-path-for-ca-drv` or `store-path-for-drv` depending on `*use-ca*`.
(define (store-path-for-ca-drv* name platform builder env outputs)
(if (*use-ca*) (store-path-for-ca-drv name platform builder env outputs)
(store-path-for-drv name platform builder env outputs)))