gnu: borg: Improve package style.

* gnu/packages/backup.scm (borg)[origin]<snippet>: Use G-expressions.  Remove
trailing #T.
[arguments]: Use G-expressions.
This commit is contained in:
Nicolas Goaziou 2022-10-22 18:34:32 +02:00
parent 63bb2b965c
commit bb2701b911
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -642,108 +642,105 @@ (define-public borg
(base32 "0q3jwmwwa3jlb02cbkcgh5a9cvwg64vawaypn41bdgpi8ds6hc6p")) (base32 "0q3jwmwwa3jlb02cbkcgh5a9cvwg64vawaypn41bdgpi8ds6hc6p"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
'(begin #~(begin
;; Delete files generated by Cython. We used to have a regex ;; Delete files generated by Cython. We used to have a regex that
;; that created the list of generated files but Borg has ;; created the list of generated files but Borg has added new
;; added new non-generated C files that cause the regex to ;; non-generated C files that cause the regex to generate the
;; generate the wrong list. ;; wrong list.
(for-each delete-file (for-each delete-file
'("src/borg/algorithms/checksums.c" '("src/borg/algorithms/checksums.c"
"src/borg/chunker.c" "src/borg/chunker.c"
"src/borg/compress.c" "src/borg/compress.c"
"src/borg/crypto/low_level.c" "src/borg/crypto/low_level.c"
"src/borg/hashindex.c" "src/borg/hashindex.c"
"src/borg/item.c" "src/borg/item.c"
"src/borg/platform/darwin.c" "src/borg/platform/darwin.c"
"src/borg/platform/freebsd.c" "src/borg/platform/freebsd.c"
"src/borg/platform/linux.c" "src/borg/platform/linux.c"
"src/borg/platform/posix.c" "src/borg/platform/posix.c"
"src/borg/platform/syncfilerange.c" "src/borg/platform/syncfilerange.c"
"src/borg/platform/windows.c")) "src/borg/platform/windows.c"))
;; Remove bundled shared libraries. ;; Remove bundled shared libraries.
(with-directory-excursion "src/borg/algorithms" (with-directory-excursion "src/borg/algorithms"
(for-each delete-file-recursively (for-each delete-file-recursively
(list "lz4" "xxh64" "zstd"))) (list "lz4" "xxh64" "zstd")))))))
#t))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:modules ((srfi srfi-26) ; for cut (list
#:modules '((srfi srfi-26) ; for cut
(guix build utils) (guix build utils)
(guix build python-build-system)) (guix build python-build-system))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'set-env (add-after 'unpack 'set-env
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((openssl (assoc-ref inputs "openssl")) (let ((openssl #$(this-package-input "openssl"))
(lz4 (assoc-ref inputs "lz4")) (lz4 #$(this-package-input "lz4"))
(xxhash (assoc-ref inputs "xxhash")) (xxhash #$(this-package-input "xxhash"))
(zstd (assoc-ref inputs "zstd"))) (zstd #$(this-package-input "zstd")))
(setenv "BORG_OPENSSL_PREFIX" openssl) (setenv "BORG_OPENSSL_PREFIX" openssl)
(setenv "BORG_LIBLZ4_PREFIX" lz4) (setenv "BORG_LIBLZ4_PREFIX" lz4)
(setenv "BORG_LIBXXHASH_PREFIX" xxhash) (setenv "BORG_LIBXXHASH_PREFIX" xxhash)
(setenv "BORG_LIBZSTD_PREFIX" zstd) (setenv "BORG_LIBZSTD_PREFIX" zstd)
(setenv "PYTHON_EGG_CACHE" "/tmp") (setenv "PYTHON_EGG_CACHE" "/tmp")
;; The test 'test_return_codes[python]' fails when ;; The test 'test_return_codes[python]' fails when
;; HOME=/homeless-shelter. ;; HOME=/homeless-shelter.
(setenv "HOME" "/tmp") (setenv "HOME" "/tmp"))))
#t))) ;; The tests need to be run after Borg is installed.
;; The tests need to be run after Borg is installed. (delete 'check)
(delete 'check) (add-after 'install 'check
(add-after 'install 'check (lambda* (#:key inputs outputs tests? #:allow-other-keys)
(lambda* (#:key inputs outputs tests? #:allow-other-keys) (when tests?
(when tests? ;; Make the installed package available for the test suite.
;; Make the installed package available for the test suite. (add-installed-pythonpath inputs outputs)
(add-installed-pythonpath inputs outputs) ;; The tests should be run in an empty directory.
;; The tests should be run in an empty directory. (mkdir-p "tests")
(mkdir-p "tests") (with-directory-excursion "tests"
(with-directory-excursion "tests" (invoke "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
(invoke "py.test" "-v" "--pyargs" "borg.testsuite" "-k" (string-append
(string-append ;; These tests need to write to '/var'.
;; These tests need to write to '/var'. "not test_get_cache_dir "
"not test_get_cache_dir " "and not test_get_config_dir "
"and not test_get_config_dir " "and not test_get_keys_dir "
"and not test_get_keys_dir " "and not test_get_security_dir "
"and not test_get_security_dir " ;; These tests assume there is a root user in '/etc/passwd'.
;; These tests assume there is a root user in '/etc/passwd'. "and not test_access_acl "
"and not test_access_acl " "and not test_default_acl "
"and not test_default_acl " "and not test_get_item_uid_gid "
"and not test_get_item_uid_gid " "and not test_non_ascii_acl "
"and not test_non_ascii_acl " "and not test_create_content_from_command "
"and not test_create_content_from_command " "and not test_create_content_from_command_with_failed_command "
"and not test_create_content_from_command_with_failed_command " "and not test_create_stdin "
"and not test_create_stdin " ;; We don't need to run benchmarks
;; We don't need to run benchmarks "and not benchmark "
"and not benchmark " ;; These tests assume the kernel supports FUSE.
;; These tests assume the kernel supports FUSE. "and not test_fuse "
"and not test_fuse " "and not test_fuse_allow_damaged_files "
"and not test_fuse_allow_damaged_files " "and not test_mount_hardlinks "
"and not test_mount_hardlinks " "and not test_readonly_mount "
"and not test_readonly_mount " "and not test_fuse_versions_view "
"and not test_fuse_versions_view " "and not test_migrate_lock_alive"))))))
"and not test_migrate_lock_alive")))))) (add-after 'install 'install-doc
(add-after 'install 'install-doc (lambda _
(lambda* (#:key inputs outputs #:allow-other-keys) (let ((man (string-append #$output "/share/man/man1"))
(let* ((out (assoc-ref outputs "out")) (misc (string-append #$output "/share/borg/misc")))
(man (string-append out "/share/man/man1")) (for-each (cut install-file <> misc)
(misc (string-append out "/share/borg/misc"))) '("docs/misc/create_chunker-params.txt"
(for-each (cut install-file <> misc) "docs/misc/borg-data-flow.png"
'("docs/misc/create_chunker-params.txt" "docs/misc/internals-picture.txt"
"docs/misc/borg-data-flow.png" "docs/misc/prune-example.txt"))
"docs/misc/internals-picture.txt" (copy-recursively "docs/man" man))))
"docs/misc/prune-example.txt")) (add-after 'install-docs 'install-shell-completions
(copy-recursively "docs/man" man)))) (lambda _
(add-after 'install-docs 'install-shell-completions (let ((etc (string-append #$output "/etc"))
(lambda* (#:key outputs #:allow-other-keys) (share (string-append #$output "/share")))
(let* ((out (assoc-ref outputs "out")) (with-directory-excursion "scripts/shell_completions"
(etc (string-append out "/etc")) (install-file "bash/borg"
(share (string-append out "/share"))) (string-append etc "/bash_completion.d"))
(with-directory-excursion "scripts/shell_completions" (install-file "zsh/_borg"
(install-file "bash/borg" (string-append share "/zsh/site-functions"))
(string-append etc "/bash_completion.d")) (install-file "fish/borg.fish"
(install-file "zsh/_borg" (string-append share "/fish/vendor_completions.d")))))))))
(string-append share "/zsh/site-functions"))
(install-file "fish/borg.fish"
(string-append share "/fish/vendor_completions.d")))))))))
(native-inputs (native-inputs
(list python-cython python-dateutil python-setuptools-scm python-pytest)) (list python-cython python-dateutil python-setuptools-scm python-pytest))
(inputs (inputs
@ -755,8 +752,8 @@ (define-public borg
;; FUSE 3 isn't working well, so we stick with FUSE 2 for now: ;; FUSE 3 isn't working well, so we stick with FUSE 2 for now:
;; <https://issues.guix.gnu.org/53407> ;; <https://issues.guix.gnu.org/53407>
python-llfuse python-llfuse
`(,zstd "lib") xxhash
xxhash)) `(,zstd "lib")))
(synopsis "Deduplicated, encrypted, authenticated and compressed backups") (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
(description "Borg is a deduplicating backup program. Optionally, it (description "Borg is a deduplicating backup program. Optionally, it
supports compression and authenticated encryption. The main goal of Borg is to supports compression and authenticated encryption. The main goal of Borg is to