diff options
author | Christopher Baines <mail@cbaines.net> | 2020-09-18 11:44:47 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-09-18 11:44:47 +0100 |
commit | 5e8408c833e209efddfa0159114b90400c1aaf4d (patch) | |
tree | fff88a1cdec8877353922d0a43939fc0924f0d65 | |
parent | 3792cc15e797abb639bf2f23bcab249ddec029ff (diff) | |
download | build-coordinator-5e8408c833e209efddfa0159114b90400c1aaf4d.tar build-coordinator-5e8408c833e209efddfa0159114b90400c1aaf4d.tar.gz |
Make the processed commits file configurable
In the queue builds script.
-rw-r--r-- | scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in index d20d10b..91e7bd4 100644 --- a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in +++ b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in @@ -34,26 +34,10 @@ (guix-build-coordinator utils) (guix-build-coordinator client-communication)) -(define %processed-commits-file "processed-revisions") - ;; This gets populated from a file on startup (define processed-commits-hash (make-hash-table 1024)) -(when (file-exists? %processed-commits-file) - (call-with-input-file %processed-commits-file - (lambda (port) - (let ((commits - (string-split (get-string-all port) #\newline))) - (for-each (lambda (commit) - (unless (string-null? commit) - (simple-format #t "marking ~A as already processed\n" - commit) - (hash-set! processed-commits-hash - commit - #t))) - commits))))) - (define processed-derivations-hash (make-hash-table 102400)) @@ -94,8 +78,8 @@ (vector->list (assoc-ref data "revisions"))))) -(define (record-revision-as-processed commit) - (let ((port (open-file %processed-commits-file "a"))) +(define (record-revision-as-processed processed-commits-file commit) + (let ((port (open-file processed-commits-file "a"))) (simple-format port "~A\n" commit) (close-port port)) @@ -218,11 +202,17 @@ (lambda (opt name arg result) (alist-cons 'guix-data-service arg - (alist-delete 'guix-data-service result)))))) + (alist-delete 'guix-data-service result)))) + (option '("processed-commits-file") #t #f + (lambda (opt name arg result) + (alist-cons 'processed-commits-file + arg + (alist-delete 'processed-commits-file result)))))) (define %option-defaults - '((coordinator . "http://127.0.0.1:8746") - (guix-data-service . "https://data.guix.gnu.org"))) + '((coordinator . "http://127.0.0.1:8746") + (guix-data-service . "https://data.guix.gnu.org") + (processed-commits-file . "processed-revisions"))) (define (parse-options options defaults args) (args-fold @@ -245,20 +235,36 @@ (systems-and-targets (assq-ref opts 'systems-and-targets)) (guix-data-service - (assq-ref opts 'guix-data-service))) + (assq-ref opts 'guix-data-service)) + (processed-commits-file + (assq-ref opts 'processed-commits-file))) (unless systems-and-targets (simple-format (current-error-port) "error: you must specify at least one system to fetch builds for\n") (exit 1)) + (when (file-exists? processed-commits-file) + (call-with-input-file processed-commits-file + (lambda (port) + (let ((commits + (string-split (get-string-all port) #\newline))) + (for-each (lambda (commit) + (unless (string-null? commit) + (simple-format #t "marking ~A as already processed\n" + commit) + (hash-set! processed-commits-hash + commit + #t))) + commits))))) + (while #t (for-each (lambda (commit) (submit-builds-for-revision (assq-ref opts 'coordinator) guix-data-service commit systems-and-targets) - (record-revision-as-processed commit)) + (record-revision-as-processed processed-commits-file commit)) (unseen-revisions guix-data-service)) (simple-format #t "waiting before checking for new revisions...\n") |