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 `(("python2-setuptools" ,python2-setuptools)
70 ("util-linux" ,util-linux))) ;setsid command, for the tests
72 `(("python" ,python-2)
73 ("librsync" ,librsync)
74 ("mock" ,python2-mock) ;for testing
75 ("lockfile" ,python2-lockfile)
76 ("gnupg" ,gnupg-1) ;gpg executable needed
77 ("util-linux" ,util-linux) ;for setsid
80 `(#:python ,python-2 ;setup assumes Python 2
82 #:phases (alist-cons-before
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 `(("python2-setuptools" ,python2-setuptools)))
345 `(("python" ,python-2)
346 ("librsync" ,librsync)))
350 (home-page "http://www.nongnu.org/rdiff-backup/")
351 (synopsis "Local/remote mirroring+incremental backup")
353 "Rdiff-backup backs up one directory to another, possibly over a network.
354 The target directory ends up a copy of the source directory, but extra reverse
355 diffs are stored in a special subdirectory of that target directory, so you
356 can still recover files lost some time ago. The idea is to combine the best
357 features of a mirror and an incremental backup. Rdiff-backup also preserves
358 subdirectories, hard links, dev files, permissions, uid/gid ownership,
359 modification times, extended attributes, acls, and resource forks. Also,
360 rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
361 rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
362 to a remote location, and only the differences will be transmitted. Finally,
363 rdiff-backup is easy to use and settings have sensible defaults.")
364 (license license:gpl2+)))
366 (define-public libchop
372 (uri (string-append "mirror://savannah/libchop/libchop-"
376 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
377 (patches (search-patches "diffutils-gets-undeclared.patch"))))
378 (build-system gnu-build-system)
380 `(("guile" ,guile-2.0)
382 ("pkg-config" ,pkg-config)))
384 `(("guile" ,guile-2.0)
385 ("util-linux" ,util-linux)
390 ("libgcrypt" ,libgcrypt)
394 (home-page "http://nongnu.org/libchop/")
395 (synopsis "Tools & library for data backup and distributed storage")
397 "Libchop is a set of utilities and library for data backup and
398 distributed storage. Its main application is @command{chop-backup}, an
399 encrypted backup program that supports data integrity checks, versioning,
400 distribution among several sites, selective sharing of stored data, adaptive
401 compression, and more. The library itself implements storage techniques such
402 as content-addressable storage, content hash keys, Merkle trees, similarity
403 detection, and lossless compression.")
404 (license license:gpl3+)))
412 (uri (pypi-uri "borgbackup" version))
415 "1l9iw55w5x51yxl3q89cf6avg80lajxvc8qz584hrsmnk6i56cr0"))
416 (modules '((guix build utils)))
419 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
420 (build-system python-build-system)
422 `(#:modules ((srfi srfi-26) ; for cut
424 (guix build python-build-system))
426 (modify-phases %standard-phases
427 (add-after 'unpack 'set-env
428 (lambda* (#:key inputs #:allow-other-keys)
429 (let ((openssl (assoc-ref inputs "openssl"))
430 (lz4 (assoc-ref inputs "lz4")))
431 (setenv "BORG_OPENSSL_PREFIX" openssl)
432 (setenv "BORG_LZ4_PREFIX" lz4)
433 (setenv "PYTHON_EGG_CACHE" "/tmp")
434 ;; The test 'test_return_codes[python]' fails when
435 ;; HOME=/homeless-shelter.
436 (setenv "HOME" "/tmp")
438 ;; The tests need to be run after Borg is installed.
440 (add-after 'install 'check
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.
454 "and not benchmark")))))
455 (add-after 'install 'install-doc
456 (lambda* (#:key outputs #:allow-other-keys)
457 (let* ((out (assoc-ref outputs "out"))
458 (man (string-append out "/share/man/man1"))
459 (misc (string-append out "/share/borg/misc")))
460 (for-each (cut install-file <> misc)
461 '("docs/misc/create_chunker-params.txt"
462 "docs/misc/internals-picture.txt"
463 "docs/misc/prune-example.txt"))
465 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
466 (zero? (system* "make" "-C" "docs" "man"))
468 (install-file "docs/_build/man/borg.1" man)
471 `(("python-cython" ,python-cython)
472 ("python-setuptools-scm" ,python-setuptools-scm)
473 ("python-pytest" ,python-pytest)
474 ;; For generating the documentation.
475 ("python-sphinx" ,python-sphinx)
476 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
481 ("python-llfuse" ,python-llfuse)
482 ("python-msgpack" ,python-msgpack)))
483 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
484 (description "Borg is a deduplicating backup program. Optionally, it
485 supports compression and authenticated encryption. The main goal of Borg is to
486 provide an efficient and secure way to backup data. The data deduplication
487 technique used makes Borg suitable for daily backups since only changes are
488 stored. The authenticated encryption technique makes it suitable for backups
489 to not fully trusted targets. Borg is a fork of Attic.")
490 (home-page "https://borgbackup.github.io/borgbackup/")
491 (license license:bsd-3)))
500 "https://pypi.python.org/packages/source/A/Attic/Attic-"
504 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
505 (build-system python-build-system)
507 `(;; The tests assume they are run as root:
508 ;; https://github.com/jborg/attic/issues/7
511 (modify-phases %standard-phases
513 'build 'set-openssl-prefix
514 (lambda* (#:key inputs #:allow-other-keys)
515 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
520 ("python-msgpack" ,python-msgpack)
522 ;; Attic is probably incompatible with llfuse > 0.41.
523 ;; These links are to discussions of llfuse compatibility from
524 ;; the borg project. Borg is a recent fork of attic, and attic
525 ;; has not been updated since the fork, so it's likely that
526 ;; llfuse compatibility requirements are still the same.
527 ;; https://github.com/borgbackup/borg/issues/642
528 ;; https://github.com/borgbackup/borg/issues/643
529 ("python-llfuse" ,python-llfuse-0.41)))
530 (synopsis "Deduplicating backup program")
531 (description "Attic is a deduplicating backup program. The main goal of
532 Attic is to provide an efficient and secure way to backup data. The data
533 deduplication technique used makes Attic suitable for daily backups since only
534 changes are stored.")
535 (home-page "https://attic-backup.org/")
536 (license license:bsd-3)
537 (properties `((superseded . ,borg)))))