Add a function to fetch a derivation by file name hash
This commit is contained in:
parent
b504094262
commit
e3d8a23716
1 changed files with 23 additions and 0 deletions
|
|
@ -14,6 +14,7 @@
|
||||||
#:export (valid-systems
|
#:export (valid-systems
|
||||||
count-derivations
|
count-derivations
|
||||||
select-derivation-by-file-name
|
select-derivation-by-file-name
|
||||||
|
select-derivation-by-file-name-hash
|
||||||
select-derivation-outputs-by-derivation-id
|
select-derivation-outputs-by-derivation-id
|
||||||
select-derivation-sources-by-derivation-id
|
select-derivation-sources-by-derivation-id
|
||||||
select-derivation-source-file-by-store-path
|
select-derivation-source-file-by-store-path
|
||||||
|
|
@ -588,6 +589,28 @@ VALUES ($1, $2)"
|
||||||
|
|
||||||
derivation-output-details-ids))
|
derivation-output-details-ids))
|
||||||
|
|
||||||
|
(define (select-derivation-by-file-name-hash conn file-name-hash)
|
||||||
|
(define query
|
||||||
|
(string-append
|
||||||
|
"SELECT id, file_name, builder, args, to_json(env_vars), system "
|
||||||
|
"FROM derivations "
|
||||||
|
"WHERE substring(file_name from 12 for 32) = $1"))
|
||||||
|
|
||||||
|
(match (exec-query conn query (list file-name-hash))
|
||||||
|
(()
|
||||||
|
#f)
|
||||||
|
(((id file_name builder args env_vars system))
|
||||||
|
(list (string->number id)
|
||||||
|
file_name
|
||||||
|
builder
|
||||||
|
(parse-postgresql-array-string args)
|
||||||
|
(map (match-lambda
|
||||||
|
(#(key value)
|
||||||
|
`((key . ,key)
|
||||||
|
(value . ,value))))
|
||||||
|
(vector->list (json-string->scm env_vars)))
|
||||||
|
system))))
|
||||||
|
|
||||||
(define (select-derivation-by-file-name conn file-name)
|
(define (select-derivation-by-file-name conn file-name)
|
||||||
(define query
|
(define query
|
||||||
(string-append
|
(string-append
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue