From 188d51da3f7078228b3cd57ecbceae658af36048 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sun, 29 Jan 2023 23:06:52 +0000 Subject: bin: Allow pulling only one host in each invocation. * bin/tissue (tissue-pull): Allow pulling only one host in each invocation. --- bin/tissue | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'bin') diff --git a/bin/tissue b/bin/tissue index 0d0d162..5357c66 100755 --- a/bin/tissue +++ b/bin/tissue @@ -472,16 +472,25 @@ Pull latest from upstream repositories. "State directory ~a does not exist.~%" state-directory) (exit #f)) - ;; Pull state for specific host, or for all hosts when none - ;; are specified on the command-line. - (for-each (match-lambda - ((hostname . parameters) - (when (or (not (assq-ref args 'host)) - (string=? hostname (assq-ref args 'host))) - (pull state-directory - hostname - (assq-ref parameters 'upstream-repository))))) - (assq-ref args 'hosts))))))) + ;; Pull state for specificied host. + ;; It is not a good idea to pull for all configured hosts + ;; when no host is specified on the command line. Since + ;; pulling requires executing code in each repository, + ;; pulling for multiple hosts in a single process can cause + ;; interaction of code across hosts. + (let ((hostname (assq-ref args 'host))) + (cond + ((assoc-ref (assq-ref args 'hosts) + hostname) + => (lambda (parameters) + (pull state-directory + hostname + (assq-ref parameters 'upstream-repository)))) + (else + (format (current-error-port) + "Host ~a not found in configuration file." + hostname) + (exit #f))))))))) (define (main . args) (guard (c ((condition-git-error c) -- cgit v1.2.3