[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: website: Use static links for latest downloads.
From: |
Mathieu Othacehe |
Subject: |
branch master updated: website: Use static links for latest downloads. |
Date: |
Mon, 22 Jun 2020 04:25:44 -0400 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix-artwork.
The following commit(s) were added to refs/heads/master by this push:
new 7fb003d website: Use static links for latest downloads.
7fb003d is described below
commit 7fb003ddb1eb24552ddca744f50895c3271967fb
Author: Mathieu Othacehe <m.othacehe@gmail.com>
AuthorDate: Mon Jun 22 10:19:24 2020 +0200
website: Use static links for latest downloads.
CI build products links are created at build-time, by using Cuirass api.
This
can not work if the website is built as a derivation, without network
access.
Do not rely on "latest-builds" procedure and use the new static Cuirass
routes
"/search/latest" and "/search/latest/<build-product>" to provide static
download links.
* website/apps/download/templates/download-latest.scm (default-spec): New
variable,
(build-detail-url): remove url argument and use "/search/latest" route,
(build-product-download-url): remove url and use
"/search/latest/<build-product>" route,
(products-latest-urls): remove it,
(download-latest-t): adapt accordingly.
---
.../apps/download/templates/download-latest.scm | 64 ++++------------------
1 file changed, 11 insertions(+), 53 deletions(-)
diff --git a/website/apps/download/templates/download-latest.scm
b/website/apps/download/templates/download-latest.scm
index f23d3d1..c13eeb3 100644
--- a/website/apps/download/templates/download-latest.scm
+++ b/website/apps/download/templates/download-latest.scm
@@ -29,6 +29,7 @@
#:export (download-latest-t))
(define ci-url "https://ci.guix.gnu.org")
+(define default-spec "guix-master")
(define-record-type <image>
(make-image description logo job type)
@@ -45,60 +46,21 @@
"iso9660-image.x86_64-linux"
"ISO-9660")))
-(define (build-detail-url url build)
+(define (build-detail-url job)
"Return the detail page for BUILD hosted on CI server at URL."
- (format #f "~a/build/~a/details" url (build-id build)))
+ (format #f "~a/search/latest?query=spec:~a+~a" ci-url default-spec job))
-(define (build-product-download-url url build-product)
+(define (build-product-download-url job type)
"Return a download URL for BUILD-PRODUCT hosted on CI server at URL."
- (string-append url "/download/" (number->string
- (build-product-id build-product))))
-(define* (products-latest-urls job type
- #:optional (limit 15)
- #:key url)
- "Fetch the latest LIMIT jobs from URL matching the given JOB. Then, for the
-first job with a build output of the given TYPE, return '(DETAIL-URL
-. DOWNLOAD-URL), where DETAIL-URL is the URL describing the matching build in
-the CI, and DOWNLOAD-URL is the URL to download the build output. If no
-matching jobs are found, return an empty list."
- ;; See build-status enumeration in (cuirass database).
- (define build-status-success 0)
-
- (define (find-product-by-type build-products type)
- (find (lambda (build-product)
- (string=? (build-product-type build-product) type))
- build-products))
-
- (define (latest-build-products)
- (let ((builds
- (latest-builds url limit
- #:job job
- #:status build-status-success)))
- (filter-map
- (lambda (build)
- (let ((products (build-products build)))
- (match products
- (() #f)
- (x (let ((product
- (find-product-by-type products type)))
- (and product
- (cons build product)))))))
- builds)))
-
- (match (latest-build-products)
- (((build . product) . rest)
- (cons
- (build-detail-url url build)
- (build-product-download-url url product)))
- (_ '())))
+ (format #f "~a/search/latest/~a?query=spec:~a+~a"
+ ci-url type default-spec job))
(define (image-table-row image)
"Return as an HTML table row, the representation of IMAGE."
(let* ((description (image-description image))
(job (image-job image))
(type (image-type image))
- (logo (image-logo image))
- (urls (products-latest-urls job type #:url ci-url)))
+ (logo (image-logo image)))
`(tr
(td
(table
@@ -111,14 +73,10 @@ matching jobs are found, return an empty list."
(td
(@ (class "download-table-box"))
(h3 ,description))))))
- ,(if (null? urls)
- '(td "No available image")
- (match urls
- ((detail-url . download-url)
- `(td
- (a (@ (href ,download-url)) "Download")
- " "
- (a (@ (href ,detail-url)) "(details)"))))))))
+ (td
+ (a (@ (href ,(build-product-download-url job type))) "Download")
+ " "
+ (a (@ (href ,(build-detail-url job))) "(details)")))))
(define (download-latest-t)
"Return the Download latest page in SHTML."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: website: Use static links for latest downloads.,
Mathieu Othacehe <=