diff options
author | Christopher Baines <mail@cbaines.net> | 2023-05-22 12:02:23 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-05-22 12:02:23 +0100 |
commit | 0d58b96c8eda264ac545bb439bffda796f7db37b (patch) | |
tree | 1792f2ce8f03c6e72aeb0dff6e3d5b1a2703f0e4 | |
parent | db1775332c83a8d0943bea4b69c49ea5b47cc2a6 (diff) | |
download | nar-herder-0d58b96c8eda264ac545bb439bffda796f7db37b.tar nar-herder-0d58b96c8eda264ac545bb439bffda796f7db37b.tar.gz |
Avoid generating cached compressions of already compressed files
This should probably be configurable, but just hardcoding
compressed-file? from (guix utils) seems like a good step forward for
now.
-rw-r--r-- | nar-herder/cached-compression.scm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/nar-herder/cached-compression.scm b/nar-herder/cached-compression.scm index e6243fe..8527889 100644 --- a/nar-herder/cached-compression.scm +++ b/nar-herder/cached-compression.scm @@ -30,7 +30,8 @@ #:use-module (web client) #:use-module (web response) #:use-module (guix store) - #:use-module ((guix utils) #:select (call-with-decompressed-port)) + #:use-module ((guix utils) #:select (compressed-file? + call-with-decompressed-port)) #:use-module ((guix build utils) #:select (dump-port mkdir-p)) #:use-module (nar-herder utils) @@ -330,9 +331,21 @@ (missing-compressions (lset-difference eq? (map car enabled-cached-compressions) - existing-compressions))) - - (unless (null? missing-compressions) + existing-compressions)) + (compress-file? + (let ((url + (assq-ref + (first + (database-select-narinfo-files-by-narinfo-id + database + narinfo-id)) + 'url))) + + ;; TODO: Maybe this should be configurable? + (not (compressed-file? url))))) + + (when (and compress-file? + (not (null? missing-compressions))) (let ((new-count (with-usage-hash-table (lambda (usage) |