diff options
author | Christopher Baines <mail@cbaines.net> | 2019-05-13 21:02:53 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-05-13 21:07:48 +0100 |
commit | 7341d1725420b431160536c1cf2b34a662ff0a86 (patch) | |
tree | f1490bcbf7133a2f5b8e46910138c991a6cf0ef3 /guix-data-service/web | |
parent | 9aaab6b751993d6774ed96b0f8632d8af3d565c7 (diff) | |
download | data-service-7341d1725420b431160536c1cf2b34a662ff0a86.tar data-service-7341d1725420b431160536c1cf2b34a662ff0a86.tar.gz |
Store and display the location of packages
Store the location a package can be found at, and display this on the package
page.
If available, link off to the git repository containing the package.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r-- | guix-data-service/web/controller.scm | 8 | ||||
-rw-r--r-- | guix-data-service/web/view/html.scm | 27 |
2 files changed, 29 insertions, 6 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 584392a..6b4167d 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -176,7 +176,10 @@ conn commit-hash name - version))) + version)) + (git-repositories + (git-repositories-containing-commit conn + commit-hash))) (case (most-appropriate-mime-type '(application/json text/html) mime-types) @@ -202,7 +205,8 @@ name version metadata - derivations)))))) + derivations + git-repositories)))))) (define (render-compare-unknown-commit mime-types conn diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 079b23d..ecc2e83 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -302,7 +302,7 @@ (define (view-revision-package-and-version revision-commit-hash name version package-metadata - derivations) + derivations git-repositories) (layout #:extra-headers '((cache-control . ((max-age . 60)))) @@ -327,7 +327,7 @@ (div (@ (class "col-sm-12")) ,(match package-metadata - (((synopsis description home-page)) + (((synopsis description home-page file line column-number)) `(dl (@ (class "dl-horizontal")) (dt "Synopsis") @@ -335,8 +335,27 @@ (dt "Description") (dd ,(stexi->shtml (texi-fragment->stexi description))) (dt "Home page") - (dd (a (@ (href ,home-page)) - ,home-page))))))) + (dd (a (@ (href ,home-page)) ,home-page)) + ,@(if (and file (not (string-null? file)) + (not (null? git-repositories))) + `((dt "Location") + (dd ,@(map + (match-lambda + ((id label url cgit-url-base) + (if + (and cgit-url-base + (not (string-null? cgit-url-base))) + `(a (@ (href + ,(string-append + cgit-url-base "tree/" + file "?id=" revision-commit-hash + "#n" line))) + ,file + " (line: " ,line + ", column: " ,column-number ")") + '()))) + git-repositories))) + '())))))) (div (@ (class "row")) (div |