gnu: libchop: Require gperf 3.0.
[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>
d265169b 4;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name>
19278d8d 5;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
0da4f365 6;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
a2fa9c3d 7;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
3c8ba11a 8;;; Copyright © 2017 Kei Kebreau <kkebreau@posteo.net>
4ac8d486 9;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
0ff4425c 10;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
44dd001d 11;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
1a3aa5ba 12;;; Copyright © 2018 Mark H Weaver <mhw@netris.org>
f77886c1 13;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
d1a5439b
EB
14;;;
15;;; This file is part of GNU Guix.
16;;;
17;;; GNU Guix is free software; you can redistribute it and/or modify it
18;;; under the terms of the GNU General Public License as published by
19;;; the Free Software Foundation; either version 3 of the License, or (at
20;;; your option) any later version.
21;;;
22;;; GNU Guix is distributed in the hope that it will be useful, but
23;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25;;; GNU General Public License for more details.
26;;;
27;;; You should have received a copy of the GNU General Public License
28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30(define-module (gnu packages backup)
31 #:use-module (guix packages)
b5b73a82 32 #:use-module ((guix licenses) #:prefix license:)
d1a5439b 33 #:use-module (guix download)
29a7c98a 34 #:use-module (guix utils)
2d762953 35 #:use-module (guix build-system gnu)
f77886c1 36 #:use-module (guix build-system go)
d1a5439b
EB
37 #:use-module (guix build-system python)
38 #:use-module (gnu packages)
0c146750 39 #:use-module (gnu packages acl)
f6875394 40 #:use-module (gnu packages autotools)
2d762953 41 #:use-module (gnu packages base)
ac257f12 42 #:use-module (gnu packages check)
2d762953 43 #:use-module (gnu packages compression)
19278d8d 44 #:use-module (gnu packages crypto)
362f496d 45 #:use-module (gnu packages databases)
d42e6122 46 #:use-module (gnu packages dejagnu)
2903ee1e 47 #:use-module (gnu packages ftp)
2d762953 48 #:use-module (gnu packages glib)
d1a5439b 49 #:use-module (gnu packages gnupg)
f77886c1 50 #:use-module (gnu packages golang)
362f496d
LC
51 #:use-module (gnu packages gperf)
52 #:use-module (gnu packages guile)
335bc683 53 #:use-module (gnu packages linux)
2d762953 54 #:use-module (gnu packages mcrypt)
d42e6122
EB
55 #:use-module (gnu packages nettle)
56 #:use-module (gnu packages pcre)
0da4f365 57 #:use-module (gnu packages perl)
2d762953 58 #:use-module (gnu packages pkg-config)
0c146750 59 #:use-module (gnu packages python)
cc6f4912 60 #:use-module (gnu packages python-crypto)
1b2f753d 61 #:use-module (gnu packages python-web)
d1a5439b 62 #:use-module (gnu packages rsync)
2d762953 63 #:use-module (gnu packages ssh)
0c146750 64 #:use-module (gnu packages tls)
29a7c98a 65 #:use-module (gnu packages xml))
d1a5439b
EB
66
67(define-public duplicity
68 (package
69 (name "duplicity")
2dfb9bbf 70 (version "0.7.17")
d1a5439b
EB
71 (source
72 (origin
73 (method url-fetch)
74 (uri (string-append "https://code.launchpad.net/duplicity/"
29a7c98a 75 (version-major+minor version)
d1a5439b
EB
76 "-series/" version "/+download/duplicity-"
77 version ".tar.gz"))
78 (sha256
79 (base32
2dfb9bbf 80 "0jmh3h09680xyf33hzxxxl74bwz66zqhzvjlj7j89r9rz3qwa91p"))))
d1a5439b
EB
81 (build-system python-build-system)
82 (native-inputs
2903ee1e 83 `(("util-linux" ,util-linux) ;setsid command, for the tests
8ef8de79 84 ("par2cmdline" ,par2cmdline)
2903ee1e 85 ("python-pexpect" ,python2-pexpect)
2dfb9bbf 86 ("python-fasteners" ,python2-fasteners)
2903ee1e
TD
87 ("mock" ,python2-mock)))
88 (propagated-inputs
89 `(("lockfile" ,python2-lockfile)
90 ("urllib3" ,python2-urllib3)))
d1a5439b 91 (inputs
2903ee1e
TD
92 `(("librsync" ,librsync)
93 ("lftp" ,lftp)
94 ("gnupg" ,gnupg) ;gpg executable needed
335bc683
EB
95 ("util-linux" ,util-linux) ;for setsid
96 ("tzdata" ,tzdata)))
d1a5439b
EB
97 (arguments
98 `(#:python ,python-2 ;setup assumes Python 2
99 #:test-target "test"
ad04bd6b
MB
100 #:phases
101 (modify-phases %standard-phases
8ef8de79 102 (add-before 'build 'patch-source
ad04bd6b 103 (lambda* (#:key inputs #:allow-other-keys)
8ef8de79
MB
104 ;; embed gpg store name
105 (substitute* "duplicity/gpginterface.py"
106 (("self.call = 'gpg'")
107 (string-append "self.call = '" (assoc-ref inputs "gnupg") "/bin/gpg'")))
e61f092c
CB
108
109 ;; This matches up with an unreleased upstream fix, it should be
110 ;; removed when the package is updated
111 ;; https://bazaar.launchpad.net/~duplicity-team/duplicity/0.8-series/revision/1308
112 (substitute* "duplicity/gpg.py"
113 (("--no-secmem-warning'\\)")
114 "--no-secmem-warning')
115 gnupg.options.extra_args.append('--ignore-mdc-error')"))
116
8ef8de79
MB
117 (substitute* '("testing/functional/__init__.py"
118 "testing/overrides/bin/lftp")
ad04bd6b 119 (("/bin/sh") (which "sh")))
8ef8de79
MB
120 #t))
121 (add-before 'check 'check-setup
122 (lambda* (#:key inputs #:allow-other-keys)
ad04bd6b
MB
123 (setenv "HOME" (getcwd)) ;gpg needs to write to $HOME
124 (setenv "TZDIR" ;some timestamp checks need TZDIR
125 (string-append (assoc-ref inputs "tzdata")
126 "/share/zoneinfo"))
127 #t)))))
d1a5439b
EB
128 (home-page "http://duplicity.nongnu.org/index.html")
129 (synopsis "Encrypted backup using rsync algorithm")
130 (description
131 "Duplicity backs up directories by producing encrypted tar-format volumes
132and uploading them to a remote or local file server. Because duplicity uses
133librsync, the incremental archives are space efficient and only record the
134parts of files that have changed since the last backup. Because duplicity
135uses GnuPG to encrypt and/or sign these archives, they will be safe from
136spying and/or modification by the server.")
b0e3635e 137 (license license:gpl2+)))
2d762953 138
f6875394
BT
139(define-public par2cmdline
140 (package
141 (name "par2cmdline")
44dd001d 142 (version "0.8.0")
f6875394
BT
143 (source (origin
144 (method url-fetch)
145 (uri (string-append "https://github.com/Parchive/par2cmdline/archive/v"
146 version ".tar.gz"))
147 (file-name (string-append name "-" version ".tar.gz"))
148 (sha256
149 (base32
44dd001d 150 "1jpshmmcr81mxly0md2rr231qz9c8c680bbvcmhh100dg9i4a6s6"))))
f6875394
BT
151 (native-inputs
152 `(("automake" ,automake)
153 ("autoconf" ,autoconf)))
154 (build-system gnu-build-system)
155 (arguments
7359cffa 156 `(#:phases
f6875394
BT
157 (modify-phases %standard-phases
158 (add-after 'unpack 'autoreconf
f4f46fc3 159 (lambda _ (invoke "autoreconf" "-vfi"))))))
f6d59ecf
TGR
160 (synopsis "File verification and repair tools")
161 (description "Par2cmdline uses Reed-Solomon error-correcting codes to
162generate and verify PAR2 recovery files. These files can be distributed
163alongside the source files or stored together with back-ups to protect against
164transmission errors or @dfn{bit rot}, the degradation of storage media over
165time.
166Unlike a simple checksum, PAR2 doesn't merely detect errors: as long as the
a2dd9270
TGR
167damage isn't too extensive (and smaller than the size of the recovery file), it
168can even repair them.")
f6875394
BT
169 (home-page "https://github.com/Parchive/par2cmdline")
170 (license license:gpl3+)))
171
2d762953
EB
172(define-public hdup
173 (package
174 (name "hdup")
175 (version "2.0.14")
176 (source
177 (origin
178 (method url-fetch)
35d28c60 179 (uri "https://fossies.org/linux/privat/old/hdup-2.0.14.tar.bz2")
2d762953
EB
180 (sha256
181 (base32
182 "02bnczg01cyhajmm4rhbnc0ja0dd9ikv9fwv28asxh1rlx9yr0b7"))))
183 (build-system gnu-build-system)
184 (native-inputs `(("pkg-config" ,pkg-config)))
185 (inputs
186 `(("glib" ,glib)
187 ("tar" ,tar)
188 ("lzop" ,lzop)
189 ("mcrypt" ,mcrypt)
190 ("openssh" ,openssh)
191 ("gnupg" ,gnupg-1)))
192 (arguments
193 `(#:configure-flags
194 `(,(string-append "--sbindir=" (assoc-ref %outputs "out") "/bin"))
195 #:tests? #f))
196 (home-page "http://archive.miek.nl/projects/hdup/index.html")
197 (synopsis "Simple incremental backup tool")
198 (description
69b4ffcf 199 "Hdup2 is a backup utility, its aim is to make backup really simple. The
2d762953
EB
200backup scheduling is done by means of a cron job. It supports an
201include/exclude mechanism, remote backups, encrypted backups and split
202backups (called chunks) to allow easy burning to CD/DVD.")
b0e3635e
LC
203 (license license:gpl2)))
204
205(define-public libarchive
206 (package
207 (name "libarchive")
7095760c 208 (version "3.3.2")
b0e3635e
LC
209 (source
210 (origin
211 (method url-fetch)
212 (uri (string-append "http://libarchive.org/downloads/libarchive-"
213 version ".tar.gz"))
f76fc968
LF
214 (patches (search-patches "libarchive-CVE-2017-14166.patch"
215 "libarchive-CVE-2017-14502.patch"))
b0e3635e
LC
216 (sha256
217 (base32
7095760c 218 "1km0mzfl6in7l5vz9kl09a88ajx562rw93ng9h2jqavrailvsbgd"))))
b0e3635e
LC
219 (build-system gnu-build-system)
220 (inputs
221 `(("zlib" ,zlib)
222 ("nettle" ,nettle)
223 ("lzo" ,lzo)
224 ("bzip2" ,bzip2)
225 ("libxml2" ,libxml2)
226 ("xz" ,xz)))
227 (arguments
228 `(#:phases
4ac8d486
EF
229 (modify-phases %standard-phases
230 (add-before 'build 'patch-pwd
231 (lambda _
232 (substitute* "Makefile"
6266b8bc
EF
233 (("/bin/pwd") (which "pwd")))
234 #t))
4ac8d486
EF
235 (replace 'check
236 (lambda _
237 ;; XXX: The test_owner_parse, test_read_disk, and
238 ;; test_write_disk_lookup tests expect user 'root' to exist, but
239 ;; the chroot's /etc/passwd doesn't have it. Turn off those tests.
240 ;;
241 ;; The tests allow one to disable tests matching a globbing pattern.
1a3aa5ba
MW
242 (invoke "make" "libarchive_test" "bsdcpio_test" "bsdtar_test")
243 ;; XXX: This glob disables too much.
244 (invoke "./libarchive_test" "^test_*_disk*")
245 (invoke "./bsdcpio_test" "^test_owner_parse")
5294836d
LC
246 (invoke "./bsdtar_test")))
247 (add-after 'install 'add--L-in-libarchive-pc
248 (lambda* (#:key inputs outputs #:allow-other-keys)
249 (let* ((out (assoc-ref outputs "out"))
250 (lib (string-append out "/lib"))
251 (nettle (assoc-ref inputs "nettle"))
252 (libxml2 (assoc-ref inputs "libxml2"))
253 (xz (assoc-ref inputs "xz"))
254 (zlib (assoc-ref inputs "zlib"))
255 (bzip2 (assoc-ref inputs "bzip2")))
256 (substitute* (string-append lib "/pkgconfig/libarchive.pc")
257 (("-lnettle")
258 (string-append "-L" nettle "/lib -lnettle"))
259 (("-lxml2")
260 (string-append "-L" libxml2 "/lib -lxml2"))
261 (("-llzma")
262 (string-append "-L" xz "/lib -llzma"))
263 (("-lz")
264 (string-append "-L" zlib "/lib -lz"))
265 (("-lbz2")
266 (string-append "-L" bzip2 "/lib -lbz2")))
267 #t))))
268
09cbd53c
EF
269 ;; libarchive/test/test_write_format_gnutar_filenames.c needs to be
270 ;; compiled with C99 or C11 or a gnu variant.
271 #:configure-flags '("CFLAGS=-O2 -g -std=c99")))
b0e3635e
LC
272 (home-page "http://libarchive.org/")
273 (synopsis "Multi-format archive and compression library")
274 (description
275 "Libarchive provides a flexible interface for reading and writing
276archives in various formats such as tar and cpio. Libarchive also supports
277reading and writing archives compressed using various compression filters such
278as gzip and bzip2. The library is inherently stream-oriented; readers
279serially iterate through the archive, writers serially add things to the
35b9e423 280archive. In particular, note that there is currently no built-in support for
b0e3635e
LC
281random access nor for in-place modification.")
282 (license license:bsd-2)))
d42e6122
EB
283
284(define-public rdup
285 (package
286 (name "rdup")
fbf210cb 287 (version "1.1.15")
d42e6122
EB
288 (source
289 (origin
290 (method url-fetch)
fbf210cb
TGR
291 (file-name (string-append name "-" version ".tar.gz"))
292 (uri (string-append "https://github.com/miekg/rdup/archive/"
293 version ".tar.gz"))
d42e6122
EB
294 (sha256
295 (base32
fbf210cb 296 "1jr91hgcf0rrpanqlwws72ql9db6d6grs2i122ki1s4bx0vqqyvq"))))
d42e6122
EB
297 (build-system gnu-build-system)
298 (native-inputs
fbf210cb
TGR
299 `(("autoconf" ,autoconf)
300 ("automake" ,automake)
301 ("pkg-config" ,pkg-config)
302
303 ;; For tests.
d42e6122
EB
304 ("dejagnu" ,dejagnu)))
305 (inputs
306 `(("glib" ,glib)
307 ("pcre" ,pcre)
308 ("libarchive" ,libarchive)
fbf210cb 309 ("mcrypt" ,mcrypt)
d42e6122
EB
310 ("nettle" ,nettle)))
311 (arguments
312 `(#:parallel-build? #f ;race conditions
dc1d3cde
KK
313 #:phases
314 (modify-phases %standard-phases
fbf210cb
TGR
315 (add-before 'build 'qualify-inputs
316 (lambda* (#:key inputs #:allow-other-keys)
317 ;; This script is full of pitfalls. Fix some that particularly
318 ;; affect Guix users & leave the rest as reader excercises.
319 (substitute* "rdup-simple"
320 ;; Use the input ‘mcrypt’, not whatever's in $PATH at run time.
321 (("([' ])mcrypt " all delimiter)
322 (string-append delimiter (which "mcrypt") " "))
323 ;; Avoid frivolous dependency on ‘which’ with a shell builtin.
324 (("which") "command -v"))
dc1d3cde
KK
325 #t))
326 (add-before 'check 'pre-check
327 (lambda _
328 (setenv "HOME" (getcwd))
329 (substitute* "testsuite/rdup/rdup.rdup-up-t-with-file.exp"
330 (("/bin/cat") (which "cat")))
331 #t)))))
fbf210cb 332 (home-page "https://github.com/miekg/rdup")
d42e6122
EB
333 (synopsis "Provide a list of files to backup")
334 (description
335 "Rdup is a utility inspired by rsync and the plan9 way of doing backups.
336Rdup itself does not backup anything, it only print a list of absolute
e881752c 337file names to standard output. Auxiliary scripts are needed that act on this
d42e6122 338list and implement the backup strategy.")
b0e3635e 339 (license license:gpl3+)))
22c24621
EB
340
341(define-public btar
342 (package
343 (name "btar")
344 (version "1.1.1")
345 (source
346 (origin
347 (method url-fetch)
348 (uri (string-append "http://vicerveza.homeunix.net/~viric/soft/btar/"
349 "btar-" version ".tar.gz"))
350 (sha256
351 (base32
352 "0miklk4bqblpyzh1bni4x6lqn88fa8fjn15x1k1n8bxkx60nlymd"))))
353 (build-system gnu-build-system)
354 (inputs
355 `(("librsync" ,librsync)))
356 (arguments
357 `(#:make-flags `(,(string-append "PREFIX=" (assoc-ref %outputs "out"))
358 "CC=gcc")
359 #:tests? #f ;test input not distributed
360 #:phases
dc1d3cde
KK
361 ;; no configure phase
362 (modify-phases %standard-phases
363 (delete 'configure))))
22c24621
EB
364 (home-page "http://viric.name/cgi-bin/btar/doc/trunk/doc/home.wiki")
365 (synopsis "Tar-compatible archiver")
366 (description
367 "Btar is a tar-compatible archiver which allows arbitrary compression and
368ciphering, redundancy, differential backup, indexed extraction, multicore
369compression, input and output serialisation, and tolerance to partial archive
370errors.")
b0e3635e 371 (license license:gpl3+)))
bd3fc08c
EB
372
373(define-public rdiff-backup
374 (package
375 (name "rdiff-backup")
376 (version "1.2.8")
377 (source
378 (origin
379 (method url-fetch)
380 (uri (string-append "mirror://savannah/rdiff-backup/rdiff-backup-"
381 version ".tar.gz"))
382 (sha256
383 (base32
384 "1nwmmh816f96h0ff1jxk95ad38ilbhbdl5dgibx1d4cl81dsi48d"))))
385 (build-system python-build-system)
bd3fc08c
EB
386 (inputs
387 `(("python" ,python-2)
388 ("librsync" ,librsync)))
389 (arguments
390 `(#:python ,python-2
391 #:tests? #f))
340978d7 392 (home-page "https://www.nongnu.org/rdiff-backup/")
bd3fc08c
EB
393 (synopsis "Local/remote mirroring+incremental backup")
394 (description
395 "Rdiff-backup backs up one directory to another, possibly over a network.
396The target directory ends up a copy of the source directory, but extra reverse
397diffs are stored in a special subdirectory of that target directory, so you
398can still recover files lost some time ago. The idea is to combine the best
399features of a mirror and an incremental backup. Rdiff-backup also preserves
400subdirectories, hard links, dev files, permissions, uid/gid ownership,
401modification times, extended attributes, acls, and resource forks. Also,
402rdiff-backup can operate in a bandwidth efficient manner over a pipe, like
403rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up
404to a remote location, and only the differences will be transmitted. Finally,
e881752c 405rdiff-backup is easy to use and settings have sensible defaults.")
b0e3635e 406 (license license:gpl2+)))
0c146750 407
0da4f365
TD
408(define-public rsnapshot
409 (package
410 (name "rsnapshot")
411 (version "1.4.2")
412 (source
413 (origin
414 (method url-fetch)
415 (uri (string-append
416 "https://github.com/rsnapshot/rsnapshot/releases/download/"
417 version "/rsnapshot-" version ".tar.gz"))
418 (sha256
419 (base32
420 "05jfy99a0xs6lvsjfp3wz21z0myqhmwl2grn3jr9clijbg282ah4"))))
421 (build-system gnu-build-system)
422 (arguments
423 `(#:phases
424 (modify-phases %standard-phases
425 (replace 'check
426 (lambda _
427 (substitute* '("t/cmd-post_pre-exec/conf/pre-true-post-true.conf"
428 "t/backup_exec/conf/backup_exec_fail.conf"
429 "t/backup_exec/conf/backup_exec.conf")
430 (("/bin/true") (which "true"))
431 (("/bin/false") (which "false")))
4ce7c1b3 432 (invoke "make" "test"))))))
0da4f365
TD
433 (inputs
434 `(("perl" ,perl)
435 ("rsync" ,rsync)))
436 (home-page "http://rsnapshot.org")
437 (synopsis "Deduplicating snapshot backup utility based on rsync")
162a1374 438 (description "rsnapshot is a file system snapshot utility based on rsync.
0da4f365
TD
439rsnapshot makes it easy to make periodic snapshots of local machines, and
440remote machines over SSH. To reduce the disk space required for each backup,
441rsnapshot uses hard links to deduplicate identical files.")
442 (license license:gpl2+)))
443
362f496d
LC
444(define-public libchop
445 (package
446 (name "libchop")
447 (version "0.5.2")
448 (source (origin
449 (method url-fetch)
450 (uri (string-append "mirror://savannah/libchop/libchop-"
451 version ".tar.gz"))
452 (sha256
453 (base32
454 "0fpdyxww41ba52d98blvnf543xvirq1v9xz1i3x1gm9lzlzpmc2g"))
fc1adab1 455 (patches (search-patches "diffutils-gets-undeclared.patch"))))
362f496d
LC
456 (build-system gnu-build-system)
457 (native-inputs
458 `(("guile" ,guile-2.0)
c9f898cd 459 ("gperf" ,gperf-3.0) ;see <https://bugs.gnu.org/32382>
362f496d
LC
460 ("pkg-config" ,pkg-config)))
461 (inputs
462 `(("guile" ,guile-2.0)
463 ("util-linux" ,util-linux)
464 ("gnutls" ,gnutls)
465 ("tdb" ,tdb)
466 ("bdb" ,bdb)
467 ("gdbm" ,gdbm)
468 ("libgcrypt" ,libgcrypt)
469 ("lzo" ,lzo)
470 ("bzip2" ,bzip2)
471 ("zlib" ,zlib)))
340978d7 472 (home-page "https://nongnu.org/libchop/")
362f496d
LC
473 (synopsis "Tools & library for data backup and distributed storage")
474 (description
475 "Libchop is a set of utilities and library for data backup and
476distributed storage. Its main application is @command{chop-backup}, an
477encrypted backup program that supports data integrity checks, versioning,
478distribution among several sites, selective sharing of stored data, adaptive
479compression, and more. The library itself implements storage techniques such
480as content-addressable storage, content hash keys, Merkle trees, similarity
481detection, and lossless compression.")
482 (license license:gpl3+)))
6fc5c11b
LF
483
484(define-public borg
485 (package
486 (name "borg")
5a0696b2 487 (version "1.1.7")
c4556777
TGR
488 (source
489 (origin
490 (method url-fetch)
491 (uri (pypi-uri "borgbackup" version))
492 (sha256
5a0696b2
LF
493 (base32
494 "1p3zia62vyg9vadkdjzzkzbj4dmgijr7ix5lmhfbxpwy5q9imdgp"))
c4556777
TGR
495 (modules '((guix build utils)))
496 (snippet
497 '(begin
5a3bf255
LF
498 ;; Delete files generated by Cython. We used to have a regex
499 ;; that created the list of generated files but Borg has
500 ;; added new non-generated C files that cause the regex to
501 ;; generate the wrong list.
c4556777 502 (for-each delete-file
5a3bf255
LF
503 '("src/borg/algorithms/checksums.c"
504 "src/borg/chunker.c"
505 "src/borg/compress.c"
506 "src/borg/crypto/low_level.c"
507 "src/borg/hashindex.c"
508 "src/borg/item.c"
509 "src/borg/platform/darwin.c"
510 "src/borg/platform/freebsd.c"
511 "src/borg/platform/linux.c"
512 "src/borg/platform/posix.c"))
c4556777
TGR
513 ;; Remove bundled shared libraries.
514 (with-directory-excursion "src/borg/algorithms"
515 (for-each delete-file-recursively
6cbee49d
MW
516 (list "blake2" "lz4" "zstd")))
517 #t))))
6fc5c11b
LF
518 (build-system python-build-system)
519 (arguments
c21b1a1f
LF
520 `(#:modules ((srfi srfi-26) ; for cut
521 (guix build utils)
522 (guix build python-build-system))
523 #:phases
6fc5c11b
LF
524 (modify-phases %standard-phases
525 (add-after 'unpack 'set-env
526 (lambda* (#:key inputs #:allow-other-keys)
527 (let ((openssl (assoc-ref inputs "openssl"))
19278d8d 528 (libb2 (assoc-ref inputs "libb2"))
c4556777
TGR
529 (lz4 (assoc-ref inputs "lz4"))
530 (zstd (assoc-ref inputs "zstd")))
6fc5c11b 531 (setenv "BORG_OPENSSL_PREFIX" openssl)
19278d8d 532 (setenv "BORG_LIBB2_PREFIX" libb2)
c4556777
TGR
533 (setenv "BORG_LIBLZ4_PREFIX" lz4)
534 (setenv "BORG_LIBZSTD_PREFIX" zstd)
6fc5c11b 535 (setenv "PYTHON_EGG_CACHE" "/tmp")
b4f91d0e
LF
536 ;; The test 'test_return_codes[python]' fails when
537 ;; HOME=/homeless-shelter.
538 (setenv "HOME" "/tmp")
6fc5c11b 539 #t)))
b4f91d0e
LF
540 ;; The tests need to be run after Borg is installed.
541 (delete 'check)
542 (add-after 'install 'check
1d60f7c2
LF
543 (lambda* (#:key inputs outputs #:allow-other-keys)
544 ;; Make the installed package available for the test suite.
545 (add-installed-pythonpath inputs outputs)
8cb3e7e7
LF
546 ;; The tests should be run in an empty directory.
547 (mkdir-p "tests")
548 (with-directory-excursion "tests"
e252ec32
TGR
549 (invoke "py.test" "-v" "--pyargs" "borg.testsuite" "-k"
550 (string-append
551 ;; These tests need to write to '/var'.
552 "not test_get_cache_dir "
553 "and not test_get_config_dir "
554 "and not test_get_keys_dir "
555 "and not test_get_security_dir "
556 ;; These tests assume there is a root user in
557 ;; '/etc/passwd'.
558 "and not test_access_acl "
559 "and not test_default_acl "
560 "and not test_non_ascii_acl "
561 ;; This test needs the unpackaged pytest-benchmark.
562 "and not benchmark "
563 ;; These tests assume the kernel supports FUSE.
564 "and not test_fuse "
565 "and not test_fuse_allow_damaged_files "
566 "and not test_mount_hardlinks")))))
6fc5c11b 567 (add-after 'install 'install-doc
6ee4fd2a 568 (lambda* (#:key inputs outputs #:allow-other-keys)
6fc5c11b 569 (let* ((out (assoc-ref outputs "out"))
c21b1a1f
LF
570 (man (string-append out "/share/man/man1"))
571 (misc (string-append out "/share/borg/misc")))
572 (for-each (cut install-file <> misc)
573 '("docs/misc/create_chunker-params.txt"
574 "docs/misc/internals-picture.txt"
575 "docs/misc/prune-example.txt"))
6ee4fd2a 576 (add-installed-pythonpath inputs outputs)
e252ec32
TGR
577 (invoke "python3" "setup.py" "build_man")
578 (copy-recursively "docs/man" man)
579 #t))))))
6fc5c11b 580 (native-inputs
f99cfc19
EF
581 `(("python-cython" ,python-cython)
582 ("python-setuptools-scm" ,python-setuptools-scm)
928da609 583 ("python-pytest" ,python-pytest)
6fc5c11b
LF
584 ;; For generating the documentation.
585 ("python-sphinx" ,python-sphinx)
d265169b 586 ("python-guzzle-sphinx-theme" ,python-guzzle-sphinx-theme)))
6fc5c11b
LF
587 (inputs
588 `(("acl" ,acl)
19278d8d 589 ("libb2" ,libb2)
6fc5c11b
LF
590 ("lz4" ,lz4)
591 ("openssl" ,openssl)
592 ("python-llfuse" ,python-llfuse)
acb59d99
LF
593 ;; The Python msgpack library changed its name so Borg requires this
594 ;; transitional package for now:
595 ;; <https://bugs.gnu.org/30662>
596 ("python-msgpack" ,python-msgpack-transitional)
c4556777 597 ("zstd" ,zstd)))
6fc5c11b
LF
598 (synopsis "Deduplicated, encrypted, authenticated and compressed backups")
599 (description "Borg is a deduplicating backup program. Optionally, it
600supports compression and authenticated encryption. The main goal of Borg is to
601provide an efficient and secure way to backup data. The data deduplication
602technique used makes Borg suitable for daily backups since only changes are
603stored. The authenticated encryption technique makes it suitable for backups
604to not fully trusted targets. Borg is a fork of Attic.")
18533bcf 605 (home-page "https://www.borgbackup.org/")
6fc5c11b 606 (license license:bsd-3)))
b2fe9183
LF
607
608(define-public attic
609 (package
610 (name "attic")
611 (version "0.16")
612 (source (origin
613 (method url-fetch)
614 (uri (string-append
615 "https://pypi.python.org/packages/source/A/Attic/Attic-"
616 version ".tar.gz"))
617 (sha256
618 (base32
619 "0b5skd36r4c0915lwpkqg5hxm49gls9pprs1b7hc40910wlcsl36"))))
620 (build-system python-build-system)
621 (arguments
1df6d73b
LF
622 `(;; The tests assume they are run as root:
623 ;; https://github.com/jborg/attic/issues/7
624 #:tests? #f
625 #:phases
b2fe9183
LF
626 (modify-phases %standard-phases
627 (add-before
628 'build 'set-openssl-prefix
629 (lambda* (#:key inputs #:allow-other-keys)
630 (setenv "ATTIC_OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
631 #t)))))
632 (inputs
633 `(("acl" ,acl)
634 ("openssl" ,openssl)
635 ("python-msgpack" ,python-msgpack)
636
637 ;; Attic is probably incompatible with llfuse > 0.41.
638 ;; These links are to discussions of llfuse compatibility from
639 ;; the borg project. Borg is a recent fork of attic, and attic
640 ;; has not been updated since the fork, so it's likely that
641 ;; llfuse compatibility requirements are still the same.
642 ;; https://github.com/borgbackup/borg/issues/642
643 ;; https://github.com/borgbackup/borg/issues/643
644 ("python-llfuse" ,python-llfuse-0.41)))
645 (synopsis "Deduplicating backup program")
646 (description "Attic is a deduplicating backup program. The main goal of
647Attic is to provide an efficient and secure way to backup data. The data
648deduplication technique used makes Attic suitable for daily backups since only
649changes are stored.")
650 (home-page "https://attic-backup.org/")
651 (license license:bsd-3)
652 (properties `((superseded . ,borg)))))
3b402139
TGR
653
654(define-public wimlib
655 (package
656 (name "wimlib")
ea94aff7 657 (version "1.12.0")
3b402139
TGR
658 (source (origin
659 (method url-fetch)
660 (uri (string-append "https://wimlib.net/downloads/"
661 name "-" version ".tar.gz"))
662 (sha256
663 (base32
ea94aff7 664 "0ks6hq7vwq13ljkzxp3a490bf8dnracgl2azf57rg49ad2fzab45"))))
3b402139
TGR
665 (build-system gnu-build-system)
666 (native-inputs
667 `(("pkg-config" ,pkg-config)))
668 (inputs
669 `(("fuse" ,fuse)
670 ("libxml2" ,libxml2)
671 ("ntfs-3g" ,ntfs-3g)
672 ("openssl" ,openssl)))
673 (arguments
674 `(#:configure-flags (list "--enable-test-support")))
675 (home-page "https://wimlib.net/")
676 (synopsis "WIM file manipulation library and utilities")
677 (description "wimlib is a C library and set of command-line utilities for
678creating, modifying, extracting, and mounting archives in the Windows Imaging
679Format (@dfn{WIM files}). It can capture and apply WIMs directly from and to
680NTFS volumes using @code{ntfs-3g}, preserving NTFS-specific attributes.")
681 ;; wimlib is dual-licenced under version 3 or later of either the GPL or
682 ;; LGPL, except those files explicitly marked as being released into the
683 ;; public domain (CC0) in their headers.
684 (license (list license:gpl3+
685 license:lgpl3+
686 license:cc0))))
a2fa9c3d
AI
687
688(define-public obnam
689 (package
690 (name "obnam")
691 (version "1.21")
692 (source
693 (origin
694 (method url-fetch)
695 (uri (string-append
696 "http://code.liw.fi/debian/pool/main/o/obnam/obnam_"
697 version ".orig.tar.xz"))
698 (sha256
699 (base32
700 "0qlipsq50hca71zc0dp1mg9zs12qm0sbblw7qfzl0hj6mk2rv1by"))))
701 (build-system python-build-system)
702 (arguments
f75b1400
AI
703 `(#:python ,python-2
704 #:phases
705 (modify-phases %standard-phases
706 (replace 'check
707 (lambda _
708 (substitute* "obnamlib/vfs_local_tests.py"
f32a1803 709 ;; Check for the nobody user instead of root.
f75b1400
AI
710 (("self.fs.get_username\\(0\\), 'root'")
711 "self.fs.get_username(65534), 'nobody'")
f32a1803 712 ;; Disable tests checking for root group.
f75b1400
AI
713 (("self.fs.get_groupname\\(0\\)") "'root'"))
714 (substitute* "obnamlib/vfs_local.py"
f32a1803 715 ;; Don't cover get_groupname function.
f75b1400
AI
716 (("def get_groupname\\(self, gid\\):")
717 "def get_groupname(self, gid): # pragma: no cover"))
f32a1803
TGR
718 ;; Can't run network tests.
719 (invoke "./check" "--unit-tests"))))))
a2fa9c3d
AI
720 (inputs
721 `(("python2-cliapp" ,python2-cliapp)
722 ("python2-larch" ,python2-larch)
723 ("python2-paramiko" ,python2-paramiko)
724 ("python2-pyaml" ,python2-pyaml)
725 ("python2-tracing" ,python2-tracing)
726 ("python2-ttystatus" ,python2-ttystatus)))
f75b1400
AI
727 (native-inputs
728 `(("gnupg" ,gnupg)
729 ("python2-coverage" ,python2-coverage)
730 ("python2-coverage-test-runner" ,python2-coverage-test-runner)
731 ("python2-pep8" ,python2-pep8)
732 ("python2-pylint" ,python2-pylint)))
a2fa9c3d
AI
733 (home-page "https://obnam.org/")
734 (synopsis "Easy and secure backup program")
735 (description "Obnam is an easy, secure backup program. Features
736include snapshot backups, data de-duplication and encrypted backups
737using GnuPG. Backups can be stored on local hard disks, or online via
738the SSH SFTP protocol. The backup server, if used, does not require
739any special software, on top of SSH.")
740 (license license:gpl3+)))
0ff4425c
CAW
741
742(define-public dirvish
743 (package
744 (name "dirvish")
745 (version "1.2.1")
746 (build-system gnu-build-system)
747 (source (origin
748 (method url-fetch)
749 (uri (string-append
750 "http://dirvish.org/dirvish-" version ".tgz"))
751 (sha256
752 (base32
753 "1kbxa1irszp2zw8hd5qzqnrrzb4vxfivs1vn64yxnj0lak1jjzvb"))))
754 (arguments
755 `(#:modules ((ice-9 match) (ice-9 rdelim)
756 ,@%gnu-build-system-modules)
757 #:phases
758 ;; This mostly mirrors the steps taken in the install.sh that ships
759 ;; with dirvish, but simplified because we aren't prompting interactively
760 (modify-phases %standard-phases
761 (delete 'configure)
762 (delete 'build)
763 (delete 'check)
764 (replace 'install
765 (lambda* (#:key inputs outputs #:allow-other-keys)
766 ;; These are mostly the same steps the install.sh that comes with
767 ;; dirvish does
768 (let* (;; Files we'll be copying
769 (executables
770 '("dirvish" "dirvish-runall"
771 "dirvish-expire" "dirvish-locate"))
772 (man-pages
773 '(("dirvish" "8") ("dirvish-runall" "8")
774 ("dirvish-expire" "8") ("dirvish-locate" "8")
775 ("dirvish.conf" "5")))
776
777 (output-dir
778 (assoc-ref outputs "out"))
779
780 ;; Just a default... not so useful on guixsd though
781 ;; You probably want to a service with file(s) to point to.
782 (confdir "/etc/dirvish")
783
784 (perl (string-append (assoc-ref %build-inputs "perl")
785 "/bin/perl"))
786 (loadconfig.pl (call-with-input-file "loadconfig.pl"
787 read-string)))
788
789
790 (define (write-pl filename)
791 (define pl-header
792 (string-append "#!" perl "\n\n"
793 "$CONFDIR = \"" confdir "\";\n\n"))
794 (define input-file-location
795 (string-append filename ".pl"))
796 (define target-file-location
797 (string-append output-dir "/bin/" filename ".pl"))
798 (define text-to-write
799 (string-append pl-header
800 (call-with-input-file input-file-location
801 read-string)
802 "\n" loadconfig.pl))
803 (with-output-to-file target-file-location
804 (lambda ()
805 (display text-to-write)))
806 (chmod target-file-location #o755)
807 (wrap-program target-file-location
808 `("PERL5LIB" ":" prefix
809 ,(map (lambda (l) (string-append (assoc-ref %build-inputs l)
810 "/lib/perl5/site_perl"))
811 '("perl-libtime-period"
812 "perl-libtime-parsedate")))))
813
814 (define write-man
815 (match-lambda
816 ((file-base man-num)
817 (let* ((filename
818 (string-append file-base "." man-num))
819 (output-path
820 (string-append output-dir
821 "/share/man/man" man-num
822 "/" filename)))
823 (copy-file filename output-path)))))
824
825 ;; Make directories
826 (mkdir-p (string-append output-dir "/bin/"))
827 (mkdir-p (string-append output-dir "/share/man/man8/"))
828 (mkdir-p (string-append output-dir "/share/man/man5/"))
829
830 ;; Write out executables
831 (for-each write-pl executables)
832 ;; Write out man pages
833 (for-each write-man man-pages)
834 #t))))))
835 (inputs
836 `(("perl" ,perl)
837 ("rsync" ,rsync)
838 ("perl-libtime-period" ,perl-libtime-period)
839 ("perl-libtime-parsedate" ,perl-libtime-parsedate)))
840 (home-page "http://dirvish.org/")
841 (synopsis "Fast, disk based, rotating network backup system")
842 (description
843 "With dirvish you can maintain a set of complete images of your
162a1374 844file systems with unattended creation and expiration. A dirvish backup vault
0ff4425c
CAW
845is like a time machine for your data. ")
846 (license (license:fsf-free "file://COPYING"
847 "Open Software License 2.0"))))
f77886c1 848
f49d6909 849(define-public restic
f77886c1
OP
850 (package
851 (name "restic")
64140c95 852 (version "0.9.2")
f49d6909
LF
853 ;; TODO Try packaging the bundled / vendored dependencies in the 'vendor/'
854 ;; directory.
f77886c1
OP
855 (source (origin
856 (method url-fetch)
857 (uri (string-append
858 "https://github.com/restic/restic/releases/download/"
859 "v" version "/restic-" version ".tar.gz"))
860 (file-name (string-append name "-" version ".tar.gz"))
861 (sha256
862 (base32
64140c95 863 "15bwkydxcg4xhrnqxvxji8wacrsndb1a6frj98wggfaijqzfx3lg"))))
f77886c1
OP
864 (build-system go-build-system)
865 (arguments
866 `(#:import-path "github.com/restic/restic"
867 #:unpack-path "github.com/restic"
868 ;; We don't need to install the source code for end-user applications.
869 #:install-source? #f
870 #:phases
871 (modify-phases %standard-phases
872 (replace 'build
873 (lambda* (#:key inputs #:allow-other-keys)
874 (with-directory-excursion (string-append
875 "src/github.com/restic/restic-"
876 ,version)
877 (invoke "go" "run" "build.go"))))
878
4976ebdd
OP
879 (replace 'check
880 (lambda _
881 (with-directory-excursion (string-append
882 "src/github.com/restic/restic-"
883 ,version)
77389911
OP
884 ;; Disable FUSE tests.
885 (setenv "RESTIC_TEST_FUSE" "0")
4976ebdd
OP
886 (invoke "go" "run" "build.go" "--test"))))
887
f77886c1
OP
888 (replace 'install
889 (lambda* (#:key outputs #:allow-other-keys)
890 (let ((out (assoc-ref outputs "out"))
891 (src (string-append "src/github.com/restic/restic-"
892 ,version)))
893 (install-file (string-append src "/restic")
894 (string-append out "/bin"))
895 #t)))
896
897 (add-after 'install 'install-docs
898 (lambda* (#:key outputs #:allow-other-keys)
899 (let* ((out (assoc-ref outputs "out"))
900 (man "/share/man")
901 (man-section (string-append man "/man"))
902 (src (string-append "src/github.com/restic/restic-"
903 ,version "/doc/man/")))
904 ;; Install all the man pages to "out".
905 (for-each
906 (lambda (file)
907 (install-file file
908 (string-append out man-section
909 (string-take-right file 1))))
910 (find-files src "\\.[1-9]"))
911 #t)))
912
913 (add-after 'install-docs 'install-shell-completion
914 (lambda* (#:key outputs #:allow-other-keys)
915 (let* ((out (assoc-ref outputs "out"))
916 (bin (string-append out "/bin"))
917 (etc (string-append out "/etc"))
918 (share (string-append out "/share")))
919 (for-each
920 (lambda (shell)
921 (let* ((shell-name (symbol->string shell))
922 (dir (string-append "etc/completion/" shell-name)))
923 (mkdir-p dir)
924 (invoke (string-append bin "/restic") "generate"
925 (string-append "--" shell-name "-completion")
926 (string-append dir "/"
927 (case shell
928 ((bash) "restic")
929 ((zsh) "_restic"))))))
930 '(bash zsh))
931 (with-directory-excursion "etc/completion"
932 (install-file "bash/restic"
933 (string-append etc "/bash_completion.d"))
934 (install-file "zsh/_restic"
935 (string-append share "/zsh/site-functions")))
936 #t))))))
937 (home-page "https://restic.net/")
938 (synopsis "Backup program with multiple revisions, encryption and more")
939 (description "Restic is a program that does backups right and was designed
940with the following principles in mind:
941
942@itemize
943@item Easy: Doing backups should be a frictionless process, otherwise you
944might be tempted to skip it. Restic should be easy to configure and use, so
945that, in the event of a data loss, you can just restore it. Likewise,
946restoring data should not be complicated.
947
948@item Fast: Backing up your data with restic should only be limited by your
949network or hard disk bandwidth so that you can backup your files every day.
950Nobody does backups if it takes too much time. Restoring backups should only
951transfer data that is needed for the files that are to be restored, so that
952this process is also fast.
953
954@item Verifiable: Much more important than backup is restore, so restic
955enables you to easily verify that all data can be restored. @item Secure:
956Restic uses cryptography to guarantee confidentiality and integrity of your
957data. The location the backup data is stored is assumed not to be a trusted
958environment (e.g. a shared space where others like system administrators are
959able to access your backups). Restic is built to secure your data against
960such attackers.
961
962@item Efficient: With the growth of data, additional snapshots should only
963take the storage of the actual increment. Even more, duplicate data should be
964de-duplicated before it is actually written to the storage back end to save
965precious backup space.
966@end itemize")
967 (license license:bsd-2)))