aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web/repository/controller.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-11-09 20:07:34 +0000
committerChristopher Baines <mail@cbaines.net>2019-11-09 20:07:34 +0000
commit04bb2d52bc28c02648974c3ee92dbbacb00a1e52 (patch)
tree8636ac3265eef56f7877cd3fac955be5a90f8551 /guix-data-service/web/repository/controller.scm
parent1442d17a3ddefdb18dcd8689bcf3dba903f11b8d (diff)
downloaddata-service-04bb2d52bc28c02648974c3ee92dbbacb00a1e52.tar
data-service-04bb2d52bc28c02648974c3ee92dbbacb00a1e52.tar.gz
Add first version of a page with the history of package derivations
Some filtering options need adding for the system and target, as it's currently hardcoded, but the general page does work.
Diffstat (limited to 'guix-data-service/web/repository/controller.scm')
-rw-r--r--guix-data-service/web/repository/controller.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/guix-data-service/web/repository/controller.scm b/guix-data-service/web/repository/controller.scm
index 23e3559..cdc89d6 100644
--- a/guix-data-service/web/repository/controller.scm
+++ b/guix-data-service/web/repository/controller.scm
@@ -111,6 +111,42 @@
branch-name
package-name
package-versions))))))
+ (('GET "repository" repository-id "branch" branch-name "package" package-name "derivation-history")
+ (let ((package-derivations
+ (package-derivations-for-branch conn
+ (string->number repository-id)
+ branch-name
+ "x86_64-linux"
+ "x86_64-linux"
+ package-name)))
+ (case (most-appropriate-mime-type
+ '(application/json text/html)
+ mime-types)
+ ((application/json)
+ (render-json
+ `((versions . ,(list->vector
+ (map (match-lambda
+ ((package-version derivation-file-name
+ first-guix-revision-commit
+ first-datetime
+ last-guix-revision-commit
+ last-datetime)
+ `((version . ,package-version)
+ (derivation . ,derivation-file-name)
+ (first_revision
+ . ((commit . ,first-guix-revision-commit)
+ (datetime . ,first-datetime)))
+ (last_revision
+ . ((commit . ,last-guix-revision-commit)
+ (datetime . ,last-datetime))))))
+ package-versions))))))
+ (else
+ (render-html
+ #:sxml (view-branch-package-derivations
+ repository-id
+ branch-name
+ package-name
+ package-derivations))))))
(('GET "repository" repository-id "branch" branch-name "latest-processed-revision")
(let ((commit-hash
(latest-processed-commit-for-branch conn repository-id branch-name)))