aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-11-09 20:47:38 +0000
committerChristopher Baines <mail@cbaines.net>2019-11-09 20:47:38 +0000
commit41afcef9a6d34687d80099659b284bbebd5ec2ef (patch)
treeb2c91823fd4d33cd5135d0f4b684ed02516acb31 /guix-data-service
parent7b3bc5bcfa1fd92e97712d54cce3c9c4f93da043 (diff)
downloaddata-service-41afcef9a6d34687d80099659b284bbebd5ec2ef.tar
data-service-41afcef9a6d34687d80099659b284bbebd5ec2ef.tar.gz
Add a function to select derivation sources
Diffstat (limited to 'guix-data-service')
-rw-r--r--guix-data-service/model/derivation.scm15
1 files changed, 15 insertions, 0 deletions
diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm
index 4b79682..8614491 100644
--- a/guix-data-service/model/derivation.scm
+++ b/guix-data-service/model/derivation.scm
@@ -13,6 +13,7 @@
count-derivations
select-derivation-by-file-name
select-derivation-outputs-by-derivation-id
+ select-derivation-sources-by-derivation-id
select-derivation-by-output-filename
select-derivations-using-output
select-derivations-by-revision-name-and-version
@@ -270,6 +271,20 @@ ORDER BY derivations.file_name"))
(exec-query conn query (list (number->string id))))
+(define (select-derivation-sources-by-derivation-id conn id)
+ (define query
+ (string-append
+ "
+SELECT derivation_source_files.store_path
+FROM derivation_source_files
+INNER JOIN derivation_sources
+ ON derivation_source_files.id = derivation_sources.derivation_source_file_id
+WHERE derivation_sources.derivation_id = $1
+ORDER BY 1"))
+
+ (map first
+ (exec-query conn query (list (number->string id)))))
+
(define (insert-derivation-inputs conn derivation-id derivation-inputs)
(define (insert-into-derivation-inputs output-ids)
(string-append "INSERT INTO derivation_inputs "