Initial commit
This is a service designed to provide information about Guix. At the moment, this initial prototype gathers up information about packages, the associated metadata and derivations. The initial primary use case is to compare two different revisions of Guix, detecting which packages are new, no longer present, updated or otherwise different. It's based on the Mumi project. [1]: https://git.elephly.net/software/mumi.git
This commit is contained in:
commit
5a9262b38d
32 changed files with 9457 additions and 0 deletions
39
guix-data-service/model/guix-revision.scm
Normal file
39
guix-data-service/model/guix-revision.scm
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
(define-module (guix-data-service model guix-revision)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (squee)
|
||||
#:export (most-recent-n-guix-revisions
|
||||
commit->revision-id
|
||||
insert-guix-revision
|
||||
guix-revision-exists?))
|
||||
|
||||
(define (most-recent-n-guix-revisions conn n)
|
||||
(exec-query conn "SELECT * FROM guix_revisions ORDER BY id DESC LIMIT 10"))
|
||||
|
||||
(define (commit->revision-id conn commit)
|
||||
(match (exec-query
|
||||
conn "SELECT id FROM guix_revisions WHERE commit = $1 LIMIT 1"
|
||||
(list commit))
|
||||
(((id))
|
||||
id)))
|
||||
|
||||
(define (insert-guix-revision conn url commit store_path)
|
||||
(define insert
|
||||
(string-append "INSERT INTO guix_revisions "
|
||||
"(url, commit, store_path) VALUES "
|
||||
"('" url "', '"
|
||||
commit "', '"
|
||||
store_path "') "
|
||||
"RETURNING id;"))
|
||||
|
||||
(map car (exec-query conn insert)))
|
||||
|
||||
(define (guix-revision-exists? conn url commit)
|
||||
(define query
|
||||
(string-append "SELECT EXISTS("
|
||||
"SELECT 1 FROM guix_revisions WHERE url = '" url "' "
|
||||
"AND commit = '" commit "')"
|
||||
";"))
|
||||
|
||||
(let ((result (caar
|
||||
(exec-query conn query))))
|
||||
(string=? result "t")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue