aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-12-30 12:32:20 +0000
committerChristopher Baines <mail@cbaines.net>2019-12-30 12:32:20 +0000
commit2cb5309851b3868dcdb0e88145d676b474c575aa (patch)
tree274c9ac598f8a561d630ee4ebc1b5d05fa4ecb8b /guix-data-service/model
parent7881eec3152b19de1850c3ef54236f75ae5ed015 (diff)
downloaddata-service-2cb5309851b3868dcdb0e88145d676b474c575aa.tar
data-service-2cb5309851b3868dcdb0e88145d676b474c575aa.tar.gz
Display details for the derivation source files
If the nar file is available.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/derivation.scm21
1 files changed, 21 insertions, 0 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index 2122121..8a9e88c 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -41,6 +41,7 @@
select-derivation-sources-by-derivation-id
select-derivation-references-by-derivation-id
select-derivation-source-file-by-store-path
+ select-derivation-source-file-nar-details-by-file-name
select-derivation-source-file-nar-data-by-file-name
select-derivation-source-file-data-by-file-name-hash
select-derivation-by-output-filename
@@ -831,6 +832,26 @@ WHERE substring(derivation_source_files.store_path from 12 for 32) = $1"
(string->number uncompressed_size)))
(() #f)))
+(define (select-derivation-source-file-nar-details-by-file-name conn file-name)
+ (match (exec-query
+ conn
+ "
+SELECT compression, hash_algorithm, hash,
+ uncompressed_size, length(data) AS compressed_size
+FROM derivation_source_file_nars
+INNER JOIN derivation_source_files
+ ON derivation_source_file_nars.derivation_source_file_id =
+ derivation_source_files.id
+WHERE derivation_source_files.store_path = $1"
+ (list file-name))
+ (((compression hash_algorithm hash uncompressed_size compressed_size))
+ `((compression . ,compression)
+ (hash_algorithm . ,hash_algorithm)
+ (hash . ,hash)
+ (uncompressed_size . ,(string->number uncompressed_size))
+ (compressed_size . ,(string->number compressed_size))))
+ (() #f)))
+
(define (select-derivation-source-file-nar-data-by-file-name conn file-name)
(match (exec-query
conn