Support querying package derivation outputs without the nars
Since this speeds up the response if you don't need the nar information.
This commit is contained in:
parent
11ec8a8064
commit
f1418c4e88
5 changed files with 62 additions and 6 deletions
|
|
@ -678,6 +678,7 @@ LIMIT $4"))
|
||||||
no-nars-from-build-servers
|
no-nars-from-build-servers
|
||||||
system
|
system
|
||||||
target
|
target
|
||||||
|
include-nars?
|
||||||
limit-results
|
limit-results
|
||||||
after-path)
|
after-path)
|
||||||
(define query
|
(define query
|
||||||
|
|
@ -688,7 +689,10 @@ SELECT packages.name,
|
||||||
derivation_output_details.path,
|
derivation_output_details.path,
|
||||||
derivation_output_details.hash_algorithm,
|
derivation_output_details.hash_algorithm,
|
||||||
derivation_output_details.hash,
|
derivation_output_details.hash,
|
||||||
derivation_output_details.recursive,
|
derivation_output_details.recursive"
|
||||||
|
|
||||||
|
(if include-nars?
|
||||||
|
",
|
||||||
(
|
(
|
||||||
SELECT JSON_AGG(
|
SELECT JSON_AGG(
|
||||||
json_build_object(
|
json_build_object(
|
||||||
|
|
@ -706,7 +710,9 @@ SELECT packages.name,
|
||||||
INNER JOIN narinfo_fetch_records
|
INNER JOIN narinfo_fetch_records
|
||||||
ON narinfo_signature_data.id = narinfo_fetch_records.narinfo_signature_data_id
|
ON narinfo_signature_data.id = narinfo_fetch_records.narinfo_signature_data_id
|
||||||
WHERE nars.store_path = derivation_output_details.path
|
WHERE nars.store_path = derivation_output_details.path
|
||||||
) AS nars
|
) AS nars"
|
||||||
|
"")
|
||||||
|
"
|
||||||
FROM derivations
|
FROM derivations
|
||||||
INNER JOIN derivation_outputs
|
INNER JOIN derivation_outputs
|
||||||
ON derivations.id = derivation_outputs.derivation_id
|
ON derivations.id = derivation_outputs.derivation_id
|
||||||
|
|
@ -833,7 +839,15 @@ ORDER BY derivation_output_details.path
|
||||||
(string=? recursive "t")
|
(string=? recursive "t")
|
||||||
(if (null? nars_json)
|
(if (null? nars_json)
|
||||||
#()
|
#()
|
||||||
(json-string->scm nars_json)))))
|
(json-string->scm nars_json))))
|
||||||
|
((package_name package_version
|
||||||
|
path hash_algorithm hash recursive)
|
||||||
|
(list package_name
|
||||||
|
package_version
|
||||||
|
path
|
||||||
|
hash
|
||||||
|
hash_algorithm
|
||||||
|
(string=? recursive "t"))))
|
||||||
(exec-query-with-null-handling conn
|
(exec-query-with-null-handling conn
|
||||||
query
|
query
|
||||||
`(,commit-hash
|
`(,commit-hash
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,8 @@
|
||||||
#:default "any")
|
#:default "any")
|
||||||
(system ,parse-system #:default "x86_64-linux")
|
(system ,parse-system #:default "x86_64-linux")
|
||||||
(target ,parse-target #:default "")
|
(target ,parse-target #:default "")
|
||||||
|
(field ,identity #:multi-value
|
||||||
|
#:default ("nars"))
|
||||||
(limit_results ,parse-result-limit
|
(limit_results ,parse-result-limit
|
||||||
#:no-default-when (all_results)
|
#:no-default-when (all_results)
|
||||||
#:default 10)
|
#:default 10)
|
||||||
|
|
|
||||||
|
|
@ -267,6 +267,8 @@
|
||||||
#:default "any")
|
#:default "any")
|
||||||
(system ,parse-system #:default "x86_64-linux")
|
(system ,parse-system #:default "x86_64-linux")
|
||||||
(target ,parse-target #:default "")
|
(target ,parse-target #:default "")
|
||||||
|
(field ,identity #:multi-value
|
||||||
|
#:default ("nars"))
|
||||||
(limit_results ,parse-result-limit
|
(limit_results ,parse-result-limit
|
||||||
#:no-default-when (all_results)
|
#:no-default-when (all_results)
|
||||||
#:default 10)
|
#:default 10)
|
||||||
|
|
@ -1253,7 +1255,9 @@
|
||||||
(let ((limit-results
|
(let ((limit-results
|
||||||
(assq-ref query-parameters 'limit_results))
|
(assq-ref query-parameters 'limit_results))
|
||||||
(all-results
|
(all-results
|
||||||
(assq-ref query-parameters 'all_results)))
|
(assq-ref query-parameters 'all_results))
|
||||||
|
(fields
|
||||||
|
(assq-ref query-parameters 'field)))
|
||||||
(letpar&
|
(letpar&
|
||||||
((derivation-outputs
|
((derivation-outputs
|
||||||
(with-thread-postgresql-connection
|
(with-thread-postgresql-connection
|
||||||
|
|
@ -1270,6 +1274,7 @@
|
||||||
(assq-ref query-parameters 'output_consistency)
|
(assq-ref query-parameters 'output_consistency)
|
||||||
#:system (assq-ref query-parameters 'system)
|
#:system (assq-ref query-parameters 'system)
|
||||||
#:target (assq-ref query-parameters 'target)
|
#:target (assq-ref query-parameters 'target)
|
||||||
|
#:include-nars? (member "nars" fields)
|
||||||
#:limit-results limit-results
|
#:limit-results limit-results
|
||||||
#:after-path (assq-ref query-parameters 'after_path))))))
|
#:after-path (assq-ref query-parameters 'after_path))))))
|
||||||
(let ((show-next-page?
|
(let ((show-next-page?
|
||||||
|
|
@ -1286,6 +1291,11 @@
|
||||||
(store_paths
|
(store_paths
|
||||||
. ,(list->vector
|
. ,(list->vector
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
|
((package-name package-version
|
||||||
|
path hash-algorithm hash recursive)
|
||||||
|
`((package . ((name . ,package-name)
|
||||||
|
(version . ,package-version)))
|
||||||
|
(path . ,path)))
|
||||||
((package-name package-version
|
((package-name package-version
|
||||||
path hash-algorithm hash recursive
|
path hash-algorithm hash recursive
|
||||||
nars)
|
nars)
|
||||||
|
|
|
||||||
|
|
@ -1876,6 +1876,15 @@ figure {
|
||||||
(cons url id)))
|
(cons url id)))
|
||||||
build-server-urls))
|
build-server-urls))
|
||||||
|
|
||||||
|
(define field-options
|
||||||
|
(map
|
||||||
|
(lambda (field)
|
||||||
|
(cons field
|
||||||
|
(hyphenate-words
|
||||||
|
(remove-brackets
|
||||||
|
(string-downcase field)))))
|
||||||
|
'("(no additional fields)" "Nars")))
|
||||||
|
|
||||||
(layout
|
(layout
|
||||||
#:title
|
#:title
|
||||||
(string-append "Package derivation outputs - Revision "
|
(string-append "Package derivation outputs - Revision "
|
||||||
|
|
@ -1937,6 +1946,11 @@ figure {
|
||||||
#:allow-selecting-multiple-options #f
|
#:allow-selecting-multiple-options #f
|
||||||
#:help-text "Only include outputs from derivations that are build for this system."
|
#:help-text "Only include outputs from derivations that are build for this system."
|
||||||
#:font-family "monospace")
|
#:font-family "monospace")
|
||||||
|
,(form-horizontal-control
|
||||||
|
"Fields" query-parameters
|
||||||
|
#:name "field"
|
||||||
|
#:options field-options
|
||||||
|
#:help-text "Fields to return in the response.")
|
||||||
,(form-horizontal-control
|
,(form-horizontal-control
|
||||||
"After path" query-parameters
|
"After path" query-parameters
|
||||||
#:help-text
|
#:help-text
|
||||||
|
|
@ -1977,11 +1991,18 @@ figure {
|
||||||
(thead
|
(thead
|
||||||
(tr
|
(tr
|
||||||
(th (@ (class "col-sm-5")) "Path")
|
(th (@ (class "col-sm-5")) "Path")
|
||||||
(th (@ (class "col-sm-5")) "Data")
|
,@(if (member "nars" (assq-ref query-parameters 'field))
|
||||||
(th (@ (class "col-sm-2")) "Output consistency")))
|
'((th (@ (class "col-sm-5")) "Data")
|
||||||
|
(th (@ (class "col-sm-2")) "Output consistency"))
|
||||||
|
'())))
|
||||||
(tbody
|
(tbody
|
||||||
,@(map
|
,@(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
|
((package-name package-version
|
||||||
|
path hash-algorithm hash recursive)
|
||||||
|
`(tr
|
||||||
|
(td (a (@ (href ,path))
|
||||||
|
,(display-store-item-short path)))))
|
||||||
((package-name package-version
|
((package-name package-version
|
||||||
path hash-algorithm hash recursive nars)
|
path hash-algorithm hash recursive nars)
|
||||||
`(tr
|
`(tr
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
directory?
|
directory?
|
||||||
|
|
||||||
hyphenate-words
|
hyphenate-words
|
||||||
|
remove-brackets
|
||||||
underscore-join-words))
|
underscore-join-words))
|
||||||
|
|
||||||
(define (most-appropriate-mime-type accepted-mime-types
|
(define (most-appropriate-mime-type accepted-mime-types
|
||||||
|
|
@ -99,6 +100,14 @@
|
||||||
(string-split words #\space)
|
(string-split words #\space)
|
||||||
"-"))
|
"-"))
|
||||||
|
|
||||||
|
(define (remove-brackets s)
|
||||||
|
(string-filter
|
||||||
|
(lambda (c)
|
||||||
|
(not
|
||||||
|
(or (eq? #\( c)
|
||||||
|
(eq? #\) c))))
|
||||||
|
s))
|
||||||
|
|
||||||
(define (underscore-join-words words)
|
(define (underscore-join-words words)
|
||||||
(string-join
|
(string-join
|
||||||
(string-split words #\space)
|
(string-split words #\space)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue