aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2023-09-17 07:42:05 +0200
committerChristopher Baines <mail@cbaines.net>2023-10-21 15:14:34 +0100
commit7eb7814bcc2ae96bb26aff4f7448c012aba3b419 (patch)
tree1179c49eb9797e405f64bb24d81895127fd9c884
parente15e2edf16634a2805ebb665ca30cc2ea73c9ccd (diff)
downloadqa-frontpage-7eb7814bcc2ae96bb26aff4f7448c012aba3b419.tar
qa-frontpage-7eb7814bcc2ae96bb26aff4f7448c012aba3b419.tar.gz
Add parse-patch-name
This is a cut down version of the original patch. Using this information will require some refactoring first. Signed-off-by: Christopher Baines <mail@cbaines.net>
-rw-r--r--guix-qa-frontpage/manage-patch-branches.scm49
1 files changed, 49 insertions, 0 deletions
diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm
index 804b8b6..616a300 100644
--- a/guix-qa-frontpage/manage-patch-branches.scm
+++ b/guix-qa-frontpage/manage-patch-branches.scm
@@ -126,6 +126,55 @@
(close-pipe pipe)
result))
+(define (parse-patch-name name)
+ (let ((args
+ (and
+ (string-prefix? "[" name)
+ (let ((stop (string-index name #\])))
+ (substring name 1 stop))))
+ (as-bug-number
+ (lambda (arg)
+ (and (string-prefix? "bug#" arg)
+ (string->number (substring arg (string-length "bug#"))))))
+ (as-v2
+ (lambda (arg)
+ (and (string-prefix? "v" arg)
+ (string->number (substring arg 1)))))
+ (as-patch-number
+ (lambda (arg)
+ (match (string-split arg #\/)
+ (((= string->number index) (= string->number total))
+ (and index total (<= index total)
+ (cons index total)))
+ (else #f)))))
+ (let analyze ((bug-number #f)
+ (branch "master")
+ (version 1)
+ (index 1)
+ (total 1)
+ (arguments
+ (if args
+ (string-split args #\,)
+ '())))
+ (match arguments
+ ((or ("") ())
+ `((bug-number . ,bug-number)
+ (branch . ,branch)
+ (version . ,version)
+ (index . ,index)
+ (total . ,total)))
+ (((= as-bug-number (? number? new-bug-number))
+ arguments ...)
+ (analyze new-bug-number branch version index total arguments))
+ (((= as-v2 (? number? new-version))
+ arguments ...)
+ (analyze bug-number branch new-version index total arguments))
+ (((= as-patch-number ((? number? new-index) . (? number? new-total)))
+ arguments ...)
+ (analyze bug-number branch version new-index new-total arguments))
+ ((feature-branch arguments ...)
+ (analyze bug-number feature-branch version index total arguments))))))
+
(define (create-branch-for-issue database issue-number patchwork-series)
(define (apply-patches)
(define branch-name