diff options
author | Christopher Baines <mail@cbaines.net> | 2022-11-20 21:36:29 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-11-20 21:36:29 +0000 |
commit | 959d4c9c8e02e1241de80e844ef5ca36e66aab27 (patch) | |
tree | d58c9dd274cbf655d03d099097ddf452648b08a6 /guix-qa-frontpage/guix-data-service.scm | |
parent | ec62a85e7892029846fc0803a9ebad5807ee8193 (diff) | |
download | qa-frontpage-959d4c9c8e02e1241de80e844ef5ca36e66aab27.tar qa-frontpage-959d4c9c8e02e1241de80e844ef5ca36e66aab27.tar.gz |
Switch to using the git repository for comparison information
Rather than storing the revisions in Patchwork checks.
Diffstat (limited to 'guix-qa-frontpage/guix-data-service.scm')
-rw-r--r-- | guix-qa-frontpage/guix-data-service.scm | 75 |
1 files changed, 24 insertions, 51 deletions
diff --git a/guix-qa-frontpage/guix-data-service.scm b/guix-qa-frontpage/guix-data-service.scm index 9674b18..5b6dd20 100644 --- a/guix-qa-frontpage/guix-data-service.scm +++ b/guix-qa-frontpage/guix-data-service.scm @@ -10,6 +10,7 @@ #:use-module (json) #:use-module (guix-build-coordinator utils) #:use-module (guix-qa-frontpage patchwork) + #:use-module (guix-qa-frontpage manage-patch-branches) #:export (&guix-data-service-error guix-data-service-error? guix-data-service-error-response-body @@ -33,34 +34,21 @@ guix-data-service-error? (response-body guix-data-service-error-response-body)) -(define* (patch-series-derivation-changes-url checks #:key systems) - (define comparison-check - (match (sort (filter (lambda (check) - (string=? (assoc-ref check "context") - "comparison")) - checks) - (lambda (a b) - (string>? (assoc-ref a "date") - (assoc-ref b "date")))) - ((first . rest) first) - (() #f))) - - (and comparison-check - (let ((url-query-params - (uri-query - (string->uri - (assoc-ref comparison-check "target_url"))))) - - (string-append - "https://data.qa.guix.gnu.org/compare/package-derivations.json?" - url-query-params - (string-join - (map (lambda (system) - (simple-format #f "&system=~A" system)) - (or systems '())) - "") - "&target=none" - "&field=builds&limit_results=&all_results=on")))) +(define* (patch-series-derivation-changes-url issue-number #:key systems) + (and=> + (get-issue-branch-base-and-target-refs issue-number) + (lambda (base-and-target) + (string-append + "https://data.qa.guix.gnu.org/compare/package-derivations.json?" + "base_commit=" (assq-ref base-and-target 'base) + "&target_commit=" (assq-ref base-and-target 'target) + (string-join + (map (lambda (system) + (simple-format #f "&system=~A" system)) + (or systems '())) + "") + "&target=none" + "&field=builds&limit_results=&all_results=on")))) (define (patch-series-derivation-changes url) (let-values (((response body) @@ -85,29 +73,14 @@ (alist-delete "derivation_changes" json-body))))))) -(define (patch-series-compare-url series) - (define comparison-check - (match (sort (filter (lambda (check) - (string=? (assoc-ref check "context") - "comparison")) - (patchwork-patch-checks - (assoc-ref (first (assoc-ref series "patches")) - "checks"))) - (lambda (a b) - (string>? (assoc-ref a "date") - (assoc-ref b "date")))) - ((first . rest) first) - (() #f))) - - (and comparison-check - (let ((url-query-params - (uri-query - (string->uri - (assoc-ref comparison-check "target_url"))))) - - (string-append - "https://data.qa.guix.gnu.org/compare.json?" - url-query-params)))) +(define (patch-series-compare-url issue-number) + (and=> + (get-issue-branch-base-and-target-refs issue-number) + (lambda (base-and-target) + (string-append + "https://data.qa.guix.gnu.org/compare.json?" + "base_commit=" (assq-ref base-and-target 'base) + "&target_commit=" (assq-ref base-and-target 'target))))) (define (patch-series-comparison url) (retry-on-error |