1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
4 ;;; Copyright © 2015, 2016 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
7 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
8 ;;; Copyright © 2017 Kei Kebreau <kei@openmailbox.org>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages backup)
26 #:use-module (guix packages)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages acl)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages dejagnu)
39 #:use-module (gnu packages ftp)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnupg)
42 #:use-module (gnu packages gperf)
43 #:use-module (gnu packages guile)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages mcrypt)
46 #:use-module (gnu packages nettle)
47 #:use-module (gnu packages pcre)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages rsync)
52 #:use-module (gnu packages ssh)
53 #:use-module (gnu packages tls)
54 #:use-module (gnu packages xml))
56 (define-public duplicity
63 (uri (string-append "https://code.launchpad.net/duplicity/"
64 (version-major+minor version)
65 "-series/" version "/+download/duplicity-"
69 "1rhgrz2lm9vbfdp2raykrih1c6n2lw5jd572z4dsz488m52avjqi"))))
70 (build-system python-build-system)
72 `(("util-linux" ,util-linux) ;setsid command, for the tests
73 ("par2cmdline" ,par2cmdline)
74 ("python-pexpect" ,python2-pexpect)
75 ("mock" ,python2-mock)))
77 `(("lockfile" ,python2-lockfile)
78 ("urllib3" ,python2-urllib3)))
80 `(("librsync" ,librsync)
82 ("gnupg" ,gnupg) ;gpg executable needed
83 ("util-linux" ,util-linux) ;for setsid
86 `(#:python ,python-2 ;setup assumes Python 2
89 (modify-phases %standard-phases
90 (add-before 'build 'patch-source
91 (lambda* (#:key inputs #:allow-other-keys)
92 ;; embed gpg store name
93 (substitute* "duplicity/gpginterface.py"
94 (("self.call = 'gpg'")
95 (string-append "self.call = '" (assoc-ref inputs "gnupg") "/bin/gpg'")))
96 (substitute* '("testing/functional/__init__.py"
97 "testing/overrides/bin/lftp")
98 (("/bin/sh") (which "sh")))
100 (add-before 'check 'check-setup
101 (lambda* (#:key inputs #:allow-other-keys)
102 (setenv "HOME" (getcwd)) ;gpg needs to write to $HOME
103 (setenv "TZDIR" ;some timestamp checks need TZDIR
104 (string-append (assoc-ref inputs "tzdata")
107 (home-page "http://duplicity.nongnu.org/index.html")
108 (synopsis "Encrypted backup using rsync algorithm")
110 "Duplicity backs up directories by producing encrypted tar-format volumes
111 and uploading them to a remote or local file server. Because duplicity uses
112 librsync, the incremental archives are space efficient and only record the
113 parts of files that have changed since the last backup. Because duplicity
114 uses GnuPG to encrypt and/or sign these archives, they will be safe from
115 spying and/or modification by the server.")
116 (license license:gpl2+)))
118 (define-public par2cmdline
124 (uri (string-append "https://github.com/Parchive/par2cmdline/archive/v"
126 (file-name (string-append name "-" version ".tar.gz"))
129 "0dqwarc2aw5clgpf24d9dxh43b0k0z3l6kksn30arx9bdlmrk5rx"))))
131 `(("automake" ,automake)
132 ("autoconf" ,autoconf)))
133 (build-system gnu-build-system)
136 (modify-phases %standard-phases
137 (add-after 'unpack 'autoreconf
138 (lambda _ (zero? (system* "autoreconf" "-vfi")))))))
139 (synopsis "File verification and repair tools")
140 (description "Par2cmdline uses Reed-Solomon error-correcting codes to
141 generate and verify PAR2 recovery files. These files can be distributed
142 alongside the source files or stored together with back-ups to protect against
143 transmission errors or @dfn{bit rot}, the degradation of storage media over
145 Unlike a simple checksum, PAR2 doesn't merely detect errors: as long as the
146 damage isn't too extensive (and smaller than the size of the recovery file), it
147 can even repair them.")
148 (home-page "https://github.com/Parchive/par2cmdline")
149 (license license:gpl3+)))
158 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
161 "02bnczg01cyhajmm4rhbnc0ja0dd9ikv9fwv28asxh1rlx9yr0b7"))))
162 (build-system gnu-build-system)
163 (native-inputs `(("pkg-config" ,pkg-config)))
173 `(,(string-append "--sbindir=" (assoc-ref %outputs "out") "/bin"))
175 (home-page "http://archive.miek.nl/projects/hdup/index.html")
176 (synopsis "Simple incremental backup tool")
178 "Hdup2 is a backup utility, its aim is to make backup really simple. The
179 backup scheduling is done by means of a cron job. It supports an
180 include/exclude mechanism, remote backups, encrypted backups and split
181 backups (called chunks) to allow easy burning to CD/DVD.")
182 (license license:gpl2)))
184 (define-public libarchive
187 (replacement libarchive-3.3.1)
192 (uri (string-append "http://libarchive.org/downloads/libarchive-"
196 "03q6y428rg723c9fj1vidzjw46w1vf8z0h95lkvz1l9jw571j739"))))
197 (build-system gnu-build-system)
198 ;; TODO: Add -L/path/to/nettle in libarchive.pc.
211 (substitute* "Makefile"
212 (("/bin/pwd") (which "pwd"))))
216 ;; XXX: The test_owner_parse, test_read_disk, and
217 ;; test_write_disk_lookup tests expect user 'root' to exist, but
218 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
220 ;; The tests allow one to disable tests matching a globbing pattern.
221 (and (zero? (system* "make"
222 "libarchive_test" "bsdcpio_test" "bsdtar_test"))
223 ;; XXX: This glob disables too much.
224 (zero? (system* "./libarchive_test" "^test_*_disk*"))
225 (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
226 (zero? (system* "./bsdtar_test"))))
228 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
229 ;; compiled with C99 or C11 or a gnu variant.
230 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
231 (home-page "http://libarchive.org/")
232 (synopsis "Multi-format archive and compression library")
234 "Libarchive provides a flexible interface for reading and writing
235 archives in various formats such as tar and cpio. Libarchive also supports
236 reading and writing archives compressed using various compression filters such
237 as gzip and bzip2. The library is inherently stream-oriented; readers
238 serially iterate through the archive, writers serially add things to the
239 archive. In particular, note that there is currently no built-in support for
240 random access nor for in-place modification.")
241 (license license:bsd-2)))
243 (define libarchive-3.3.1
251 (uri (string-append "http://libarchive.org/downloads/libarchive-"
255 "1rr40hxlm9vy5z2zb5w7pyfkgd1a4s061qapm83s19accb8mpji9"))))))
264 (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
268 "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
269 (modules '((guix build utils)))
271 ;; Some test scripts are missing shebangs, which cause "could not
272 ;; execute" errors. Add shebangs.
275 (with-atomic-file-replacement
276 (string-append "testsuite/rdup/" testscript)
279 (format out "#!/bin/sh\n" )
280 (dump-port in out)))))
281 '("rdup.hardlink.helper"
282 "rdup.hardlink-strip.helper"
283 "rdup.hardlink-strip2.helper"
284 "rdup.pipeline.helper")))))
285 (build-system gnu-build-system)
287 `(("pkg-config" ,pkg-config)
288 ("dejagnu" ,dejagnu)))
292 ("libarchive" ,libarchive)
295 `(#:parallel-build? #f ;race conditions
296 #:phases (alist-cons-before
297 'build 'remove-Werror
298 ;; rdup uses a deprecated function from libarchive
300 (substitute* "GNUmakefile"
301 (("^(CFLAGS=.*)-Werror" _ front) front)))
305 (setenv "HOME" (getcwd))
306 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
307 (("/bin/cat") (which "cat"))))
310 (home-page "http://archive.miek.nl/projects/rdup/index.html")
311 (synopsis "Provide a list of files to backup")
313 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
314 Rdup itself does not backup anything, it only print a list of absolute
315 file names to standard output. Auxiliary scripts are needed that act on this
316 list and implement the backup strategy.")
317 (license license:gpl3+)))
326 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
327 "btar-" version ".tar.gz"))
330 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
331 (build-system gnu-build-system)
333 `(("librsync" ,librsync)))
335 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
337 #:tests? #f ;test input not distributed
340 'configure ;no configure phase
342 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
343 (synopsis "Tar-compatible archiver")
345 "Btar is a tar-compatible archiver which allows arbitrary compression and
346 ciphering, redundancy, differential backup, indexed extraction, multicore
347 compression, input and output serialisation, and tolerance to partial archive
349 (license license:gpl3+)))
351 (define-public rdiff-backup
353 (name "rdiff-backup")
358 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
362 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
363 (build-system python-build-system)
365 `(("python" ,python-2)
366 ("librsync" ,librsync)))
370 (home-page "http://www.nongnu.org/rdiff-backup/")
371 (synopsis "Local/remote mirroring+incremental backup")
373 "Rdiff-backup backs up one directory to another, possibly over a network.
374 The target directory ends up a copy of the source directory, but extra reverse
375 diffs are stored in a special subdirectory of that target directory, so you
376 can still recover files lost some time ago. The idea is to combine the best
377 features of a mirror and an incremental backup. Rdiff-backup also preserves
378 subdirectories, hard links, dev files, permissions, uid/gid ownership,
379 modification times, extended attributes, acls, and resource forks. Also,
380 rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
381 rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
382 to a remote location, and only the differences will be transmitted. Finally,
383 rdiff-backup is easy to use and settings have sensible defaults.")
384 (license license:gpl2+)))
386 (define-public rsnapshot
394 "https://github.com/rsnapshot/rsnapshot/releases/download/"
395 version "/rsnapshot-" version ".tar.gz"))
398 "05jfy99a0xs6lvsjfp3wz21z0myqhmwl2grn3jr9clijbg282ah4"))))
399 (build-system gnu-build-system)
402 (modify-phases %standard-phases
405 (substitute* '("t/cmd-post_pre-exec/conf/pre-true-post-true.conf"
406 "t/backup_exec/conf/backup_exec_fail.conf"
407 "t/backup_exec/conf/backup_exec.conf")
408 (("/bin/true") (which "true"))
409 (("/bin/false") (which "false")))
410 (zero? (system* "make" "test")))))))
414 (home-page "http://rsnapshot.org")
415 (synopsis "Deduplicating snapshot backup utility based on rsync")
416 (description "rsnapshot is a filesystem snapshot utility based on rsync.
417 rsnapshot makes it easy to make periodic snapshots of local machines, and
418 remote machines over SSH. To reduce the disk space required for each backup,
419 rsnapshot uses hard links to deduplicate identical files.")
420 (license license:gpl2+)))
422 (define-public libchop
428 (uri (string-append "mirror://savannah/libchop/libchop-"
432 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
433 (patches (search-patches "diffutils-gets-undeclared.patch"))))
434 (build-system gnu-build-system)
436 `(("guile" ,guile-2.0)
438 ("pkg-config" ,pkg-config)))
440 `(("guile" ,guile-2.0)
441 ("util-linux" ,util-linux)
446 ("libgcrypt" ,libgcrypt)
450 (home-page "http://nongnu.org/libchop/")
451 (synopsis "Tools & library for data backup and distributed storage")
453 "Libchop is a set of utilities and library for data backup and
454 distributed storage. Its main application is @command{chop-backup}, an
455 encrypted backup program that supports data integrity checks, versioning,
456 distribution among several sites, selective sharing of stored data, adaptive
457 compression, and more. The library itself implements storage techniques such
458 as content-addressable storage, content hash keys, Merkle trees, similarity
459 detection, and lossless compression.")
460 (license license:gpl3+)))
468 (uri (pypi-uri "borgbackup" version))
471 "1sarmpzwr8dhbg0hsvaclcsjfax36ssb32d9klhhah4j8kqji3wp"))
472 (modules '((guix build utils)))
475 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
476 (build-system python-build-system)
478 `(#:modules ((srfi srfi-26) ; for cut
480 (guix build python-build-system))
482 (modify-phases %standard-phases
483 (add-after 'unpack 'set-env
484 (lambda* (#:key inputs #:allow-other-keys)
485 (let ((openssl (assoc-ref inputs "openssl"))
486 (lz4 (assoc-ref inputs "lz4")))
487 (setenv "BORG_OPENSSL_PREFIX" openssl)
488 (setenv "BORG_LZ4_PREFIX" lz4)
489 (setenv "PYTHON_EGG_CACHE" "/tmp")
490 ;; The test 'test_return_codes[python]' fails when
491 ;; HOME=/homeless-shelter.
492 (setenv "HOME" "/tmp")
494 ;; The tests need to be run after Borg is installed.
496 (add-after 'install 'check
497 (lambda* (#:key inputs outputs #:allow-other-keys)
498 ;; Make the installed package available for the test suite.
499 (add-installed-pythonpath inputs outputs)
500 ;; The tests should be run in an empty directory.
502 (with-directory-excursion "tests"
504 (system* "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
506 ;; These tests need to write to '/var'.
507 "not test_get_cache_dir "
508 "and not test_get_keys_dir "
509 "and not test_get_security_dir "
510 ;; These tests assume there is a root user in
512 "and not test_access_acl "
513 "and not test_default_acl "
514 "and not test_non_ascii_acl "
515 ;; This test needs the unpackaged pytest-benchmark.
517 ;; These tests assume the kernel supports FUSE.
519 "and not test_fuse_allow_damaged_files"))))))
520 (add-after 'install 'install-doc
521 (lambda* (#:key outputs #:allow-other-keys)
522 (let* ((out (assoc-ref outputs "out"))
523 (man (string-append out "/share/man/man1"))
524 (misc (string-append out "/share/borg/misc")))
525 (for-each (cut install-file <> misc)
526 '("docs/misc/create_chunker-params.txt"
527 "docs/misc/internals-picture.txt"
528 "docs/misc/prune-example.txt"))
530 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
531 (zero? (system* "make" "-C" "docs" "man"))
533 (install-file "docs/_build/man/borg.1" man)
536 `(("python-cython" ,python-cython)
537 ("python-setuptools-scm" ,python-setuptools-scm)
538 ;; Borg 1.0.8's test suite uses 'tmpdir_factory', which was introduced in
540 ("python-pytest" ,python-pytest-3.0)
541 ;; For generating the documentation.
542 ("python-sphinx" ,python-sphinx)
543 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
548 ("python-llfuse" ,python-llfuse)
549 ("python-msgpack" ,python-msgpack)))
550 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
551 (description "Borg is a deduplicating backup program. Optionally, it
552 supports compression and authenticated encryption. The main goal of Borg is to
553 provide an efficient and secure way to backup data. The data deduplication
554 technique used makes Borg suitable for daily backups since only changes are
555 stored. The authenticated encryption technique makes it suitable for backups
556 to not fully trusted targets. Borg is a fork of Attic.")
557 (home-page "https://borgbackup.github.io/borgbackup/")
558 (license license:bsd-3)))
567 "https://pypi.python.org/packages/source/A/Attic/Attic-"
571 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
572 (build-system python-build-system)
574 `(;; The tests assume they are run as root:
575 ;; https://github.com/jborg/attic/issues/7
578 (modify-phases %standard-phases
580 'build 'set-openssl-prefix
581 (lambda* (#:key inputs #:allow-other-keys)
582 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
587 ("python-msgpack" ,python-msgpack)
589 ;; Attic is probably incompatible with llfuse > 0.41.
590 ;; These links are to discussions of llfuse compatibility from
591 ;; the borg project. Borg is a recent fork of attic, and attic
592 ;; has not been updated since the fork, so it's likely that
593 ;; llfuse compatibility requirements are still the same.
594 ;; https://github.com/borgbackup/borg/issues/642
595 ;; https://github.com/borgbackup/borg/issues/643
596 ("python-llfuse" ,python-llfuse-0.41)))
597 (synopsis "Deduplicating backup program")
598 (description "Attic is a deduplicating backup program. The main goal of
599 Attic is to provide an efficient and secure way to backup data. The data
600 deduplication technique used makes Attic suitable for daily backups since only
601 changes are stored.")
602 (home-page "https://attic-backup.org/")
603 (license license:bsd-3)
604 (properties `((superseded . ,borg)))))
606 (define-public wimlib
612 (uri (string-append "https://wimlib.net/downloads/"
613 name "-" version ".tar.gz"))
616 "0mbz03smlc054i2m9q2sbqymml9m897kfs84q7g81i26y811p6wq"))))
617 (build-system gnu-build-system)
619 `(("pkg-config" ,pkg-config)))
624 ("openssl" ,openssl)))
626 `(#:configure-flags (list "--enable-test-support")))
627 (home-page "https://wimlib.net/")
628 (synopsis "WIM file manipulation library and utilities")
629 (description "wimlib is a C library and set of command-line utilities for
630 creating, modifying, extracting, and mounting archives in the Windows Imaging
631 Format (@dfn{WIM files}). It can capture and apply WIMs directly from and to
632 NTFS volumes using @code{ntfs-3g}, preserving NTFS-specific attributes.")
633 ;; wimlib is dual-licenced under version 3 or later of either the GPL or
634 ;; LGPL, except those files explicitly marked as being released into the
635 ;; public domain (CC0) in their headers.
636 (license (list license:gpl3+
648 "http://code.liw.fi/debian/pool/main/o/obnam/obnam_"
649 version ".orig.tar.xz"))
652 "0qlipsq50hca71zc0dp1mg9zs12qm0sbblw7qfzl0hj6mk2rv1by"))))
653 (build-system python-build-system)
657 (modify-phases %standard-phases
660 (substitute* "obnamlib/vfs_local_tests.py"
661 ;; Check for the nobody user instead of root
662 (("self.fs.get_username\\(0\\), 'root'")
663 "self.fs.get_username(65534), 'nobody'")
664 ;; Disable tests checking for root group
665 (("self.fs.get_groupname\\(0\\)") "'root'"))
666 (substitute* "obnamlib/vfs_local.py"
667 ;; Don't cover get_groupname function
668 (("def get_groupname\\(self, gid\\):")
669 "def get_groupname(self, gid): # pragma: no cover"))
670 ;; Can't run network tests
671 (zero? (system* "./check" "--unit-tests")))))))
673 `(("python2-cliapp" ,python2-cliapp)
674 ("python2-larch" ,python2-larch)
675 ("python2-paramiko" ,python2-paramiko)
676 ("python2-pyaml" ,python2-pyaml)
677 ("python2-tracing" ,python2-tracing)
678 ("python2-ttystatus" ,python2-ttystatus)))
681 ("python2-coverage" ,python2-coverage)
682 ("python2-coverage-test-runner" ,python2-coverage-test-runner)
683 ("python2-pep8" ,python2-pep8)
684 ("python2-pylint" ,python2-pylint)))
685 (home-page "https://obnam.org/")
686 (synopsis "Easy and secure backup program")
687 (description "Obnam is an easy, secure backup program. Features
688 include snapshot backups, data de-duplication and encrypted backups
689 using GnuPG. Backups can be stored on local hard disks, or online via
690 the SSH SFTP protocol. The backup server, if used, does not require
691 any special software, on top of SSH.")
692 (license license:gpl3+)))