Make update-derivation-ids-hash-table! more flexible
To work with both derivations and names.
This commit is contained in:
parent
3150f50672
commit
d60a8a44cb
1 changed files with 16 additions and 20 deletions
|
|
@ -996,20 +996,25 @@
|
||||||
|
|
||||||
(define (update-derivation-ids-hash-table! conn
|
(define (update-derivation-ids-hash-table! conn
|
||||||
derivation-ids-hash-table
|
derivation-ids-hash-table
|
||||||
derivation-file-names)
|
derivations-or-file-names)
|
||||||
(define derivations-count (vector-length derivation-file-names))
|
(define derivations-count (vector-length derivations-or-file-names))
|
||||||
|
|
||||||
(let ((missing-file-names
|
(let ((missing-file-names
|
||||||
(vector-fold
|
(vector-fold
|
||||||
(lambda (_ result file-name)
|
(lambda (_ result file-name-or-drv)
|
||||||
(if (and file-name
|
(if file-name-or-drv
|
||||||
(hash-ref derivation-ids-hash-table
|
(let ((file-name
|
||||||
file-name))
|
(if (string? file-name-or-drv)
|
||||||
result
|
file-name-or-drv
|
||||||
(cons file-name
|
(derivation-file-name file-name-or-drv))))
|
||||||
result)))
|
(if (hash-ref derivation-ids-hash-table
|
||||||
|
file-name)
|
||||||
|
result
|
||||||
|
(cons file-name
|
||||||
|
result)))
|
||||||
|
result))
|
||||||
'()
|
'()
|
||||||
derivation-file-names)))
|
derivations-or-file-names)))
|
||||||
|
|
||||||
(simple-format
|
(simple-format
|
||||||
#t "debug: update-derivation-ids-hash-table!: lookup ~A file-names, ~A not cached\n"
|
#t "debug: update-derivation-ids-hash-table!: lookup ~A file-names, ~A not cached\n"
|
||||||
|
|
@ -1149,16 +1154,7 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
||||||
(update-derivation-ids-hash-table!
|
(update-derivation-ids-hash-table!
|
||||||
conn
|
conn
|
||||||
derivation-ids-hash-table
|
derivation-ids-hash-table
|
||||||
(let ((file-names-vector
|
(list->vector unfiltered-derivations))
|
||||||
(make-vector (length unfiltered-derivations))))
|
|
||||||
(for-each
|
|
||||||
(lambda (i drv)
|
|
||||||
(vector-set! file-names-vector
|
|
||||||
i
|
|
||||||
(derivation-file-name drv)))
|
|
||||||
(iota (vector-length file-names-vector))
|
|
||||||
unfiltered-derivations)
|
|
||||||
file-names-vector))
|
|
||||||
|
|
||||||
(let ((derivations
|
(let ((derivations
|
||||||
;; Do this while holding the PostgreSQL connection to
|
;; Do this while holding the PostgreSQL connection to
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue