gnu: Add par2cmdline.
[jackhill/guix/guix.git] / gnu / packages / backup.scm
CommitLineData
d1a5439b 1;;; GNU Guix --- Functional package management for GNU
aa90f2cd 2;;; Copyright © 2014, 2015 Eric Bavier <bavier@member.fsf.org>
29a7c98a 3;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
6fc5c11b 4;;; Copyright © 2015, 2016 Leo Famulari <leo@famulari.name>
d1a5439b
EB
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)
b5b73a82 23 #:use-module ((guix licenses) #:prefix license:)
d1a5439b 24 #:use-module (guix download)
29a7c98a 25 #:use-module (guix utils)
e531172d 26 #:use-module (guix build utils)
2d762953 27 #:use-module (guix build-system gnu)
d1a5439b
EB
28 #:use-module (guix build-system python)
29 #:use-module (gnu packages)
0c146750 30 #:use-module (gnu packages acl)
f6875394 31 #:use-module (gnu packages autotools)
2d762953
EB
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages compression)
362f496d 34 #:use-module (gnu packages databases)
d42e6122 35 #:use-module (gnu packages dejagnu)
2d762953 36 #:use-module (gnu packages glib)
d1a5439b 37 #:use-module (gnu packages gnupg)
362f496d
LC
38 #:use-module (gnu packages gperf)
39 #:use-module (gnu packages guile)
335bc683 40 #:use-module (gnu packages linux)
2d762953 41 #:use-module (gnu packages mcrypt)
d42e6122
EB
42 #:use-module (gnu packages nettle)
43 #:use-module (gnu packages pcre)
2d762953 44 #:use-module (gnu packages pkg-config)
0c146750 45 #:use-module (gnu packages python)
d1a5439b 46 #:use-module (gnu packages rsync)
2d762953 47 #:use-module (gnu packages ssh)
0c146750 48 #:use-module (gnu packages tls)
29a7c98a 49 #:use-module (gnu packages xml))
d1a5439b
EB
50
51(define-public duplicity
52 (package
53 (name "duplicity")
aa90f2cd 54 (version "0.6.26")
d1a5439b
EB
55 (source
56 (origin
57 (method url-fetch)
58 (uri (string-append "https://code.launchpad.net/duplicity/"
29a7c98a 59 (version-major+minor version)
d1a5439b
EB
60 "-series/" version "/+download/duplicity-"
61 version ".tar.gz"))
62 (sha256
63 (base32
aa90f2cd 64 "0jh79syhr8n3l81jxlwsmwm1pklb4d923m2lgqbswyavh1fqmvwb"))
fc1adab1
AK
65 (patches (search-patches "duplicity-piped-password.patch"
66 "duplicity-test_selection-tmp.patch"))))
d1a5439b
EB
67 (build-system python-build-system)
68 (native-inputs
cc7f4e05
LC
69 `(("python2-setuptools" ,python2-setuptools)
70 ("util-linux" ,util-linux))) ;setsid command, for the tests
d1a5439b
EB
71 (inputs
72 `(("python" ,python-2)
73 ("librsync" ,librsync)
74 ("mock" ,python2-mock) ;for testing
75 ("lockfile" ,python2-lockfile)
335bc683
EB
76 ("gnupg" ,gnupg-1) ;gpg executable needed
77 ("util-linux" ,util-linux) ;for setsid
78 ("tzdata" ,tzdata)))
d1a5439b
EB
79 (arguments
80 `(#:python ,python-2 ;setup assumes Python 2
81 #:test-target "test"
82 #:phases (alist-cons-before
335bc683
EB
83 'check 'check-setup
84 (lambda* (#:key inputs #:allow-other-keys)
d1a5439b 85 (substitute* "testing/functional/__init__.py"
335bc683
EB
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")))
d1a5439b
EB
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
96and uploading them to a remote or local file server. Because duplicity uses
97librsync, the incremental archives are space efficient and only record the
98parts of files that have changed since the last backup. Because duplicity
99uses GnuPG to encrypt and/or sign these archives, they will be safe from
100spying and/or modification by the server.")
b0e3635e 101 (license license:gpl2+)))
2d762953 102
f6875394
BT
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
134files using Reed-Solomon coding. PAR2 files can be stored along side backups
135or distributed files for recovering from bitrot.")
136 (home-page "https://github.com/Parchive/par2cmdline")
137 (license license:gpl3+)))
138
2d762953
EB
139(define-public hdup
140 (package
141 (name "hdup")
142 (version "2.0.14")
143 (source
144 (origin
145 (method url-fetch)
35d28c60 146 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
2d762953
EB
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
69b4ffcf 166 "Hdup2 is a backup utility, its aim is to make backup really simple. The
2d762953
EB
167backup scheduling is done by means of a cron job. It supports an
168include/exclude mechanism, remote backups, encrypted backups and split
169backups (called chunks) to allow easy burning to CD/DVD.")
b0e3635e
LC
170 (license license:gpl2)))
171
172(define-public libarchive
173 (package
174 (name "libarchive")
09cbd53c 175 (version "3.2.1")
b0e3635e
LC
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "http://libarchive.org/downloads/libarchive-"
180 version ".tar.gz"))
181 (sha256
182 (base32
09cbd53c 183 "1lngng84k1kkljl74q0cdqc3s82vn2kimfm02dgm4d6m7x71mvkj"))))
b0e3635e 184 (build-system gnu-build-system)
e3e1ecf6 185 ;; TODO: Add -L/path/to/nettle in libarchive.pc.
b0e3635e
LC
186 (inputs
187 `(("zlib" ,zlib)
188 ("nettle" ,nettle)
189 ("lzo" ,lzo)
190 ("bzip2" ,bzip2)
191 ("libxml2" ,libxml2)
192 ("xz" ,xz)))
193 (arguments
194 `(#:phases
195 (alist-cons-before
196 'build 'patch-pwd
197 (lambda _
198 (substitute* "Makefile"
199 (("/bin/pwd") (which "pwd"))))
200 (alist-replace
201 'check
202 (lambda _
203 ;; XXX: The test_owner_parse, test_read_disk, and
204 ;; test_write_disk_lookup tests expect user 'root' to exist, but
205 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
206 ;;
207 ;; The tests allow one to disable tests matching a globbing pattern.
208 (and (zero? (system* "make"
209 "libarchive_test" "bsdcpio_test" "bsdtar_test"))
210 ;; XXX: This glob disables too much.
211 (zero? (system* "./libarchive_test" "^test_*_disk*"))
212 (zero? (system* "./bsdcpio_test" "^test_owner_parse"))
213 (zero? (system* "./bsdtar_test"))))
09cbd53c
EF
214 %standard-phases))
215 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
216 ;; compiled with C99 or C11 or a gnu variant.
217 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
b0e3635e
LC
218 (home-page "http://libarchive.org/")
219 (synopsis "Multi-format archive and compression library")
220 (description
221 "Libarchive provides a flexible interface for reading and writing
222archives in various formats such as tar and cpio. Libarchive also supports
223reading and writing archives compressed using various compression filters such
224as gzip and bzip2. The library is inherently stream-oriented; readers
225serially iterate through the archive, writers serially add things to the
35b9e423 226archive. In particular, note that there is currently no built-in support for
b0e3635e
LC
227random access nor for in-place modification.")
228 (license license:bsd-2)))
d42e6122
EB
229
230(define-public rdup
231 (package
232 (name "rdup")
233 (version "1.1.14")
234 (source
235 (origin
236 (method url-fetch)
237 (uri (string-append "http://archive.miek.nl/projects/rdup/rdup-"
238 version ".tar.bz2"))
239 (sha256
240 (base32
e531172d
EB
241 "0aklwd9v7ix0m4ayl762sil685f42cwljzx3jz5skrnjaq32npmj"))
242 (modules '((guix build utils)))
243 (snippet
244 ;; Some test scripts are missing shebangs, which cause "could not
245 ;; execute" errors. Add shebangs.
246 '(for-each
247 (lambda (testscript)
248 (with-atomic-file-replacement
249 (string-append "testsuite/rdup/" testscript)
250 (lambda (in out)
251 (begin
252 (format out "#!/bin/sh\n" )
253 (dump-port in out)))))
254 '("rdup.hardlink.helper"
255 "rdup.hardlink-strip.helper"
256 "rdup.hardlink-strip2.helper"
257 "rdup.pipeline.helper")))))
d42e6122
EB
258 (build-system gnu-build-system)
259 (native-inputs
260 `(("pkg-config" ,pkg-config)
261 ("dejagnu" ,dejagnu)))
262 (inputs
263 `(("glib" ,glib)
264 ("pcre" ,pcre)
265 ("libarchive" ,libarchive)
266 ("nettle" ,nettle)))
267 (arguments
268 `(#:parallel-build? #f ;race conditions
269 #:phases (alist-cons-before
270 'build 'remove-Werror
271 ;; rdup uses a deprecated function from libarchive
272 (lambda _
273 (substitute* "GNUmakefile"
274 (("^(CFLAGS=.*)-Werror" _ front) front)))
e531172d
EB
275 (alist-cons-before
276 'check 'pre-check
277 (lambda _
278 (setenv "HOME" (getcwd))
279 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
280 (("/bin/cat") (which "cat"))))
e881752c 281
e531172d 282 %standard-phases))))
d42e6122
EB
283 (home-page "http://archive.miek.nl/projects/rdup/index.html")
284 (synopsis "Provide a list of files to backup")
285 (description
286 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
287Rdup itself does not backup anything, it only print a list of absolute
e881752c 288file names to standard output. Auxiliary scripts are needed that act on this
d42e6122 289list and implement the backup strategy.")
b0e3635e 290 (license license:gpl3+)))
22c24621
EB
291
292(define-public btar
293 (package
294 (name "btar")
295 (version "1.1.1")
296 (source
297 (origin
298 (method url-fetch)
299 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
300 "btar-" version ".tar.gz"))
301 (sha256
302 (base32
303 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
304 (build-system gnu-build-system)
305 (inputs
306 `(("librsync" ,librsync)))
307 (arguments
308 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
309 "CC=gcc")
310 #:tests? #f ;test input not distributed
311 #:phases
312 (alist-delete
313 'configure ;no configure phase
314 %standard-phases)))
315 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
316 (synopsis "Tar-compatible archiver")
317 (description
318 "Btar is a tar-compatible archiver which allows arbitrary compression and
319ciphering, redundancy, differential backup, indexed extraction, multicore
320compression, input and output serialisation, and tolerance to partial archive
321errors.")
b0e3635e 322 (license license:gpl3+)))
bd3fc08c
EB
323
324(define-public rdiff-backup
325 (package
326 (name "rdiff-backup")
327 (version "1.2.8")
328 (source
329 (origin
330 (method url-fetch)
331 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
332 version ".tar.gz"))
333 (sha256
334 (base32
335 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
336 (build-system python-build-system)
337 (native-inputs
338 `(("python2-setuptools" ,python2-setuptools)))
339 (inputs
340 `(("python" ,python-2)
341 ("librsync" ,librsync)))
342 (arguments
343 `(#:python ,python-2
344 #:tests? #f))
345 (home-page "http://www.nongnu.org/rdiff-backup/")
346 (synopsis "Local/remote mirroring+incremental backup")
347 (description
348 "Rdiff-backup backs up one directory to another, possibly over a network.
349The target directory ends up a copy of the source directory, but extra reverse
350diffs are stored in a special subdirectory of that target directory, so you
351can still recover files lost some time ago. The idea is to combine the best
352features of a mirror and an incremental backup. Rdiff-backup also preserves
353subdirectories, hard links, dev files, permissions, uid/gid ownership,
354modification times, extended attributes, acls, and resource forks. Also,
355rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
356rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
357to a remote location, and only the differences will be transmitted. Finally,
e881752c 358rdiff-backup is easy to use and settings have sensible defaults.")
b0e3635e 359 (license license:gpl2+)))
0c146750
LF
360
361(define-public attic
362 (package
363 (name "attic")
364 (version "0.16")
365 (source (origin
366 (method url-fetch)
367 (uri (string-append
368 "https://pypi.python.org/packages/source/A/Attic/Attic-"
369 version ".tar.gz"))
370 (sha256
371 (base32
372 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
373 (build-system python-build-system)
374 (arguments
375 `(#:phases
376 (modify-phases %standard-phases
377 (add-before
378 'build 'set-openssl-prefix
379 (lambda* (#:key inputs #:allow-other-keys)
380 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
381 #t)))))
382 (inputs
383 `(("acl" ,acl)
384 ("openssl" ,openssl)
5a39b07f
LF
385 ("python-msgpack" ,python-msgpack)
386
387 ;; Attic is probably incompatible with llfuse > 0.41.
388 ;; These links are to discussions of llfuse compatibility from
389 ;; the borg project. Borg is a recent fork of attic, and attic
390 ;; has not been updated since the fork, so it's likely that
391 ;; llfuse compatibility requirements are still the same.
392 ;; https://github.com/borgbackup/borg/issues/642
393 ;; https://github.com/borgbackup/borg/issues/643
394 ("python-llfuse" ,python-llfuse-0.41)))
0c146750
LF
395 (synopsis "Deduplicating backup program")
396 (description "Attic is a deduplicating backup program. The main goal of
397Attic is to provide an efficient and secure way to backup data. The data
398deduplication technique used makes Attic suitable for daily backups since only
399changes are stored.")
400 (home-page "https://attic-backup.org/")
401 (license license:bsd-3)))
362f496d
LC
402
403(define-public libchop
404 (package
405 (name "libchop")
406 (version "0.5.2")
407 (source (origin
408 (method url-fetch)
409 (uri (string-append "mirror://savannah/libchop/libchop-"
410 version ".tar.gz"))
411 (sha256
412 (base32
413 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
fc1adab1 414 (patches (search-patches "diffutils-gets-undeclared.patch"))))
362f496d
LC
415 (build-system gnu-build-system)
416 (native-inputs
417 `(("guile" ,guile-2.0)
418 ("gperf" ,gperf)
419 ("pkg-config" ,pkg-config)))
420 (inputs
421 `(("guile" ,guile-2.0)
422 ("util-linux" ,util-linux)
423 ("gnutls" ,gnutls)
424 ("tdb" ,tdb)
425 ("bdb" ,bdb)
426 ("gdbm" ,gdbm)
427 ("libgcrypt" ,libgcrypt)
428 ("lzo" ,lzo)
429 ("bzip2" ,bzip2)
430 ("zlib" ,zlib)))
431 (home-page "http://nongnu.org/libchop/")
432 (synopsis "Tools & library for data backup and distributed storage")
433 (description
434 "Libchop is a set of utilities and library for data backup and
435distributed storage. Its main application is @command{chop-backup}, an
436encrypted backup program that supports data integrity checks, versioning,
437distribution among several sites, selective sharing of stored data, adaptive
438compression, and more. The library itself implements storage techniques such
439as content-addressable storage, content hash keys, Merkle trees, similarity
440detection, and lossless compression.")
441 (license license:gpl3+)))
6fc5c11b
LF
442
443(define-public borg
444 (package
445 (name "borg")
d760a2fc 446 (version "1.0.7")
6fc5c11b
LF
447 (source (origin
448 (method url-fetch)
2d74d94b 449 (uri (pypi-uri "borgbackup" version))
6fc5c11b
LF
450 (sha256
451 (base32
f99cfc19
EF
452 "1l9iw55w5x51yxl3q89cf6avg80lajxvc8qz584hrsmnk6i56cr0"))
453 (modules '((guix build utils)))
454 (snippet
455 '(for-each
456 delete-file (find-files "borg" "^(c|h|p).*\\.c$")))))
6fc5c11b
LF
457 (build-system python-build-system)
458 (arguments
459 `(#:phases
460 (modify-phases %standard-phases
461 (add-after 'unpack 'set-env
462 (lambda* (#:key inputs #:allow-other-keys)
463 (let ((openssl (assoc-ref inputs "openssl"))
464 (lz4 (assoc-ref inputs "lz4")))
465 (setenv "BORG_OPENSSL_PREFIX" openssl)
466 (setenv "BORG_LZ4_PREFIX" lz4)
467 (setenv "PYTHON_EGG_CACHE" "/tmp")
468 #t)))
469 (add-after 'install 'install-doc
470 (lambda* (#:key outputs #:allow-other-keys)
471 (let* ((out (assoc-ref outputs "out"))
472 (man (string-append out "/share/man/man1")))
473 (and
474 (zero? (system* "python3" "setup.py" "build_ext" "--inplace"))
475 (zero? (system* "make" "-C" "docs" "man"))
476 (begin
477 (install-file "docs/_build/man/borg.1" man)
478 #t))))))))
479 (native-inputs
f99cfc19
EF
480 `(("python-cython" ,python-cython)
481 ("python-setuptools-scm" ,python-setuptools-scm)
6fc5c11b
LF
482 ;; For generating the documentation.
483 ("python-sphinx" ,python-sphinx)
484 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
485 (inputs
486 `(("acl" ,acl)
487 ("lz4" ,lz4)
488 ("openssl" ,openssl)
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
493supports compression and authenticated encryption. The main goal of Borg is to
494provide an efficient and secure way to backup data. The data deduplication
495technique used makes Borg suitable for daily backups since only changes are
496stored. The authenticated encryption technique makes it suitable for backups
497to not fully trusted targets. Borg is a fork of Attic.")
498 (home-page "https://borgbackup.github.io/borgbackup/")
499 (license license:bsd-3)))