diff options
author | Christopher Baines <mail@cbaines.net> | 2020-12-17 01:04:58 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-12-17 01:04:58 +0000 |
commit | c0a51b7fd8556d40617d772e5fc8872193f9423b (patch) | |
tree | dfb782efec982325599062931b4dc03814a524ea | |
parent | 008027fe50ee19320e983306e85a9c0960e85a36 (diff) | |
download | build-coordinator-c0a51b7fd8556d40617d772e5fc8872193f9423b.tar build-coordinator-c0a51b7fd8556d40617d772e5fc8872193f9423b.tar.gz |
Use the same skip if narinfo exists logic in the publish hook
As is used in the S3 publish hook. This is useful when you don't want to
overwrite existing nar+narinfo entries.
-rw-r--r-- | guix-build-coordinator/hooks.scm | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/guix-build-coordinator/hooks.scm b/guix-build-coordinator/hooks.scm index b09cefe..97f3311 100644 --- a/guix-build-coordinator/hooks.scm +++ b/guix-build-coordinator/hooks.scm @@ -111,29 +111,30 @@ (string-append publish-directory "/" narinfo-filename))) - (copy-file nar-location nar-destination) - - (call-with-output-file narinfo-location - (lambda (port) - (display (narinfo-string - output-filename - (assq-ref output 'hash) - (assq-ref output 'size) - (vector->list - (assq-ref output 'references)) - `((lzip ,(stat:size (stat nar-location #f)))) - #:system (datastore-find-derivation-system - datastore - derivation-name) - #:derivation derivation-name - #:public-key public-key - #:private-key private-key) - port))) - - (when post-publish-hook - (post-publish-hook publish-directory - narinfo-filename - nar-filename)))) + (unless (file-exists? narinfo-location) + (copy-file nar-location nar-destination) + + (call-with-output-file narinfo-location + (lambda (port) + (display (narinfo-string + output-filename + (assq-ref output 'hash) + (assq-ref output 'size) + (vector->list + (assq-ref output 'references)) + `((lzip ,(stat:size (stat nar-location #f)))) + #:system (datastore-find-derivation-system + datastore + derivation-name) + #:derivation derivation-name + #:public-key public-key + #:private-key private-key) + port))) + + (when post-publish-hook + (post-publish-hook publish-directory + narinfo-filename + nar-filename))))) (datastore-list-build-outputs datastore build-id))))) (define* (build-success-s3-publish-hook |