Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / backup.scm
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 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
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.
12 ;;;
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.
17 ;;;
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/>.
20
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))
50
51 (define-public duplicity
52 (package
53 (name "duplicity")
54 (version "0.6.26")
55 (source
56 (origin
57 (method url-fetch)
58 (uri (string-append "https://code.launchpad.net/duplicity/"
59 (version-major+minor version)
60 "-series/" version "/+download/duplicity-"
61 version ".tar.gz"))
62 (sha256
63 (base32
64 "0jh79syhr8n3l81jxlwsmwm1pklb4d923m2lgqbswyavh1fqmvwb"))
65 (patches (search-patches "duplicity-piped-password.patch"
66 "duplicity-test_selection-tmp.patch"))))
67 (build-system python-build-system)
68 (native-inputs
69 `(("python2-setuptools" ,python2-setuptools)
70 ("util-linux" ,util-linux))) ;setsid command, for the tests
71 (inputs
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
78 ("tzdata" ,tzdata)))
79 (arguments
80 `(#:python ,python-2 ;setup assumes Python 2
81 #:test-target "test"
82 #:phases (alist-cons-before
83 '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")
90 "/share/zoneinfo")))
91 %standard-phases)))
92 (home-page "http://duplicity.nongnu.org/index.html")
93 (synopsis "Encrypted backup using rsync algorithm")
94 (description
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+)))
102
103 (define-public par2cmdline
104 (package
105 (name "par2cmdline")
106 (version "0.6.14")
107 (source (origin
108 (method url-fetch)
109 (uri (string-append "https://github.com/Parchive/par2cmdline/archive/v"
110 version ".tar.gz"))
111 (file-name (string-append name "-" version ".tar.gz"))
112 (sha256
113 (base32
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)))
121 (snippet
122 '(substitute* "tests/test20" (("if=/dev/random") "if=/dev/urandom")))))
123 (native-inputs
124 `(("automake" ,automake)
125 ("autoconf" ,autoconf)))
126 (build-system gnu-build-system)
127 (arguments
128 `(#:phases
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+)))
138
139 (define-public hdup
140 (package
141 (name "hdup")
142 (version "2.0.14")
143 (source
144 (origin
145 (method url-fetch)
146 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
147 (sha256
148 (base32
149 "02bnczg01cyhajmm4rhbnc0ja0dd9ikv9fwv28asxh1rlx9yr0b7"))))
150 (build-system gnu-build-system)
151 (native-inputs `(("pkg-config" ,pkg-config)))
152 (inputs
153 `(("glib" ,glib)
154 ("tar" ,tar)
155 ("lzop" ,lzop)
156 ("mcrypt" ,mcrypt)
157 ("openssh" ,openssh)
158 ("gnupg" ,gnupg-1)))
159 (arguments
160 `(#:configure-flags
161 `(,(string-append "--sbindir=" (assoc-ref %outputs "out") "/bin"))
162 #:tests? #f))
163 (home-page "http://archive.miek.nl/projects/hdup/index.html")
164 (synopsis "Simple incremental backup tool")
165 (description
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)))
171
172 (define-public libarchive
173 (package
174 (name "libarchive")
175 (version "3.2.1")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "http://libarchive.org/downloads/libarchive-"
180 version ".tar.gz"))
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"))
186 (sha256
187 (base32
188 "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj"))))
189 (build-system gnu-build-system)
190 ;; TODO: Add -L/path/to/nettle in libarchive.pc.
191 (inputs
192 `(("zlib" ,zlib)
193 ("nettle" ,nettle)
194 ("lzo" ,lzo)
195 ("bzip2" ,bzip2)
196 ("libxml2" ,libxml2)
197 ("xz" ,xz)))
198 (arguments
199 `(#:phases
200 (alist-cons-before
201 'build 'patch-pwd
202 (lambda _
203 (substitute* "Makefile"
204 (("/bin/pwd") (which "pwd"))))
205 (alist-replace
206 'check
207 (lambda _
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.
211 ;;
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"))))
219 %standard-phases))
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")
225 (description
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)))
234
235 (define-public rdup
236 (package
237 (name "rdup")
238 (version "1.1.14")
239 (source
240 (origin
241 (method url-fetch)
242 (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
243 version ".tar.bz2"))
244 (sha256
245 (base32
246 "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
247 (modules '((guix build utils)))
248 (snippet
249 ;; Some test scripts are missing shebangs, which cause "could not
250 ;; execute" errors. Add shebangs.
251 '(for-each
252 (lambda (testscript)
253 (with-atomic-file-replacement
254 (string-append "testsuite/rdup/" testscript)
255 (lambda (in out)
256 (begin
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)
264 (native-inputs
265 `(("pkg-config" ,pkg-config)
266 ("dejagnu" ,dejagnu)))
267 (inputs
268 `(("glib" ,glib)
269 ("pcre" ,pcre)
270 ("libarchive" ,libarchive)
271 ("nettle" ,nettle)))
272 (arguments
273 `(#:parallel-build? #f ;race conditions
274 #:phases (alist-cons-before
275 'build 'remove-Werror
276 ;; rdup uses a deprecated function from libarchive
277 (lambda _
278 (substitute* "GNUmakefile"
279 (("^(CFLAGS=.*)-Werror" _ front) front)))
280 (alist-cons-before
281 'check 'pre-check
282 (lambda _
283 (setenv "HOME" (getcwd))
284 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
285 (("/bin/cat") (which "cat"))))
286
287 %standard-phases))))
288 (home-page "http://archive.miek.nl/projects/rdup/index.html")
289 (synopsis "Provide a list of files to backup")
290 (description
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+)))
296
297 (define-public btar
298 (package
299 (name "btar")
300 (version "1.1.1")
301 (source
302 (origin
303 (method url-fetch)
304 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
305 "btar-" version ".tar.gz"))
306 (sha256
307 (base32
308 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
309 (build-system gnu-build-system)
310 (inputs
311 `(("librsync" ,librsync)))
312 (arguments
313 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
314 "CC=gcc")
315 #:tests? #f ;test input not distributed
316 #:phases
317 (alist-delete
318 'configure ;no configure phase
319 %standard-phases)))
320 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
321 (synopsis "Tar-compatible archiver")
322 (description
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
326 errors.")
327 (license license:gpl3+)))
328
329 (define-public rdiff-backup
330 (package
331 (name "rdiff-backup")
332 (version "1.2.8")
333 (source
334 (origin
335 (method url-fetch)
336 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
337 version ".tar.gz"))
338 (sha256
339 (base32
340 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
341 (build-system python-build-system)
342 (native-inputs
343 `(("python2-setuptools" ,python2-setuptools)))
344 (inputs
345 `(("python" ,python-2)
346 ("librsync" ,librsync)))
347 (arguments
348 `(#:python ,python-2
349 #:tests? #f))
350 (home-page "http://www.nongnu.org/rdiff-backup/")
351 (synopsis "Local/remote mirroring+incremental backup")
352 (description
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+)))
365
366 (define-public libchop
367 (package
368 (name "libchop")
369 (version "0.5.2")
370 (source (origin
371 (method url-fetch)
372 (uri (string-append "mirror://savannah/libchop/libchop-"
373 version ".tar.gz"))
374 (sha256
375 (base32
376 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
377 (patches (search-patches "diffutils-gets-undeclared.patch"))))
378 (build-system gnu-build-system)
379 (native-inputs
380 `(("guile" ,guile-2.0)
381 ("gperf" ,gperf)
382 ("pkg-config" ,pkg-config)))
383 (inputs
384 `(("guile" ,guile-2.0)
385 ("util-linux" ,util-linux)
386 ("gnutls" ,gnutls)
387 ("tdb" ,tdb)
388 ("bdb" ,bdb)
389 ("gdbm" ,gdbm)
390 ("libgcrypt" ,libgcrypt)
391 ("lzo" ,lzo)
392 ("bzip2" ,bzip2)
393 ("zlib" ,zlib)))
394 (home-page "http://nongnu.org/libchop/")
395 (synopsis "Tools & library for data backup and distributed storage")
396 (description
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+)))
405
406 (define-public borg
407 (package
408 (name "borg")
409 (version "1.0.7")
410 (source (origin
411 (method url-fetch)
412 (uri (pypi-uri "borgbackup" version))
413 (sha256
414 (base32
415 "1l9iw55w5x51yxl3q89cf6avg80lajxvc8qz584hrsmnk6i56cr0"))
416 (modules '((guix build utils)))
417 (snippet
418 '(for-each
419 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
420 (build-system python-build-system)
421 (arguments
422 `(#:modules ((srfi srfi-26) ; for cut
423 (guix build utils)
424 (guix build python-build-system))
425 #:phases
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")
437 #t)))
438 ;; The tests need to be run after Borg is installed.
439 (delete 'check)
440 (add-after 'install 'check
441 (lambda _
442 (zero?
443 (system* "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
444 (string-append
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
449 ;; '/etc/passwd'.
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"))
464 (and
465 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
466 (zero? (system* "make" "-C" "docs" "man"))
467 (begin
468 (install-file "docs/_build/man/borg.1" man)
469 #t))))))))
470 (native-inputs
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)))
477 (inputs
478 `(("acl" ,acl)
479 ("lz4" ,lz4)
480 ("openssl" ,openssl)
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)))
492
493 (define-public attic
494 (package
495 (name "attic")
496 (version "0.16")
497 (source (origin
498 (method url-fetch)
499 (uri (string-append
500 "https://pypi.python.org/packages/source/A/Attic/Attic-"
501 version ".tar.gz"))
502 (sha256
503 (base32
504 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
505 (build-system python-build-system)
506 (arguments
507 `(;; The tests assume they are run as root:
508 ;; https://github.com/jborg/attic/issues/7
509 #:tests? #f
510 #:phases
511 (modify-phases %standard-phases
512 (add-before
513 'build 'set-openssl-prefix
514 (lambda* (#:key inputs #:allow-other-keys)
515 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
516 #t)))))
517 (inputs
518 `(("acl" ,acl)
519 ("openssl" ,openssl)
520 ("python-msgpack" ,python-msgpack)
521
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)))))