2019-06-03 08:13:21 +02:00
|
|
|
{ stdenv, fetchpatch, fetchurl, python2Packages, librsync, ncftp, gnupg
|
2019-05-04 02:16:54 +02:00
|
|
|
, gnutar
|
|
|
|
, par2cmdline
|
|
|
|
, utillinux
|
2019-09-19 22:27:06 +02:00
|
|
|
, rsync
|
|
|
|
, backblaze-b2, makeWrapper }:
|
2010-02-10 17:51:01 +01:00
|
|
|
|
2017-03-24 10:48:00 +01:00
|
|
|
python2Packages.buildPythonApplication rec {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "duplicity";
|
2019-05-04 01:10:49 +02:00
|
|
|
version = "0.7.19";
|
2010-02-04 14:42:41 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-31 13:41:23 +02:00
|
|
|
url = "https://code.launchpad.net/duplicity/${stdenv.lib.versions.majorMinor version}-series/${version}/+download/${pname}-${version}.tar.gz";
|
2019-05-04 01:10:49 +02:00
|
|
|
sha256 = "0ag9dknslxlasslwfjhqgcqbkb1mvzzx93ry7lch2lfzcdd91am6";
|
2010-02-04 14:42:41 +01:00
|
|
|
};
|
2019-05-04 02:16:54 +02:00
|
|
|
patches = [
|
|
|
|
./gnutar-in-test.patch
|
|
|
|
./use-installed-scripts-in-test.patch
|
2019-06-03 08:13:21 +02:00
|
|
|
|
|
|
|
# The following patches improve the performance of installCheckPhase:
|
|
|
|
# Ensure all duplicity output is captured in tests
|
|
|
|
(fetchpatch {
|
|
|
|
extraPrefix = "";
|
|
|
|
sha256 = "07ay3mmnw8p2j3v8yvcpjsx0rf2jqly9ablwjpmry23dz9f0mxsd";
|
|
|
|
url = "https://bazaar.launchpad.net/~duplicity-team/duplicity/0.8-series/diff/1359.2.1";
|
|
|
|
})
|
|
|
|
# Minimize time spent sleeping between backups
|
|
|
|
(fetchpatch {
|
|
|
|
extraPrefix = "";
|
|
|
|
sha256 = "0v99q6mvikb8sf68gh3s0zg12pq8fijs87fv1qrvdnc8zvs4pmfs";
|
|
|
|
url = "https://bazaar.launchpad.net/~duplicity-team/duplicity/0.8-series/diff/1359.2.2";
|
|
|
|
})
|
|
|
|
# Remove unnecessary sleeping after running backups in tests
|
|
|
|
(fetchpatch {
|
|
|
|
extraPrefix = "";
|
|
|
|
sha256 = "1bmgp4ilq2gwz2k73fxrqplf866hj57lbyabaqpkvwxhr0ch1jiq";
|
|
|
|
url = "https://bazaar.launchpad.net/~duplicity-team/duplicity/0.8-series/diff/1359.2.3";
|
|
|
|
})
|
2019-05-04 02:16:54 +02:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isLinux [
|
|
|
|
./linux-disable-timezone-test.patch
|
|
|
|
];
|
2010-02-04 14:42:41 +01:00
|
|
|
|
2017-03-24 10:48:00 +01:00
|
|
|
buildInputs = [ librsync makeWrapper python2Packages.wrapPython ];
|
2019-09-19 22:27:06 +02:00
|
|
|
propagatedBuildInputs = [ backblaze-b2 ] ++ (with python2Packages; [
|
2018-06-15 11:27:31 +02:00
|
|
|
boto cffi cryptography ecdsa enum idna pygobject3 fasteners
|
2019-11-19 16:32:33 +01:00
|
|
|
ipaddress lockfile paramiko pyasn1 pycrypto six pydrive
|
2019-09-19 22:27:06 +02:00
|
|
|
]);
|
2019-05-04 02:16:54 +02:00
|
|
|
checkInputs = [
|
|
|
|
gnupg # Add 'gpg' to PATH.
|
|
|
|
gnutar # Add 'tar' to PATH.
|
|
|
|
librsync # Add 'rdiff' to PATH.
|
|
|
|
par2cmdline # Add 'par2' to PATH.
|
|
|
|
] ++ stdenv.lib.optionals stdenv.isLinux [
|
|
|
|
utillinux # Add 'setsid' to PATH.
|
|
|
|
] ++ (with python2Packages; [ lockfile mock pexpect ]);
|
2017-03-24 10:48:00 +01:00
|
|
|
|
2016-10-27 17:15:18 +02:00
|
|
|
postInstall = ''
|
2010-02-10 17:51:01 +01:00
|
|
|
wrapProgram $out/bin/duplicity \
|
2016-09-09 18:10:19 +02:00
|
|
|
--prefix PATH : "${stdenv.lib.makeBinPath [ gnupg ncftp rsync ]}"
|
2010-02-04 14:42:41 +01:00
|
|
|
|
2017-03-24 10:48:00 +01:00
|
|
|
wrapPythonPrograms
|
|
|
|
'';
|
2016-10-27 17:15:18 +02:00
|
|
|
|
2017-03-24 10:48:00 +01:00
|
|
|
preCheck = ''
|
2019-05-04 02:16:54 +02:00
|
|
|
wrapPythonProgramsIn "$PWD/testing/overrides/bin" "$pythonPath"
|
2016-10-27 17:15:18 +02:00
|
|
|
|
2019-05-04 02:16:54 +02:00
|
|
|
# Add 'duplicity' to PATH for tests.
|
|
|
|
# Normally, 'setup.py test' adds 'build/scripts-2.7/' to PATH before running
|
|
|
|
# tests. However, 'build/scripts-2.7/duplicity' is not wrapped, so its
|
|
|
|
# shebang is incorrect and it fails to run inside Nix' sandbox.
|
|
|
|
# In combination with use-installed-scripts-in-test.patch, make 'setup.py
|
|
|
|
# test' use the installed 'duplicity' instead.
|
|
|
|
PATH="$out/bin:$PATH"
|
|
|
|
|
|
|
|
# Don't run developer-only checks (pep8, etc.).
|
|
|
|
export RUN_CODE_TESTS=0
|
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Work around the following error when running tests:
|
|
|
|
# > Max open files of 256 is too low, should be >= 1024.
|
|
|
|
# > Use 'ulimit -n 1024' or higher to correct.
|
|
|
|
ulimit -n 1024
|
2017-03-24 10:48:00 +01:00
|
|
|
'';
|
2010-02-04 14:42:41 +01:00
|
|
|
|
2019-05-04 02:16:54 +02:00
|
|
|
# TODO: Fix test failures on macOS 10.13:
|
|
|
|
#
|
|
|
|
# > OSError: out of pty devices
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2017-03-24 10:48:00 +01:00
|
|
|
meta = with stdenv.lib; {
|
2010-02-04 14:42:41 +01:00
|
|
|
description = "Encrypted bandwidth-efficient backup using the rsync algorithm";
|
2018-12-01 18:32:32 +01:00
|
|
|
homepage = https://www.nongnu.org/duplicity;
|
2017-03-24 10:48:00 +01:00
|
|
|
license = licenses.gpl2Plus;
|
2018-07-22 21:50:19 +02:00
|
|
|
maintainers = with maintainers; [ peti ];
|
2017-03-24 10:48:00 +01:00
|
|
|
platforms = platforms.unix;
|
2010-02-04 14:42:41 +01:00
|
|
|
};
|
|
|
|
}
|