~ruther/guix-local

c4556777d99fd9d491ff6e1669f680f15d5b4bcd — Tobias Geerinckx-Rice 8 years ago 50d22ef
gnu: borg: Update to 1.1.4.

* gnu/packages/backup.scm (borg): Update to 1.1.4.
[source]: Remove obsolete patch.  Remove bundled lz4 and zstd.
[inputs]: Add zstd.
[arguments]: Build with input versions of lz4 and zstd.
* gnu/packages/patches/borg-fix-archive-corruption-bug.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Remove it.
3 files changed, 24 insertions(+), 86 deletions(-)

M gnu/local.mk
M gnu/packages/backup.scm
D gnu/packages/patches/borg-fix-archive-corruption-bug.patch
M gnu/local.mk => gnu/local.mk +0 -1
@@ 557,7 557,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/binutils-ld-new-dtags.patch		\
  %D%/packages/patches/binutils-loongson-workaround.patch	\
  %D%/packages/patches/blast+-fix-makefile.patch		\
  %D%/packages/patches/borg-fix-archive-corruption-bug.patch	\
  %D%/packages/patches/byobu-writable-status.patch		\
  %D%/packages/patches/cairo-CVE-2016-9082.patch			\
  %D%/packages/patches/calibre-no-updates-dialog.patch		\

M gnu/packages/backup.scm => gnu/packages/backup.scm +24 -17
@@ 468,18 468,22 @@ detection, and lossless compression.")
(define-public borg
  (package
    (name "borg")
    (version "1.1.3")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "borgbackup" version))
              (patches (search-patches "borg-fix-archive-corruption-bug.patch"))
              (sha256
               (base32
                "1rvn8b6clzd1r317r9jkvk34r31risi0dxfjc7jffhnwasck4anc"))
              (modules '((guix build utils)))
              (snippet
               '(for-each
                  delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
    (version "1.1.4")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "borgbackup" version))
       (sha256
        (base32 "1cicqwh85wfp65y00qaq6q4i4jcyy9b66qz5gpl80qc880wab912"))
       (modules '((guix build utils)))
       (snippet
        '(begin
           (for-each delete-file
                     (find-files "borg" "^(c|h|p).*\\.c$"))
           ;; Remove bundled shared libraries.
           (with-directory-excursion "src/borg/algorithms"
             (for-each delete-file-recursively
                       (list "lz4" "zstd")))))))
    (build-system python-build-system)
    (arguments
     `(#:modules ((srfi srfi-26) ; for cut


@@ 490,9 494,11 @@ detection, and lossless compression.")
         (add-after 'unpack 'set-env
           (lambda* (#:key inputs #:allow-other-keys)
             (let ((openssl (assoc-ref inputs "openssl"))
                   (lz4 (assoc-ref inputs "lz4")))
                   (lz4 (assoc-ref inputs "lz4"))
                   (zstd (assoc-ref inputs "zstd")))
               (setenv "BORG_OPENSSL_PREFIX" openssl)
               (setenv "BORG_LZ4_PREFIX" lz4)
               (setenv "BORG_LIBLZ4_PREFIX" lz4)
               (setenv "BORG_LIBZSTD_PREFIX" zstd)
               (setenv "PYTHON_EGG_CACHE" "/tmp")
               ;; The test 'test_return_codes[python]' fails when
               ;; HOME=/homeless-shelter.


@@ 544,8 550,8 @@ detection, and lossless compression.")
    (native-inputs
     `(("python-cython" ,python-cython)
       ("python-setuptools-scm" ,python-setuptools-scm)
       ;; Borg 1.0.8's test suite uses 'tmpdir_factory', which was introduced in
       ;; pytest 2.8.
       ;; Borg >=1.0.8's test suite uses 'tmpdir_factory', which was introduced
       ;; in pytest 2.8.
       ("python-pytest" ,python-pytest-3.0)
       ;; For generating the documentation.
       ("python-sphinx" ,python-sphinx)


@@ 555,7 561,8 @@ detection, and lossless compression.")
       ("lz4" ,lz4)
       ("openssl" ,openssl)
       ("python-llfuse" ,python-llfuse)
       ("python-msgpack" ,python-msgpack)))
       ("python-msgpack" ,python-msgpack)
       ("zstd" ,zstd)))
    (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
    (description "Borg is a deduplicating backup program.  Optionally, it
supports compression and authenticated encryption.  The main goal of Borg is to

D gnu/packages/patches/borg-fix-archive-corruption-bug.patch => gnu/packages/patches/borg-fix-archive-corruption-bug.patch +0 -68
@@ 1,68 0,0 @@
Fix a bug in `borg check --repair` that corrupts existing archives:

https://github.com/borgbackup/borg/issues/3444

Patches copied from upstream source repository:

https://github.com/borgbackup/borg/commit/e09892caec8a63d59e909518c4e9c230dbd69774
https://github.com/borgbackup/borg/commit/a68d28bfa4db30561150c83eb6a0dca5efa4d9e8

From a68d28bfa4db30561150c83eb6a0dca5efa4d9e8 Mon Sep 17 00:00:00 2001
From: Thomas Waldmann <tw@waldmann-edv.de>
Date: Sat, 16 Dec 2017 01:11:40 +0100
Subject: [PATCH 1/2] modify borg check unit test so it "hangs", see #3444

it doesn't infinitely hang, but slows down considerably.
---
 src/borg/testsuite/archiver.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
index c7def2c7..b3383e97 100644
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -3006,7 +3006,7 @@ def test_missing_file_chunk(self):
     def test_missing_archive_item_chunk(self):
         archive, repository = self.open_archive('archive1')
         with repository:
-            repository.delete(archive.metadata.items[-5])
+            repository.delete(archive.metadata.items[0])
             repository.commit()
         self.cmd('check', self.repository_location, exit_code=1)
         self.cmd('check', '--repair', self.repository_location, exit_code=0)
-- 
2.15.1


From e09892caec8a63d59e909518c4e9c230dbd69774 Mon Sep 17 00:00:00 2001
From: Thomas Waldmann <tw@waldmann-edv.de>
Date: Sat, 16 Dec 2017 01:16:05 +0100
Subject: [PATCH 2/2] check --repair: fix malfunctioning validator, fixes #3444

the major problem was the ('path' in item) expression.
the dict has bytes-typed keys there, so it never succeeded as it
looked for a str key. this is a 1.1 regression, 1.0 was fine.

the dict -> StableDict change is just for being more specific,
the check triggered correctly as StableDict subclasses dict,
it was just a bit too general.
---
 src/borg/archive.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/borg/archive.py b/src/borg/archive.py
index 239d00b7..be086800 100644
--- a/src/borg/archive.py
+++ b/src/borg/archive.py
@@ -1457,7 +1457,7 @@ def robust_iterator(archive):
             """
             item_keys = frozenset(key.encode() for key in self.manifest.item_keys)
             required_item_keys = frozenset(key.encode() for key in REQUIRED_ITEM_KEYS)
-            unpacker = RobustUnpacker(lambda item: isinstance(item, dict) and 'path' in item,
+            unpacker = RobustUnpacker(lambda item: isinstance(item, StableDict) and b'path' in item,
                                       self.manifest.item_keys)
             _state = 0
 
-- 
2.15.1