Allow "*" directories in distribution specs.
Useful to avoid deleting stuff from directories that might have non-distributed materials.
This commit is contained in:
parent
5ca93be56c
commit
ee69dc58bc
|
@ -9,9 +9,21 @@
|
|||
(unless (apply system* (force rsync-exe) args)
|
||||
(error 'distribute "errors when running: rsync with ~s" args)))
|
||||
|
||||
(define (flatten-path path)
|
||||
(define m (regexp-match #rx"^(.*?)/\\*(/.*|$)$" path))
|
||||
(if m
|
||||
(append-map
|
||||
flatten-path
|
||||
(sort (map (λ(p) (string-append
|
||||
(cadr m) "/" (path-element->string p) (caddr m)))
|
||||
(directory-list (cadr m)))
|
||||
string<?))
|
||||
(list path)))
|
||||
|
||||
(provide distribute)
|
||||
;; see "../config.rkt" for a description of the specs
|
||||
(define (distribute specs)
|
||||
(for ([s (in-list specs)])
|
||||
(let ([srcs (cdr s)] [tgt (car s)])
|
||||
(let ([srcs (append-map flatten-path (cdr s))] [tgt (car s)])
|
||||
(printf " to ~a\n" tgt)
|
||||
(apply rsync "-aqz" "-e" "ssh" "--delete" `(,@srcs ,tgt)))))
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
(provide distributions)
|
||||
(define distributions
|
||||
(make-parameter
|
||||
;; Each is a "hostname:dest-path", and then a list of directories to
|
||||
;; put in that path. (Warning: "dest" should not be a top-level
|
||||
;; directory that already exists.)
|
||||
;; Each is a "hostname:dest-path", and then a list of directories to put in
|
||||
;; that path. Warning: distributed directories are replicated from the
|
||||
;; source, including removing material that is not distributed. A directory
|
||||
;; can also have "*" parts which will be expanded recursively -- useful to
|
||||
;; avoid deletions in case a target directory has additional materials.
|
||||
'(["champlain:/www" "www" "download" "bugs" "lists" "drracket" "stubs"])))
|
||||
|
|
Loading…
Reference in New Issue
Block a user