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>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages backup)
22 #:use-module (guix packages)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix download)
25 #:use-module (guix utils)
26 #:use-module (guix build utils)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system python)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages acl)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages dejagnu)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages gnupg)
38 #:use-module (gnu packages gperf)
39 #:use-module (gnu packages guile)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages mcrypt)
42 #:use-module (gnu packages nettle)
43 #:use-module (gnu packages pcre)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages rsync)
47 #:use-module (gnu packages ssh)
48 #:use-module (gnu packages tls)
49 #:use-module (gnu packages xml))
51 (define-public duplicity
58 (uri (string-append "https://code.launchpad.net/duplicity/"
59 (version-major+minor version)
60 "-series/" version "/+download/duplicity-"
64 "0jh79syhr8n3l81jxlwsmwm1pklb4d923m2lgqbswyavh1fqmvwb"))
65 (patches (search-patches "duplicity-piped-password.patch"
66 "duplicity-test_selection-tmp.patch"))))
67 (build-system python-build-system)
69 `(("util-linux" ,util-linux))) ;setsid command, for the tests
71 `(("python" ,python-2)
72 ("librsync" ,librsync)
73 ("mock" ,python2-mock) ;for testing
74 ("lockfile" ,python2-lockfile)
75 ("gnupg" ,gnupg-1) ;gpg executable needed
76 ("util-linux" ,util-linux) ;for setsid
79 `(#:python ,python-2 ;setup assumes Python 2
82 (modify-phases %standard-phases
83 (add-before 'check 'check-setup
84 (lambda* (#:key inputs #:allow-other-keys)
85 (substitute* "testing/functional/__init__.py"
86 (("/bin/sh") (which "sh")))
87 (setenv "HOME" (getcwd)) ;gpg needs to write to $HOME
88 (setenv "TZDIR" ;some timestamp checks need TZDIR
89 (string-append (assoc-ref inputs "tzdata")
92 (home-page "http://duplicity.nongnu.org/index.html")
93 (synopsis "Encrypted backup using rsync algorithm")
95 "Duplicity backs up directories by producing encrypted tar-format volumes
96 and uploading them to a remote or local file server. Because duplicity uses
97 librsync, the incremental archives are space efficient and only record the
98 parts of files that have changed since the last backup. Because duplicity
99 uses GnuPG to encrypt and/or sign these archives, they will be safe from
100 spying and/or modification by the server.")
101 (license license:gpl2+)))
103 (define-public par2cmdline
109 (uri (string-append "https://github.com/Parchive/par2cmdline/archive/v"
111 (file-name (string-append name "-" version ".tar.gz"))
114 "0ykfb7ar0x0flfdgf6i8xphyv5b93dalbjj2jb6hx7sdjax33n1g"))
115 ;; This test merely needs a file to test recovery on, but
116 ;; /dev/random is essentially /dev/urandom plus minimum entropy
117 ;; locking, making the test hang indefinitely. This change is
118 ;; already upstream: remove on upgrade to future 0.6.15.
119 ;; https://github.com/Parchive/par2cmdline/commit/27723a678f780da82c79b98592592009c779a4fb
120 (modules '((guix build utils)))
122 '(substitute* "tests/test20" (("if=/dev/random") "if=/dev/urandom")))))
124 `(("automake" ,automake)
125 ("autoconf" ,autoconf)))
126 (build-system gnu-build-system)
129 (modify-phases %standard-phases
130 (add-after 'unpack 'autoreconf
131 (lambda _ (zero? (system* "autoreconf" "-vfi")))))))
132 (synopsis "File verification and repair tool")
133 (description "Par2cmdline is a tool for generating RAID-like PAR2 recovery
134 files using Reed-Solomon coding. PAR2 files can be stored along side backups
135 or distributed files for recovering from bitrot.")
136 (home-page "https://github.com/Parchive/par2cmdline")
137 (license license:gpl3+)))
146 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
149 "02bnczg01cyhajmm4rhbnc0ja0dd9ikv9fwv28asxh1rlx9yr0b7"))))
150 (build-system gnu-build-system)
151 (native-inputs `(("pkg-config" ,pkg-config)))
161 `(,(string-append "--sbindir=" (assoc-ref %outputs "out") "/bin"))
163 (home-page "http://archive.miek.nl/projects/hdup/index.html")
164 (synopsis "Simple incremental backup tool")
166 "Hdup2 is a backup utility, its aim is to make backup really simple. The
167 backup scheduling is done by means of a cron job. It supports an
168 include/exclude mechanism, remote backups, encrypted backups and split
169 backups (called chunks) to allow easy burning to CD/DVD.")
170 (license license:gpl2)))
172 (define-public libarchive
179 (uri (string-append "http://libarchive.org/downloads/libarchive-"
181 (patches (search-patches
182 "libarchive-7zip-heap-overflow.patch"
183 "libarchive-fix-symlink-check.patch"
184 "libarchive-fix-filesystem-attacks.patch"
185 "libarchive-safe_fprintf-buffer-overflow.patch"))
188 "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj"))))
189 (build-system gnu-build-system)
190 ;; TODO: Add -L/path/to/nettle in libarchive.pc.
203 (substitute* "Makefile"
204 (("/bin/pwd") (which "pwd"))))
208 ;; XXX: The test_owner_parse, test_read_disk, and
209 ;; test_write_disk_lookup tests expect user 'root' to exist, but
210 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
212 ;; The tests allow one to disable tests matching a globbing pattern.
213 (and (zero? (system* "make"
214 "libarchive_test" "bsdcpio_test" "bsdtar_test"))
215 ;; XXX: This glob disables too much.
216 (zero? (system* "./libarchive_test" "^test_*_disk*"))
217 (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
218 (zero? (system* "./bsdtar_test"))))
220 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
221 ;; compiled with C99 or C11 or a gnu variant.
222 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
223 (home-page "http://libarchive.org/")
224 (synopsis "Multi-format archive and compression library")
226 "Libarchive provides a flexible interface for reading and writing
227 archives in various formats such as tar and cpio. Libarchive also supports
228 reading and writing archives compressed using various compression filters such
229 as gzip and bzip2. The library is inherently stream-oriented; readers
230 serially iterate through the archive, writers serially add things to the
231 archive. In particular, note that there is currently no built-in support for
232 random access nor for in-place modification.")
233 (license license:bsd-2)))
242 (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
246 "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
247 (modules '((guix build utils)))
249 ;; Some test scripts are missing shebangs, which cause "could not
250 ;; execute" errors. Add shebangs.
253 (with-atomic-file-replacement
254 (string-append "testsuite/rdup/" testscript)
257 (format out "#!/bin/sh\n" )
258 (dump-port in out)))))
259 '("rdup.hardlink.helper"
260 "rdup.hardlink-strip.helper"
261 "rdup.hardlink-strip2.helper"
262 "rdup.pipeline.helper")))))
263 (build-system gnu-build-system)
265 `(("pkg-config" ,pkg-config)
266 ("dejagnu" ,dejagnu)))
270 ("libarchive" ,libarchive)
273 `(#:parallel-build? #f ;race conditions
274 #:phases (alist-cons-before
275 'build 'remove-Werror
276 ;; rdup uses a deprecated function from libarchive
278 (substitute* "GNUmakefile"
279 (("^(CFLAGS=.*)-Werror" _ front) front)))
283 (setenv "HOME" (getcwd))
284 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
285 (("/bin/cat") (which "cat"))))
288 (home-page "http://archive.miek.nl/projects/rdup/index.html")
289 (synopsis "Provide a list of files to backup")
291 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
292 Rdup itself does not backup anything, it only print a list of absolute
293 file names to standard output. Auxiliary scripts are needed that act on this
294 list and implement the backup strategy.")
295 (license license:gpl3+)))
304 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
305 "btar-" version ".tar.gz"))
308 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
309 (build-system gnu-build-system)
311 `(("librsync" ,librsync)))
313 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
315 #:tests? #f ;test input not distributed
318 'configure ;no configure phase
320 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
321 (synopsis "Tar-compatible archiver")
323 "Btar is a tar-compatible archiver which allows arbitrary compression and
324 ciphering, redundancy, differential backup, indexed extraction, multicore
325 compression, input and output serialisation, and tolerance to partial archive
327 (license license:gpl3+)))
329 (define-public rdiff-backup
331 (name "rdiff-backup")
336 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
340 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
341 (build-system python-build-system)
343 `(("python" ,python-2)
344 ("librsync" ,librsync)))
348 (home-page "http://www.nongnu.org/rdiff-backup/")
349 (synopsis "Local/remote mirroring+incremental backup")
351 "Rdiff-backup backs up one directory to another, possibly over a network.
352 The target directory ends up a copy of the source directory, but extra reverse
353 diffs are stored in a special subdirectory of that target directory, so you
354 can still recover files lost some time ago. The idea is to combine the best
355 features of a mirror and an incremental backup. Rdiff-backup also preserves
356 subdirectories, hard links, dev files, permissions, uid/gid ownership,
357 modification times, extended attributes, acls, and resource forks. Also,
358 rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
359 rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
360 to a remote location, and only the differences will be transmitted. Finally,
361 rdiff-backup is easy to use and settings have sensible defaults.")
362 (license license:gpl2+)))
364 (define-public libchop
370 (uri (string-append "mirror://savannah/libchop/libchop-"
374 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
375 (patches (search-patches "diffutils-gets-undeclared.patch"))))
376 (build-system gnu-build-system)
378 `(("guile" ,guile-2.0)
380 ("pkg-config" ,pkg-config)))
382 `(("guile" ,guile-2.0)
383 ("util-linux" ,util-linux)
388 ("libgcrypt" ,libgcrypt)
392 (home-page "http://nongnu.org/libchop/")
393 (synopsis "Tools & library for data backup and distributed storage")
395 "Libchop is a set of utilities and library for data backup and
396 distributed storage. Its main application is @command{chop-backup}, an
397 encrypted backup program that supports data integrity checks, versioning,
398 distribution among several sites, selective sharing of stored data, adaptive
399 compression, and more. The library itself implements storage techniques such
400 as content-addressable storage, content hash keys, Merkle trees, similarity
401 detection, and lossless compression.")
402 (license license:gpl3+)))
410 (uri (pypi-uri "borgbackup" version))
413 "1fdfi0yzzdrrlml6780n4fh61sqm7pw6fcd1y67kfkvw8hy5c0k9"))
414 (modules '((guix build utils)))
417 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
418 (build-system python-build-system)
420 `(#:modules ((srfi srfi-26) ; for cut
422 (guix build python-build-system))
424 (modify-phases %standard-phases
425 (add-after 'unpack 'set-env
426 (lambda* (#:key inputs #:allow-other-keys)
427 (let ((openssl (assoc-ref inputs "openssl"))
428 (lz4 (assoc-ref inputs "lz4")))
429 (setenv "BORG_OPENSSL_PREFIX" openssl)
430 (setenv "BORG_LZ4_PREFIX" lz4)
431 (setenv "PYTHON_EGG_CACHE" "/tmp")
432 ;; The test 'test_return_codes[python]' fails when
433 ;; HOME=/homeless-shelter.
434 (setenv "HOME" "/tmp")
436 ;; The tests need to be run after Borg is installed.
438 (add-after 'install 'check
439 (lambda* (#:key inputs outputs #:allow-other-keys)
440 ;; Make the installed package available for the test suite.
441 (add-installed-pythonpath inputs outputs)
443 (system* "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
445 ;; These tests need to write to '/var'.
446 "not test_get_cache_dir "
447 "and not test_get_keys_dir "
448 ;; These tests assume there is a root user in
450 "and not test_access_acl "
451 "and not test_default_acl "
452 "and not test_non_ascii_acl "
453 ;; This test needs the unpackaged pytest-benchmark.
455 ;; These tests assume the kernel supports FUSE. They
456 ;; were skipped using the "old" Python build system,
458 ;; 7db40bce58e149ecb541d295e01cfbfe953d39a3.
460 "and not test_fuse_allow_damaged_files")))))
461 (add-after 'install 'install-doc
462 (lambda* (#:key outputs #:allow-other-keys)
463 (let* ((out (assoc-ref outputs "out"))
464 (man (string-append out "/share/man/man1"))
465 (misc (string-append out "/share/borg/misc")))
466 (for-each (cut install-file <> misc)
467 '("docs/misc/create_chunker-params.txt"
468 "docs/misc/internals-picture.txt"
469 "docs/misc/prune-example.txt"))
471 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
472 (zero? (system* "make" "-C" "docs" "man"))
474 (install-file "docs/_build/man/borg.1" man)
477 `(("python-cython" ,python-cython)
478 ("python-setuptools-scm" ,python-setuptools-scm)
479 ;; Borg 1.0.8's test suite uses 'tmpdir_factory', which was introduced in
481 ("python-pytest" ,python-pytest-2.9.2)
482 ;; For generating the documentation.
483 ("python-sphinx" ,python-sphinx)
484 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
489 ("python-llfuse" ,python-llfuse)
490 ("python-msgpack" ,python-msgpack)))
491 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
492 (description "Borg is a deduplicating backup program. Optionally, it
493 supports compression and authenticated encryption. The main goal of Borg is to
494 provide an efficient and secure way to backup data. The data deduplication
495 technique used makes Borg suitable for daily backups since only changes are
496 stored. The authenticated encryption technique makes it suitable for backups
497 to not fully trusted targets. Borg is a fork of Attic.")
498 (home-page "https://borgbackup.github.io/borgbackup/")
499 (license license:bsd-3)))
508 "https://pypi.python.org/packages/source/A/Attic/Attic-"
512 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
513 (build-system python-build-system)
515 `(;; The tests assume they are run as root:
516 ;; https://github.com/jborg/attic/issues/7
519 (modify-phases %standard-phases
521 'build 'set-openssl-prefix
522 (lambda* (#:key inputs #:allow-other-keys)
523 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
528 ("python-msgpack" ,python-msgpack)
530 ;; Attic is probably incompatible with llfuse > 0.41.
531 ;; These links are to discussions of llfuse compatibility from
532 ;; the borg project. Borg is a recent fork of attic, and attic
533 ;; has not been updated since the fork, so it's likely that
534 ;; llfuse compatibility requirements are still the same.
535 ;; https://github.com/borgbackup/borg/issues/642
536 ;; https://github.com/borgbackup/borg/issues/643
537 ("python-llfuse" ,python-llfuse-0.41)))
538 (synopsis "Deduplicating backup program")
539 (description "Attic is a deduplicating backup program. The main goal of
540 Attic is to provide an efficient and secure way to backup data. The data
541 deduplication technique used makes Attic suitable for daily backups since only
542 changes are stored.")
543 (home-page "https://attic-backup.org/")
544 (license license:bsd-3)
545 (properties `((superseded . ,borg)))))