aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-09-04 21:18:22 +0100
committerChristopher Baines <mail@cbaines.net>2023-09-04 21:18:22 +0100
commitc6e4a686bdbf386d81f45cb7021c516a526a4054 (patch)
tree5e42f1527c74987b4eb8d01d4b93caa3b4807d29
parent4f3e9eb34384b1b2ea3dc6f2b74e49af4a88f966 (diff)
downloadqa-frontpage-c6e4a686bdbf386d81f45cb7021c516a526a4054.tar
qa-frontpage-c6e4a686bdbf386d81f45cb7021c516a526a4054.tar.gz
Display the README as a page
Like the data service.
-rw-r--r--guix-qa-frontpage/server.scm15
-rw-r--r--guix-qa-frontpage/view/home.scm10
-rw-r--r--scripts/guix-qa-frontpage.in12
3 files changed, 34 insertions, 3 deletions
diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm
index b9a814e..affaa4d 100644
--- a/guix-qa-frontpage/server.scm
+++ b/guix-qa-frontpage/server.scm
@@ -20,6 +20,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-71)
+ #:use-module (ice-9 textual-ports)
#:use-module (ice-9 threads)
#:use-module (ice-9 match)
#:use-module (web http)
@@ -73,7 +74,8 @@
branches)))
(define* (make-controller assets-directory database metrics-registry
- #:key (patch-issues-to-show 200))
+ #:key (patch-issues-to-show 200)
+ doc-dir)
(define handle-static-assets
(if (string-prefix? (%store-prefix)
@@ -490,6 +492,17 @@ has no patches or has been closed.")
(uri-query (request-uri request))
parse-query-string)
'())))))
+ (('GET "README")
+ (let ((filename (string-append doc-dir "/README.html")))
+ (if (file-exists? filename)
+ (render-html
+ #:sxml (readme (call-with-input-file filename
+ get-string-all)))
+ (render-html
+ #:sxml (general-not-found
+ "README not found"
+ "The README.html file does not exist")
+ #:code 404))))
((method path ...)
(render-html
#:sxml (general-not-found
diff --git a/guix-qa-frontpage/view/home.scm b/guix-qa-frontpage/view/home.scm
index b7d74d8..c5428b1 100644
--- a/guix-qa-frontpage/view/home.scm
+++ b/guix-qa-frontpage/view/home.scm
@@ -2,7 +2,8 @@
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:use-module (guix-qa-frontpage view util)
- #:export (home))
+ #:export (home
+ readme))
(define (home branches)
(layout
@@ -59,3 +60,10 @@
(a (@ (href "mailto:guix-devel@gnu.org"))
"guix-devel@gnu.org")
".")))))
+
+(define (readme contents)
+ (layout
+ #:description "Guix Quality Assurance"
+ #:body
+ `((main
+ (raw ,contents)))))
diff --git a/scripts/guix-qa-frontpage.in b/scripts/guix-qa-frontpage.in
index 47c7743..4eeb680 100644
--- a/scripts/guix-qa-frontpage.in
+++ b/scripts/guix-qa-frontpage.in
@@ -45,6 +45,15 @@
(setenv "GC_RETRY_SIGNALS" "0")
(apply execlp (car (command-line)) (command-line))))
+(define doc-dir
+ (let ((install-dir
+ "@prefix@/share/doc/guix-data-service")
+ (dev-dir
+ (getcwd)))
+ (if (file-exists? install-dir)
+ install-dir
+ dev-dir)))
+
(define %options
;; Specifications of the command-line options
(list (option '("listen-repl") #f #t
@@ -267,4 +276,5 @@
(assq-ref opts 'assets-directory)
database
metrics-registry
- #:controller-args `(#:patch-issues-to-show ,patch-issues-to-show)))))))
+ #:controller-args `(#:doc-dir ,doc-dir
+ #:patch-issues-to-show ,patch-issues-to-show)))))))