aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage/manage-patch-branches.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-09-19 15:16:23 +0100
committerChristopher Baines <mail@cbaines.net>2023-09-19 15:16:23 +0100
commit4db90aa5ceb966071971eb5f2f1d8126e1557cba (patch)
tree4aa6ae23ab6f85eab14d34b2cfea686a591cd144 /guix-qa-frontpage/manage-patch-branches.scm
parentec9481eacfee7746ed23ed7ff56910bcad2abe8e (diff)
downloadqa-frontpage-4db90aa5ceb966071971eb5f2f1d8126e1557cba.tar
qa-frontpage-4db90aa5ceb966071971eb5f2f1d8126e1557cba.tar.gz
Better handle patches that don't apply
Diffstat (limited to 'guix-qa-frontpage/manage-patch-branches.scm')
-rw-r--r--guix-qa-frontpage/manage-patch-branches.scm47
1 files changed, 32 insertions, 15 deletions
diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm
index f3e677c..0ce9d4b 100644
--- a/guix-qa-frontpage/manage-patch-branches.scm
+++ b/guix-qa-frontpage/manage-patch-branches.scm
@@ -167,6 +167,17 @@
(lambda (response body)
(json->scm body))))
+ (define (insert-log results)
+ (define log
+ (string-join
+ (map
+ (lambda (patch)
+ (assq-ref patch 'output))
+ results)
+ "\n\n"))
+
+ (insert-create-branch-for-issue-log database issue-number log))
+
(if (assoc-ref series-data "received_all")
(begin
(simple-format #t "all patches have been received\n")
@@ -177,14 +188,17 @@
(assoc-ref series-data "patches")))
(results '()))
(if (null? patch-data)
- (if (string=? base-commit-hash
+ (begin
+ (insert-log results)
+
+ (if (string=? base-commit-hash
(invoke-read-line "git" "rev-parse" "HEAD"))
- (simple-format
- (current-error-port)
- "Commit hashes match, so no patches have been applied\n")
- (begin
- (push)
- (clear-cache)))
+ (simple-format
+ (current-error-port)
+ "Commit hashes match, so no patches have been applied\n")
+ (begin
+ (push)
+ (clear-cache))))
(let* ((patch (car patch-data))
(name (assoc-ref patch "name"))
(id (assoc-ref patch "id")))
@@ -201,19 +215,22 @@
(dump-port port output))))
(simple-format #t "applying ~A\n" patch-file)
- (let ((code
- output
- (invoke/capture-output
- "git" "am" "--empty=drop" "--3way" patch-file)))
+ (let* ((code
+ output
+ (invoke/capture-output
+ "git" "am" "--empty=drop" "--3way" patch-file))
+ (new-results
+ `(((id . ,id)
+ (name . ,name)
+ (output . ,output))
+ ,@results)))
(if (zero? (status:exit-val (cdr code)))
(loop (cdr patch-data)
- `(((id . ,id)
- (name . ,name)
- (output . ,output))
- ,@results))
+ new-results)
(begin
(simple-format
#t "Failed to apply \"~A.patch\" (~A)\n" id name)
+ (insert-log new-results)
#f))))))))
(simple-format #t "all patches have not been received, skipping\n")))