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>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages backup)
23 #:use-module (guix packages)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module (guix build utils)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system python)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages acl)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages databases)
36 #:use-module (gnu packages dejagnu)
37 #:use-module (gnu packages ftp)
38 #:use-module (gnu packages glib)
39 #:use-module (gnu packages gnupg)
40 #:use-module (gnu packages gperf)
41 #:use-module (gnu packages guile)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages mcrypt)
44 #:use-module (gnu packages nettle)
45 #:use-module (gnu packages pcre)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages rsync)
49 #:use-module (gnu packages ssh)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages xml))
53 (define-public duplicity
60 (uri (string-append "https://code.launchpad.net/duplicity/"
61 (version-major+minor version)
62 "-series/" version "/+download/duplicity-"
66 "01zcq9cwn4pvj68rihgjvcdgccnxvz4jrba38sbv6nqz19cs2ixh"))))
67 (build-system python-build-system)
69 `(("util-linux" ,util-linux) ;setsid command, for the tests
70 ("par2cmdline" ,par2cmdline)
71 ("python-pexpect" ,python2-pexpect)
72 ("mock" ,python2-mock)))
74 `(("lockfile" ,python2-lockfile)
75 ("urllib3" ,python2-urllib3)))
77 `(("librsync" ,librsync)
79 ("gnupg" ,gnupg) ;gpg executable needed
80 ("util-linux" ,util-linux) ;for setsid
83 `(#:python ,python-2 ;setup assumes Python 2
86 (modify-phases %standard-phases
87 (add-before 'build 'patch-source
88 (lambda* (#:key inputs #:allow-other-keys)
89 ;; embed gpg store name
90 (substitute* "duplicity/gpginterface.py"
91 (("self.call = 'gpg'")
92 (string-append "self.call = '" (assoc-ref inputs "gnupg") "/bin/gpg'")))
93 (substitute* '("testing/functional/__init__.py"
94 "testing/overrides/bin/lftp")
95 (("/bin/sh") (which "sh")))
97 (add-before 'check 'check-setup
98 (lambda* (#:key inputs #:allow-other-keys)
99 (setenv "HOME" (getcwd)) ;gpg needs to write to $HOME
100 (setenv "TZDIR" ;some timestamp checks need TZDIR
101 (string-append (assoc-ref inputs "tzdata")
104 (home-page "http://duplicity.nongnu.org/index.html")
105 (synopsis "Encrypted backup using rsync algorithm")
107 "Duplicity backs up directories by producing encrypted tar-format volumes
108 and uploading them to a remote or local file server. Because duplicity uses
109 librsync, the incremental archives are space efficient and only record the
110 parts of files that have changed since the last backup. Because duplicity
111 uses GnuPG to encrypt and/or sign these archives, they will be safe from
112 spying and/or modification by the server.")
113 (license license:gpl2+)))
115 (define-public par2cmdline
121 (uri (string-append "https://github.com/Parchive/par2cmdline/archive/v"
123 (file-name (string-append name "-" version ".tar.gz"))
126 "0ykfb7ar0x0flfdgf6i8xphyv5b93dalbjj2jb6hx7sdjax33n1g"))
127 ;; This test merely needs a file to test recovery on, but
128 ;; /dev/random is essentially /dev/urandom plus minimum entropy
129 ;; locking, making the test hang indefinitely. This change is
130 ;; already upstream: remove on upgrade to future 0.6.15.
131 ;; https://github.com/Parchive/par2cmdline/commit/27723a678f780da82c79b98592592009c779a4fb
132 (modules '((guix build utils)))
134 '(substitute* "tests/test20" (("if=/dev/random") "if=/dev/urandom")))))
136 `(("automake" ,automake)
137 ("autoconf" ,autoconf)))
138 (build-system gnu-build-system)
141 (modify-phases %standard-phases
142 (add-after 'unpack 'autoreconf
143 (lambda _ (zero? (system* "autoreconf" "-vfi")))))))
144 (synopsis "File verification and repair tool")
145 (description "Par2cmdline is a tool for generating RAID-like PAR2 recovery
146 files using Reed-Solomon coding. PAR2 files can be stored along side backups
147 or distributed files for recovering from bitrot.")
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
191 (uri (string-append "http://libarchive.org/downloads/libarchive-"
193 (patches (search-patches
194 "libarchive-7zip-heap-overflow.patch"
195 "libarchive-fix-symlink-check.patch"
196 "libarchive-fix-filesystem-attacks.patch"
197 "libarchive-safe_fprintf-buffer-overflow.patch"))
200 "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj"))))
201 (build-system gnu-build-system)
202 ;; TODO: Add -L/path/to/nettle in libarchive.pc.
215 (substitute* "Makefile"
216 (("/bin/pwd") (which "pwd"))))
220 ;; XXX: The test_owner_parse, test_read_disk, and
221 ;; test_write_disk_lookup tests expect user 'root' to exist, but
222 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
224 ;; The tests allow one to disable tests matching a globbing pattern.
225 (and (zero? (system* "make"
226 "libarchive_test" "bsdcpio_test" "bsdtar_test"))
227 ;; XXX: This glob disables too much.
228 (zero? (system* "./libarchive_test" "^test_*_disk*"))
229 (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
230 (zero? (system* "./bsdtar_test"))))
232 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
233 ;; compiled with C99 or C11 or a gnu variant.
234 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
235 (home-page "http://libarchive.org/")
236 (synopsis "Multi-format archive and compression library")
238 "Libarchive provides a flexible interface for reading and writing
239 archives in various formats such as tar and cpio. Libarchive also supports
240 reading and writing archives compressed using various compression filters such
241 as gzip and bzip2. The library is inherently stream-oriented; readers
242 serially iterate through the archive, writers serially add things to the
243 archive. In particular, note that there is currently no built-in support for
244 random access nor for in-place modification.")
245 (license license:bsd-2)))
254 (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
258 "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
259 (modules '((guix build utils)))
261 ;; Some test scripts are missing shebangs, which cause "could not
262 ;; execute" errors. Add shebangs.
265 (with-atomic-file-replacement
266 (string-append "testsuite/rdup/" testscript)
269 (format out "#!/bin/sh\n" )
270 (dump-port in out)))))
271 '("rdup.hardlink.helper"
272 "rdup.hardlink-strip.helper"
273 "rdup.hardlink-strip2.helper"
274 "rdup.pipeline.helper")))))
275 (build-system gnu-build-system)
277 `(("pkg-config" ,pkg-config)
278 ("dejagnu" ,dejagnu)))
282 ("libarchive" ,libarchive)
285 `(#:parallel-build? #f ;race conditions
286 #:phases (alist-cons-before
287 'build 'remove-Werror
288 ;; rdup uses a deprecated function from libarchive
290 (substitute* "GNUmakefile"
291 (("^(CFLAGS=.*)-Werror" _ front) front)))
295 (setenv "HOME" (getcwd))
296 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
297 (("/bin/cat") (which "cat"))))
300 (home-page "http://archive.miek.nl/projects/rdup/index.html")
301 (synopsis "Provide a list of files to backup")
303 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
304 Rdup itself does not backup anything, it only print a list of absolute
305 file names to standard output. Auxiliary scripts are needed that act on this
306 list and implement the backup strategy.")
307 (license license:gpl3+)))
316 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
317 "btar-" version ".tar.gz"))
320 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
321 (build-system gnu-build-system)
323 `(("librsync" ,librsync)))
325 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
327 #:tests? #f ;test input not distributed
330 'configure ;no configure phase
332 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
333 (synopsis "Tar-compatible archiver")
335 "Btar is a tar-compatible archiver which allows arbitrary compression and
336 ciphering, redundancy, differential backup, indexed extraction, multicore
337 compression, input and output serialisation, and tolerance to partial archive
339 (license license:gpl3+)))
341 (define-public rdiff-backup
343 (name "rdiff-backup")
348 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
352 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
353 (build-system python-build-system)
355 `(("python" ,python-2)
356 ("librsync" ,librsync)))
360 (home-page "http://www.nongnu.org/rdiff-backup/")
361 (synopsis "Local/remote mirroring+incremental backup")
363 "Rdiff-backup backs up one directory to another, possibly over a network.
364 The target directory ends up a copy of the source directory, but extra reverse
365 diffs are stored in a special subdirectory of that target directory, so you
366 can still recover files lost some time ago. The idea is to combine the best
367 features of a mirror and an incremental backup. Rdiff-backup also preserves
368 subdirectories, hard links, dev files, permissions, uid/gid ownership,
369 modification times, extended attributes, acls, and resource forks. Also,
370 rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
371 rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
372 to a remote location, and only the differences will be transmitted. Finally,
373 rdiff-backup is easy to use and settings have sensible defaults.")
374 (license license:gpl2+)))
376 (define-public libchop
382 (uri (string-append "mirror://savannah/libchop/libchop-"
386 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
387 (patches (search-patches "diffutils-gets-undeclared.patch"))))
388 (build-system gnu-build-system)
390 `(("guile" ,guile-2.0)
392 ("pkg-config" ,pkg-config)))
394 `(("guile" ,guile-2.0)
395 ("util-linux" ,util-linux)
400 ("libgcrypt" ,libgcrypt)
404 (home-page "http://nongnu.org/libchop/")
405 (synopsis "Tools & library for data backup and distributed storage")
407 "Libchop is a set of utilities and library for data backup and
408 distributed storage. Its main application is @command{chop-backup}, an
409 encrypted backup program that supports data integrity checks, versioning,
410 distribution among several sites, selective sharing of stored data, adaptive
411 compression, and more. The library itself implements storage techniques such
412 as content-addressable storage, content hash keys, Merkle trees, similarity
413 detection, and lossless compression.")
414 (license license:gpl3+)))
422 (uri (pypi-uri "borgbackup" version))
425 "1sarmpzwr8dhbg0hsvaclcsjfax36ssb32d9klhhah4j8kqji3wp"))
426 (modules '((guix build utils)))
429 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
430 (build-system python-build-system)
432 `(#:modules ((srfi srfi-26) ; for cut
434 (guix build python-build-system))
436 (modify-phases %standard-phases
437 (add-after 'unpack 'set-env
438 (lambda* (#:key inputs #:allow-other-keys)
439 (let ((openssl (assoc-ref inputs "openssl"))
440 (lz4 (assoc-ref inputs "lz4")))
441 (setenv "BORG_OPENSSL_PREFIX" openssl)
442 (setenv "BORG_LZ4_PREFIX" lz4)
443 (setenv "PYTHON_EGG_CACHE" "/tmp")
444 ;; The test 'test_return_codes[python]' fails when
445 ;; HOME=/homeless-shelter.
446 (setenv "HOME" "/tmp")
448 ;; The tests need to be run after Borg is installed.
450 (add-after 'install 'check
451 (lambda* (#:key inputs outputs #:allow-other-keys)
452 ;; Make the installed package available for the test suite.
453 (add-installed-pythonpath inputs outputs)
454 ;; The tests should be run in an empty directory.
456 (with-directory-excursion "tests"
458 (system* "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
460 ;; These tests need to write to '/var'.
461 "not test_get_cache_dir "
462 "and not test_get_keys_dir "
463 "and not test_get_security_dir "
464 ;; These tests assume there is a root user in
466 "and not test_access_acl "
467 "and not test_default_acl "
468 "and not test_non_ascii_acl "
469 ;; This test needs the unpackaged pytest-benchmark.
471 ;; These tests assume the kernel supports FUSE.
473 "and not test_fuse_allow_damaged_files"))))))
474 (add-after 'install 'install-doc
475 (lambda* (#:key outputs #:allow-other-keys)
476 (let* ((out (assoc-ref outputs "out"))
477 (man (string-append out "/share/man/man1"))
478 (misc (string-append out "/share/borg/misc")))
479 (for-each (cut install-file <> misc)
480 '("docs/misc/create_chunker-params.txt"
481 "docs/misc/internals-picture.txt"
482 "docs/misc/prune-example.txt"))
484 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
485 (zero? (system* "make" "-C" "docs" "man"))
487 (install-file "docs/_build/man/borg.1" man)
490 `(("python-cython" ,python-cython)
491 ("python-setuptools-scm" ,python-setuptools-scm)
492 ;; Borg 1.0.8's test suite uses 'tmpdir_factory', which was introduced in
494 ("python-pytest" ,python-pytest-2.9.2)
495 ;; For generating the documentation.
496 ("python-sphinx" ,python-sphinx)
497 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
502 ("python-llfuse" ,python-llfuse)
503 ("python-msgpack" ,python-msgpack)))
504 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
505 (description "Borg is a deduplicating backup program. Optionally, it
506 supports compression and authenticated encryption. The main goal of Borg is to
507 provide an efficient and secure way to backup data. The data deduplication
508 technique used makes Borg suitable for daily backups since only changes are
509 stored. The authenticated encryption technique makes it suitable for backups
510 to not fully trusted targets. Borg is a fork of Attic.")
511 (home-page "https://borgbackup.github.io/borgbackup/")
512 (license license:bsd-3)))
521 "https://pypi.python.org/packages/source/A/Attic/Attic-"
525 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
526 (build-system python-build-system)
528 `(;; The tests assume they are run as root:
529 ;; https://github.com/jborg/attic/issues/7
532 (modify-phases %standard-phases
534 'build 'set-openssl-prefix
535 (lambda* (#:key inputs #:allow-other-keys)
536 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
541 ("python-msgpack" ,python-msgpack)
543 ;; Attic is probably incompatible with llfuse > 0.41.
544 ;; These links are to discussions of llfuse compatibility from
545 ;; the borg project. Borg is a recent fork of attic, and attic
546 ;; has not been updated since the fork, so it's likely that
547 ;; llfuse compatibility requirements are still the same.
548 ;; https://github.com/borgbackup/borg/issues/642
549 ;; https://github.com/borgbackup/borg/issues/643
550 ("python-llfuse" ,python-llfuse-0.41)))
551 (synopsis "Deduplicating backup program")
552 (description "Attic is a deduplicating backup program. The main goal of
553 Attic is to provide an efficient and secure way to backup data. The data
554 deduplication technique used makes Attic suitable for daily backups since only
555 changes are stored.")
556 (home-page "https://attic-backup.org/")
557 (license license:bsd-3)
558 (properties `((superseded . ,borg)))))
560 (define-public wimlib
566 (uri (string-append "https://wimlib.net/downloads/"
567 name "-" version ".tar.gz"))
570 "0mbz03smlc054i2m9q2sbqymml9m897kfs84q7g81i26y811p6wq"))))
571 (build-system gnu-build-system)
573 `(("pkg-config" ,pkg-config)))
578 ("openssl" ,openssl)))
580 `(#:configure-flags (list "--enable-test-support")))
581 (home-page "https://wimlib.net/")
582 (synopsis "WIM file manipulation library and utilities")
583 (description "wimlib is a C library and set of command-line utilities for
584 creating, modifying, extracting, and mounting archives in the Windows Imaging
585 Format (@dfn{WIM files}). It can capture and apply WIMs directly from and to
586 NTFS volumes using @code{ntfs-3g}, preserving NTFS-specific attributes.")
587 ;; wimlib is dual-licenced under version 3 or later of either the GPL or
588 ;; LGPL, except those files explicitly marked as being released into the
589 ;; public domain (CC0) in their headers.
590 (license (list license:gpl3+