diff options
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 14 | ||||
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 31 |
2 files changed, 41 insertions, 4 deletions
diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 0a2aef4..2b7a916 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -248,7 +248,8 @@ (if (eq? key 'tag) (match (string-split value #\:) ((tag-key tag-value) - (cons tag-key tag-value))) + (cons tag-key tag-value)) + ((tag-key) tag-key)) #f))) query-parameters) #:not-tags @@ -257,7 +258,8 @@ (if (eq? key 'not_tag) (match (string-split value #\:) ((tag-key tag-value) - (cons tag-key tag-value))) + (cons tag-key tag-value)) + ((tag_key) tag_key)) #f))) query-parameters) #:processed @@ -464,13 +466,17 @@ '() (map (match-lambda ((key . value) - (simple-format #f "tag=~A:~A" key value))) + (simple-format #f "tag=~A:~A" key value)) + (key + (simple-format #f "tag=~A" key))) tags)) ,@(if (null? not-tags) '() (map (match-lambda ((key . value) - (simple-format #f "not_tag=~A:~A" key value))) + (simple-format #f "not_tag=~A:~A" key value)) + (key + (simple-format #f "not_tag=~A" key))) not-tags)) ,@(if (boolean? processed) (if processed diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index a20f6ed..bc3dd58 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -1201,6 +1201,12 @@ WHERE uuid = :uuid" db " SELECT id FROM tags WHERE key = :key AND value = :value" + #:cache? #t)) + (key-statement + (sqlite-prepare + db + " +SELECT id FROM tags WHERE key = :key" #:cache? #t))) (lambda (tag not?) (match tag @@ -1220,6 +1226,31 @@ SELECT id FROM tags WHERE key = :key AND value = :value" (#f #f)))) (sqlite-reset statement) + result)) + (key + (sqlite-bind-arguments key-statement + #:key key) + + (let* ((tag-ids (sqlite-map + (match-lambda + (#(id) id)) + key-statement)) + (result + (string-append + "(" + (string-join + (map (lambda (id) + (simple-format + #f "tag_string ~A '%,~A,%'" + (if not? + "NOT LIKE" + "LIKE") + id)) + tag-ids) + (if not? " AND " " OR ")) + ")"))) + (sqlite-reset key-statement) + result)))))) (let ((tag-expressions |