guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/02: Improve latest processed revision pages for reproducibility stuff


From: Christopher Baines
Subject: 02/02: Improve latest processed revision pages for reproducibility stuff
Date: Sun, 11 Oct 2020 12:06:43 -0400 (EDT)

cbaines pushed a commit to branch master
in repository data-service.

commit d05a7397fb3b4fc18cd5fc992183252d6b154e8a
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sun Oct 11 17:05:38 2020 +0100

    Improve latest processed revision pages for reproducibility stuff
    
    Support the package-derivation-outputs page, and switch the
    package-reproducibility page across to use it.
---
 guix-data-service/web/repository/controller.scm | 59 +++++++++++++++++++++++--
 guix-data-service/web/revision/controller.scm   | 15 ++++++-
 guix-data-service/web/revision/html.scm         | 13 ++++--
 3 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/guix-data-service/web/repository/controller.scm 
b/guix-data-service/web/repository/controller.scm
index d72639d..8e8c1bb 100644
--- a/guix-data-service/web/repository/controller.scm
+++ b/guix-data-service/web/repository/controller.scm
@@ -292,6 +292,50 @@
            (render-no-latest-revision mime-types
                                       repository-id
                                       branch-name))))
+    (('GET "repository" repository-id "branch" branch-name 
"latest-processed-revision" "package-derivation-outputs")
+     (letpar& ((commit-hash
+                (with-thread-postgresql-connection
+                 (lambda (conn)
+                   (latest-processed-commit-for-branch conn
+                                                       repository-id
+                                                       branch-name)))))
+       (if commit-hash
+           (let ((parsed-query-parameters
+                  (guard-against-mutually-exclusive-query-parameters
+                   (parse-query-parameters
+                    request
+                    `((search_query ,identity)
+                      (after_path ,identity)
+                      (substitutes_available_from ,parse-number
+                                                  #:multi-value)
+                      (substitutes_not_available_from ,parse-number
+                                                      #:multi-value)
+                      (output_consistency ,identity
+                                          #:default "any")
+                      (system ,parse-system #:default "x86_64-linux")
+                      (target ,parse-target)
+                      (limit_results  ,parse-result-limit
+                                      #:no-default-when (all_results)
+                                      #:default 10)
+                      (all_results    ,parse-checkbox-value)))
+                   '((limit_results all_results)))))
+
+             (render-revision-package-derivation-outputs
+              mime-types
+              commit-hash
+              parsed-query-parameters
+              #:path-base path
+              #:header-text
+              `("Latest processed revision for branch "
+                (samp ,branch-name))
+              #:header-link
+              (string-append
+               "/repository/" repository-id
+               "/branch/" branch-name
+               "/latest-processed-revision")))
+           (render-no-latest-revision mime-types
+                                      repository-id
+                                      branch-name))))
     (('GET "repository" repository-id "branch" branch-name 
"latest-processed-revision" "package-reproducibility")
      (letpar& ((commit-hash
                 (with-thread-postgresql-connection
@@ -300,9 +344,18 @@
                                                        repository-id
                                                        branch-name)))))
        (if commit-hash
-           (render-revision-package-reproduciblity mime-types
-                                                   commit-hash
-                                                   #:path-base path)
+           (render-revision-package-reproduciblity
+            mime-types
+            commit-hash
+            #:path-base path
+            #:header-text
+            `("Latest processed revision for branch "
+              (samp ,branch-name))
+            #:header-link
+            (string-append
+             "/repository/" repository-id
+             "/branch/" branch-name
+             "/latest-processed-revision"))
            (render-no-latest-revision mime-types
                                       repository-id
                                       branch-name))))
diff --git a/guix-data-service/web/revision/controller.scm 
b/guix-data-service/web/revision/controller.scm
index f6fef86..a67c2df 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -58,6 +58,7 @@
             render-revision-package-reproduciblity
             render-revision-package-substitute-availability
             render-revision-package-derivations
+            render-revision-package-derivation-outputs
             render-unknown-revision
             render-view-revision))
 
@@ -560,7 +561,14 @@
 
 (define* (render-revision-package-reproduciblity mime-types
                                                  commit-hash
-                                                 #:key path-base)
+                                                 #:key
+                                                 (path-base "/revision/")
+                                                 (header-text
+                                                  `("Revision "
+                                                    (samp ,commit-hash)))
+                                                 (header-link
+                                                  (string-append "/revision/"
+                                                                 commit-hash)))
   (letpar& ((output-consistency
              (with-thread-postgresql-connection
               (lambda (conn)
@@ -575,7 +583,10 @@
        (render-html
         #:sxml (view-revision-package-reproducibility
                 commit-hash
-                output-consistency))))))
+                output-consistency
+                #:path-base path-base
+                #:header-text header-text
+                #:header-link header-link))))))
 
 (define (render-revision-news mime-types
                               commit-hash
diff --git a/guix-data-service/web/revision/html.scm 
b/guix-data-service/web/revision/html.scm
index bb0e72c..571f6f6 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -1248,7 +1248,10 @@ figure {
          substitute-availability)))))
 
 (define* (view-revision-package-reproducibility revision-commit-hash
-                                                output-consistency)
+                                                output-consistency
+                                                #:key (path-base "/revision/")
+                                                header-text
+                                                header-link)
   (layout
    #:body
    `(,(header)
@@ -1320,8 +1323,8 @@ figure {
        (div
         (@ (class "col-sm-12"))
         (h3 (a (@ (style "white-space: nowrap;")
-                  (href ,(string-append "/revision/" revision-commit-hash)))
-               "Revision " (samp ,revision-commit-hash)))
+                  (href ,header-link))
+               ,@header-text))
         (h1 "Package reproducibility")))
       (div
        (@ (class "row"))
@@ -1470,7 +1473,9 @@ figure {
                                                            colour ";"))))
                               (a (@ (href
                                      ,(string-append
-                                       "/revision/" revision-commit-hash
+                                       (string-join
+                                        (drop-right (string-split path-base 
#\/) 1)
+                                        "/")
                                        "/package-derivation-outputs?"
                                        "output_consistency=" key
                                        "&system=" system)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]