gnu: All snippets report errors using exceptions, else return #t.
[jackhill/guix/guix.git] / gnu / packages / backup.scm
index cfeaa20..628c39a 100644 (file)
@@ -6,6 +6,7 @@
 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
+;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;;
@@ -190,16 +191,17 @@ backups (called chunks) to allow easy burning to CD/DVD.")
 (define-public libarchive
   (package
     (name "libarchive")
-    (replacement libarchive-3.3.2)
-    (version "3.3.1")
+    (version "3.3.2")
     (source
      (origin
        (method url-fetch)
        (uri (string-append "http://libarchive.org/downloads/libarchive-"
                            version ".tar.gz"))
+       (patches (search-patches "libarchive-CVE-2017-14166.patch"
+                                "libarchive-CVE-2017-14502.patch"))
        (sha256
         (base32
-         "1rr40hxlm9vy5z2zb5w7pyfkgd1a4s061qapm83s19accb8mpji9"))))
+         "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd"))))
     (build-system gnu-build-system)
     ;; TODO: Add -L/path/to/nettle in libarchive.pc.
     (inputs
@@ -211,26 +213,25 @@ backups (called chunks) to allow easy burning to CD/DVD.")
        ("xz" ,xz)))
     (arguments
      `(#:phases
-       (alist-cons-before
-        'build 'patch-pwd
-        (lambda _
-          (substitute* "Makefile"
-            (("/bin/pwd") (which "pwd"))))
-        (alist-replace
-         'check
-         (lambda _
-           ;; XXX: The test_owner_parse, test_read_disk, and
-           ;; test_write_disk_lookup tests expect user 'root' to exist, but
-           ;; the chroot's /etc/passwd doesn't have it.  Turn off those tests.
-           ;;
-           ;; The tests allow one to disable tests matching a globbing pattern.
-           (and (zero? (system* "make"
-                                "libarchive_test" "bsdcpio_test" "bsdtar_test"))
-                ;; XXX: This glob disables too much.
-                (zero? (system* "./libarchive_test" "^test_*_disk*"))
-                (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
-                (zero? (system* "./bsdtar_test"))))
-         %standard-phases))
+       (modify-phases %standard-phases
+         (add-before 'build 'patch-pwd
+           (lambda _
+             (substitute* "Makefile"
+               (("/bin/pwd") (which "pwd")))
+             #t))
+         (replace 'check
+           (lambda _
+             ;; XXX: The test_owner_parse, test_read_disk, and
+             ;; test_write_disk_lookup tests expect user 'root' to exist, but
+             ;; the chroot's /etc/passwd doesn't have it.  Turn off those tests.
+             ;;
+             ;; The tests allow one to disable tests matching a globbing pattern.
+             (and (zero? (system* "make"
+                                  "libarchive_test" "bsdcpio_test" "bsdtar_test"))
+                  ;; XXX: This glob disables too much.
+                  (zero? (system* "./libarchive_test" "^test_*_disk*"))
+                  (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
+                  (zero? (system* "./bsdtar_test"))))))
        ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
        ;; compiled with C99 or C11 or a gnu variant.
        #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
@@ -246,67 +247,47 @@ archive.  In particular, note that there is currently no built-in support for
 random access nor for in-place modification.")
     (license license:bsd-2)))
 
-(define libarchive-3.3.2
-  (package
-    (inherit libarchive)
-    (version "3.3.2")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://libarchive.org/downloads/libarchive-"
-                           version ".tar.gz"))
-       (patches (search-patches "libarchive-CVE-2017-14166.patch"
-                                "libarchive-CVE-2017-14502.patch"))
-       (sha256
-        (base32
-         "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd"))))))
-
 (define-public rdup
   (package
     (name "rdup")
-    (version "1.1.14")
+    (version "1.1.15")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
-                           version ".tar.bz2"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (uri (string-append "https://github.com/miekg/rdup/archive/"
+                           version ".tar.gz"))
        (sha256
         (base32
-         "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
-       (modules '((guix build utils)))
-       (snippet
-        ;; Some test scripts are missing shebangs, which cause "could not
-        ;; execute" errors.  Add shebangs.
-        '(for-each
-          (lambda (testscript)
-            (with-atomic-file-replacement
-                (string-append "testsuite/rdup/" testscript)
-              (lambda (in out)
-                (begin
-                  (format out "#!/bin/sh\n" )
-                  (dump-port in out)))))
-          '("rdup.hardlink.helper"
-            "rdup.hardlink-strip.helper"
-            "rdup.hardlink-strip2.helper"
-            "rdup.pipeline.helper")))))
+         "1jr91hgcf0rrpanqlwws72ql9db6d6grs2i122ki1s4bx0vqqyvq"))))
     (build-system gnu-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("pkg-config" ,pkg-config)
+
+       ;; For tests.
        ("dejagnu" ,dejagnu)))
     (inputs
      `(("glib" ,glib)
        ("pcre" ,pcre)
        ("libarchive" ,libarchive)
+       ("mcrypt" ,mcrypt)
        ("nettle" ,nettle)))
     (arguments
      `(#:parallel-build? #f             ;race conditions
        #:phases
        (modify-phases %standard-phases
-         (add-before 'build 'remove-Werror
-           ;; rdup uses a deprecated function from libarchive
-           (lambda _
-             (substitute* "GNUmakefile"
-               (("^(CFLAGS=.*)-Werror" _ front) front))
+         (add-before 'build 'qualify-inputs
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; This script is full of pitfalls.  Fix some that particularly
+             ;; affect Guix users & leave the rest as reader excercises.
+             (substitute* "rdup-simple"
+               ;; Use the input ‘mcrypt’, not whatever's in $PATH at run time.
+               (("([' ])mcrypt " all delimiter)
+                (string-append delimiter (which "mcrypt") " "))
+               ;; Avoid frivolous dependency on ‘which’ with a shell builtin.
+               (("which") "command -v"))
              #t))
          (add-before 'check 'pre-check
            (lambda _
@@ -314,7 +295,7 @@ random access nor for in-place modification.")
              (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
                (("/bin/cat") (which "cat")))
              #t)))))
-    (home-page "http://archive.miek.nl/projects/rdup/index.html")
+    (home-page "https://github.com/miekg/rdup")
     (synopsis "Provide a list of files to backup")
     (description
      "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
@@ -374,7 +355,7 @@ errors.")
     (arguments
      `(#:python ,python-2
        #:tests? #f))
-    (home-page "http://www.nongnu.org/rdiff-backup/")
+    (home-page "https://www.nongnu.org/rdiff-backup/")
     (synopsis "Local/remote mirroring+incremental backup")
     (description
      "Rdiff-backup backs up one directory to another, possibly over a network.
@@ -420,7 +401,7 @@ rdiff-backup is easy to use and settings have sensible defaults.")
        ("rsync" ,rsync)))
     (home-page "http://rsnapshot.org")
     (synopsis "Deduplicating snapshot backup utility based on rsync")
-    (description "rsnapshot is a filesystem snapshot utility based on rsync.
+    (description "rsnapshot is a file system snapshot utility based on rsync.
 rsnapshot makes it easy to make periodic snapshots of local machines, and
 remote machines over SSH.  To reduce the disk space required for each backup,
 rsnapshot uses hard links to deduplicate identical files.")
@@ -454,7 +435,7 @@ rsnapshot uses hard links to deduplicate identical files.")
        ("lzo" ,lzo)
        ("bzip2" ,bzip2)
        ("zlib" ,zlib)))
-    (home-page "http://nongnu.org/libchop/")
+    (home-page "https://nongnu.org/libchop/")
     (synopsis "Tools & library for data backup and distributed storage")
     (description
      "Libchop is a set of utilities and library for data backup and
@@ -484,7 +465,8 @@ detection, and lossless compression.")
            ;; Remove bundled shared libraries.
            (with-directory-excursion "src/borg/algorithms"
              (for-each delete-file-recursively
-                       (list "blake2" "lz4" "zstd")))))))
+                       (list "blake2" "lz4" "zstd")))
+           #t))))
     (build-system python-build-system)
     (arguments
      `(#:modules ((srfi srfi-26) ; for cut
@@ -553,9 +535,7 @@ 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.
-       ("python-pytest" ,python-pytest-3.0)
+       ("python-pytest" ,python-pytest)
        ;; For generating the documentation.
        ("python-sphinx" ,python-sphinx)
        ("python-guzzle-sphinx-theme" ,python-guzzle-sphinx-theme)))
@@ -565,7 +545,10 @@ detection, and lossless compression.")
        ("lz4" ,lz4)
        ("openssl" ,openssl)
        ("python-llfuse" ,python-llfuse)
-       ("python-msgpack" ,python-msgpack)
+       ;; The Python msgpack library changed its name so Borg requires this
+       ;; transitional package for now:
+       ;; <https://bugs.gnu.org/30662>
+       ("python-msgpack" ,python-msgpack-transitional)
        ("zstd" ,zstd)))
     (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
     (description "Borg is a deduplicating backup program.  Optionally, it
@@ -813,7 +796,7 @@ any special software, on top of SSH.")
     (synopsis "Fast, disk based, rotating network backup system")
     (description
      "With dirvish you can maintain a set of complete images of your
-filesystems with unattended creation and expiration.  A dirvish backup vault
+file systems with unattended creation and expiration.  A dirvish backup vault
 is like a time machine for your data. ")
     (license (license:fsf-free "file://COPYING"
                                "Open Software License 2.0"))))