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
|
||||
derivation-ids-hash-table
|
||||
derivation-file-names)
|
||||
(define derivations-count (vector-length derivation-file-names))
|
||||
derivations-or-file-names)
|
||||
(define derivations-count (vector-length derivations-or-file-names))
|
||||
|
||||
(let ((missing-file-names
|
||||
(vector-fold
|
||||
(lambda (_ result file-name)
|
||||
(if (and file-name
|
||||
(hash-ref derivation-ids-hash-table
|
||||
file-name))
|
||||
result
|
||||
(cons file-name
|
||||
result)))
|
||||
(lambda (_ result file-name-or-drv)
|
||||
(if file-name-or-drv
|
||||
(let ((file-name
|
||||
(if (string? file-name-or-drv)
|
||||
file-name-or-drv
|
||||
(derivation-file-name file-name-or-drv))))
|
||||
(if (hash-ref derivation-ids-hash-table
|
||||
file-name)
|
||||
result
|
||||
(cons file-name
|
||||
result)))
|
||||
result))
|
||||
'()
|
||||
derivation-file-names)))
|
||||
derivations-or-file-names)))
|
||||
|
||||
(simple-format
|
||||
#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!
|
||||
conn
|
||||
derivation-ids-hash-table
|
||||
(let ((file-names-vector
|
||||
(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))
|
||||
(list->vector unfiltered-derivations))
|
||||
|
||||
(let ((derivations
|
||||
;; Do this while holding the PostgreSQL connection to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue