Add mechanism to fix derivation inputs
Some derivations are missing inputs, I don't know why, but this should allow for manually fixing the affected derivations.
This commit is contained in:
parent
61d49cedb3
commit
8635a5561b
1 changed files with 23 additions and 0 deletions
|
|
@ -55,6 +55,7 @@
|
||||||
select-fixed-output-package-derivations-in-revision
|
select-fixed-output-package-derivations-in-revision
|
||||||
select-derivation-outputs-in-revision
|
select-derivation-outputs-in-revision
|
||||||
fix-derivation-output-details-hash-encoding
|
fix-derivation-output-details-hash-encoding
|
||||||
|
fix-derivation-inputs
|
||||||
insert-derivation-sources
|
insert-derivation-sources
|
||||||
insert-derivation-source-file-nar
|
insert-derivation-source-file-nar
|
||||||
insert-placeholder-derivation-source-file-nar
|
insert-placeholder-derivation-source-file-nar
|
||||||
|
|
@ -974,6 +975,28 @@ LOCK TABLE ONLY derivation_output_details
|
||||||
;; Recurse in case there are more to fix
|
;; Recurse in case there are more to fix
|
||||||
(loop (find-old-derivations-and-hashes conn))))))))
|
(loop (find-old-derivations-and-hashes conn))))))))
|
||||||
|
|
||||||
|
(define (fix-derivation-inputs conn drv)
|
||||||
|
(define (derivation-missing-inputs? conn drv-id)
|
||||||
|
(let ((inputs (select-derivation-inputs-by-derivation-id
|
||||||
|
conn
|
||||||
|
drv-id)))
|
||||||
|
;; TODO Detect missing inputs, as well as them all missing
|
||||||
|
(null? inputs)))
|
||||||
|
|
||||||
|
(with-postgresql-transaction
|
||||||
|
conn
|
||||||
|
(lambda (conn)
|
||||||
|
(match (select-derivation-by-file-name conn (derivation-file-name drv))
|
||||||
|
((drv-id rest ...)
|
||||||
|
(if (derivation-missing-inputs? conn drv-id)
|
||||||
|
(begin
|
||||||
|
(insert-derivation-inputs
|
||||||
|
conn
|
||||||
|
(vector drv-id)
|
||||||
|
(vector drv))
|
||||||
|
#t)
|
||||||
|
#f))))))
|
||||||
|
|
||||||
(define (derivation-output-details->derivation-output-details-ids
|
(define (derivation-output-details->derivation-output-details-ids
|
||||||
conn
|
conn
|
||||||
derivation-output-details)
|
derivation-output-details)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue