2020-01-05 17:01:50 +01:00
|
|
|
{ stdenv
|
|
|
|
, fetchpatch
|
|
|
|
, fetchurl
|
|
|
|
, pythonPackages
|
|
|
|
, librsync
|
|
|
|
, ncftp
|
|
|
|
, gnupg
|
2019-05-04 02:16:54 +02:00
|
|
|
, gnutar
|
|
|
|
, par2cmdline
|
|
|
|
, utillinux
|
2019-09-19 22:27:06 +02:00
|
|
|
, rsync
|
2020-01-05 17:01:50 +01:00
|
|
|
, backblaze-b2
|
|
|
|
, makeWrapper
|
2020-03-11 12:43:50 +01:00
|
|
|
, gettext
|
2020-01-05 17:01:50 +01:00
|
|
|
}:
|
2020-03-11 12:43:50 +01:00
|
|
|
let
|
|
|
|
inherit (stdenv.lib.versions) majorMinor splitVersion;
|
|
|
|
majorMinorPatch = v: builtins.concatStringsSep "." (stdenv.lib.take 3 (splitVersion v));
|
|
|
|
in
|
2020-01-05 17:01:50 +01:00
|
|
|
pythonPackages.buildPythonApplication rec {
|
2019-08-31 13:41:23 +02:00
|
|
|
pname = "duplicity";
|
2020-05-20 14:31:33 +02:00
|
|
|
version = "0.8.13";
|
2010-02-04 14:42:41 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2020-03-11 12:43:50 +01:00
|
|
|
url = "https://code.launchpad.net/duplicity/${majorMinor version}-series/${majorMinorPatch version}/+download/duplicity-${version}.tar.gz";
|
2020-05-20 14:31:33 +02:00
|
|
|
sha256 = "0lflg1ay4q4w9qzpmh6y2hza4fc3ig12q44qkd80ks17hj21bxa6";
|
2010-02-04 14:42:41 +01:00
|
|
|
};
|
2020-01-05 17:01:50 +01:00
|
|
|
|
2019-05-04 02:16:54 +02:00
|
|
|
patches = [
|
2020-01-05 17:01:50 +01:00
|
|
|
# We use the tar binary on all platforms.
|
2019-05-04 02:16:54 +02:00
|
|
|
./gnutar-in-test.patch
|
2019-06-03 08:13:21 +02:00
|
|
|
|
2020-01-05 17:01:50 +01:00
|
|
|
# Our Python infrastructure runs test in installCheckPhase so we need
|
|
|
|
# to make the testing code stop assuming it is run from the source directory.
|
|
|
|
./use-installed-scripts-in-test.patch
|
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
|
|
|
|
2020-03-11 12:43:50 +01:00
|
|
|
nativeBuildInputs = [
|
2020-01-05 17:01:50 +01:00
|
|
|
makeWrapper
|
2020-03-11 12:43:50 +01:00
|
|
|
gettext
|
2020-01-05 17:01:50 +01:00
|
|
|
pythonPackages.wrapPython
|
|
|
|
];
|
2020-03-11 12:43:50 +01:00
|
|
|
buildInputs = [
|
|
|
|
librsync
|
|
|
|
];
|
2020-01-05 17:01:50 +01:00
|
|
|
|
2020-08-17 21:56:47 +02:00
|
|
|
propagatedBuildInputs = with pythonPackages; [
|
|
|
|
b2sdk
|
2020-01-05 17:01:50 +01:00
|
|
|
boto
|
|
|
|
cffi
|
|
|
|
cryptography
|
|
|
|
ecdsa
|
|
|
|
idna
|
|
|
|
pygobject3
|
|
|
|
fasteners
|
|
|
|
ipaddress
|
|
|
|
lockfile
|
|
|
|
paramiko
|
|
|
|
pyasn1
|
|
|
|
pycrypto
|
|
|
|
pydrive
|
|
|
|
future
|
|
|
|
] ++ stdenv.lib.optionals (!isPy3k) [
|
|
|
|
enum
|
2020-08-17 21:56:47 +02:00
|
|
|
];
|
2020-01-05 17:01:50 +01:00
|
|
|
|
2019-05-04 02:16:54 +02:00
|
|
|
checkInputs = [
|
2020-01-05 17:01:50 +01:00
|
|
|
gnupg # Add 'gpg' to PATH.
|
|
|
|
gnutar # Add 'tar' to PATH.
|
|
|
|
librsync # Add 'rdiff' to PATH.
|
|
|
|
par2cmdline # Add 'par2' to PATH.
|
2019-05-04 02:16:54 +02:00
|
|
|
] ++ stdenv.lib.optionals stdenv.isLinux [
|
2020-01-05 17:01:50 +01:00
|
|
|
utillinux # Add 'setsid' to PATH.
|
|
|
|
] ++ (with pythonPackages; [
|
|
|
|
lockfile
|
|
|
|
mock
|
|
|
|
pexpect
|
|
|
|
pytest
|
|
|
|
pytestrunner
|
|
|
|
]);
|
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 ]}"
|
2017-03-24 10:48:00 +01:00
|
|
|
'';
|
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";
|
2020-01-05 17:01:50 +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
|
|
|
};
|
|
|
|
}
|