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