diff options
author | Christopher Baines <mail@cbaines.net> | 2023-03-11 11:30:45 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-03-11 11:30:45 +0000 |
commit | e69bc36d5523a505addaa9cfb5d6431758ac37c2 (patch) | |
tree | 4aa2cb962e61747b6cc0ae1cfbfe9f0c35eb1887 /guix-qa-frontpage | |
parent | e7d3c6464df33b759718d8747e8a32be74d2957a (diff) | |
download | qa-frontpage-e69bc36d5523a505addaa9cfb5d6431758ac37c2.tar qa-frontpage-e69bc36d5523a505addaa9cfb5d6431758ac37c2.tar.gz |
Remove unnecessarily duplicated derivation changes procedures
Diffstat (limited to 'guix-qa-frontpage')
-rw-r--r-- | guix-qa-frontpage/guix-data-service.scm | 29 | ||||
-rw-r--r-- | guix-qa-frontpage/manage-builds.scm | 16 | ||||
-rw-r--r-- | guix-qa-frontpage/server.scm | 20 |
3 files changed, 20 insertions, 45 deletions
diff --git a/guix-qa-frontpage/guix-data-service.scm b/guix-qa-frontpage/guix-data-service.scm index 9c462d5..7f66ead 100644 --- a/guix-qa-frontpage/guix-data-service.scm +++ b/guix-qa-frontpage/guix-data-service.scm @@ -18,7 +18,6 @@ guix-data-service-error-response-code patch-series-derivation-changes-url - patch-series-derivation-changes patch-series-compare-url patch-series-comparison @@ -27,7 +26,7 @@ list-branches branch-derivation-changes-url - branch-derivation-changes + derivation-changes get-latest-processed-branch-revision @@ -91,30 +90,6 @@ "&target=none" "&field=builds&limit_results=&all_results=on")) -(define (patch-series-derivation-changes url) - (let-values (((response body) - (http-get (string->uri url)))) - (if (eq? (response-code response) - 404) - (values #f #f) - (let ((json-body - (with-exception-handler - (lambda _ #f) - (lambda () - (json-string->scm (utf8->string body))) - #:unwind? #t))) - (if (or (> (response-code response) - 400) - (assoc-ref json-body "error")) - (raise-exception - (make-guix-data-service-error json-body - (response-code response))) - (values (vector->list - (assoc-ref json-body - "derivation_changes")) - (alist-delete "derivation_changes" - json-body))))))) - (define* (patch-series-compare-url base-and-target-refs #:key (json? #t)) (string-append "https://data.qa.guix.gnu.org/compare" @@ -178,7 +153,7 @@ "&target=none" "&field=builds&limit_results=&all_results=on")) -(define (branch-derivation-changes url) +(define (derivation-changes url) (retry-on-error (lambda () (let ((json-body diff --git a/guix-qa-frontpage/manage-builds.scm b/guix-qa-frontpage/manage-builds.scm index aa0a7c8..55eabbf 100644 --- a/guix-qa-frontpage/manage-builds.scm +++ b/guix-qa-frontpage/manage-builds.scm @@ -61,7 +61,7 @@ #:systems %systems-to-submit-builds-for))))) (if derivation-changes-url - (let ((derivation-changes + (let ((derivation-changes-data change-details (with-exception-handler (lambda (exn) @@ -76,13 +76,13 @@ (with-sqlite-cache database 'derivation-changes - patch-series-derivation-changes + derivation-changes #:args (list derivation-changes-url) #:ttl (* 60 20))) #:unwind? #t))) - (when derivation-changes + (when derivation-changes-data (let ((target-commit (assoc-ref (assoc-ref @@ -95,7 +95,7 @@ guix-data-service 'issue issue-number - derivation-changes + derivation-changes-data target-commit #:build-limit (* (length %systems-to-submit-builds-for) @@ -155,17 +155,17 @@ #:systems %systems-to-submit-builds-for))) (if derivation-changes-url - (let ((derivation-changes + (let ((derivation-changes-data change-details (with-sqlite-cache database 'branch-derivation-changes - branch-derivation-changes + derivation-changes #:args (list derivation-changes-url) #:ttl 0))) - (when derivation-changes + (when derivation-changes-data (let ((target-commit (assoc-ref (assoc-ref @@ -178,7 +178,7 @@ guix-data-service 'branch branch - derivation-changes + derivation-changes-data target-commit #:priority priority-for-change)))) (simple-format #t "no derivation changes url for branch ~A\n" diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm index 25f550a..f770574 100644 --- a/guix-qa-frontpage/server.scm +++ b/guix-qa-frontpage/server.scm @@ -324,7 +324,7 @@ #:args (list (string->number number)) #:ttl 1200 #:store-computed-value? list?)) - (derivation-changes + (derivation-changes-data change-details (call-with-values (lambda () @@ -342,7 +342,7 @@ (with-sqlite-cache database 'derivation-changes - patch-series-derivation-changes + derivation-changes #:args (list (patch-series-derivation-changes-url @@ -382,7 +382,7 @@ (patch-series-compare-url base-and-target-refs #:json? #f)) - derivation-changes + derivation-changes-data change-details comparison-details))) (render-html @@ -446,16 +446,16 @@ port. Also, the port used can be changed by passing the --port option.\n" port))))))) (define* (branch-data branch-name) - (let* ((derivation-changes + (let* ((derivation-changes-data change-details - (branch-derivation-changes + (derivation-changes (branch-derivation-changes-url branch-name #:systems %systems-to-submit-builds-for))) (derivation-changes-counts (derivation-changes-counts - derivation-changes + derivation-changes-data %systems-to-submit-builds-for))) (values @@ -489,7 +489,7 @@ port. Also, the port used can be changed by passing the --port option.\n" (n-par-for-each 4 (lambda (series) - (let ((derivation-changes + (let ((derivation-changes-data (with-exception-handler (lambda (exn) (unless @@ -524,7 +524,7 @@ port. Also, the port used can be changed by passing the --port option.\n" (with-sqlite-cache database 'derivation-changes - patch-series-derivation-changes + derivation-changes #:args (list (patch-series-derivation-changes-url base-and-target-refs @@ -532,13 +532,13 @@ port. Also, the port used can be changed by passing the --port option.\n" #:ttl (/ frequency 2))))) #:unwind? #t))) - (and derivation-changes + (and derivation-changes-data (with-sqlite-cache database 'issue-patches-overall-status (lambda (id) (issue-patches-overall-status - derivation-changes + derivation-changes-data (assq-ref (assq-ref series 'mumi) 'tags))) #:args (list (car series)) |