about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/backup/duplicity/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/backup/duplicity/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/backup/duplicity/default.nix38
1 files changed, 30 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/tools/backup/duplicity/default.nix b/nixpkgs/pkgs/tools/backup/duplicity/default.nix
index 24e1a2954ed6..28929615bcdb 100644
--- a/nixpkgs/pkgs/tools/backup/duplicity/default.nix
+++ b/nixpkgs/pkgs/tools/backup/duplicity/default.nix
@@ -1,6 +1,7 @@
 { lib, stdenv
-, fetchurl
-, pythonPackages
+, fetchFromGitLab
+, fetchpatch
+, python38
 , librsync
 , ncftp
 , gnupg
@@ -12,16 +13,19 @@
 , gettext
 }:
 let
+  pythonPackages = python38.pkgs;
   inherit (lib.versions) majorMinor splitVersion;
   majorMinorPatch = v: builtins.concatStringsSep "." (lib.take 3 (splitVersion v));
 in
 pythonPackages.buildPythonApplication rec {
   pname = "duplicity";
-  version = "0.8.17";
+  version = "0.8.20";
 
-  src = fetchurl {
-    url = "https://code.launchpad.net/duplicity/${majorMinor version}-series/${majorMinorPatch version}/+download/duplicity-${version}.tar.gz";
-    sha256 = "114rwkf9b3h4fcagrx013sb7krc4hafbwl9gawjph2wd9pkv2wx2";
+  src = fetchFromGitLab {
+    owner = "duplicity";
+    repo = "duplicity";
+    rev = "rel.${version}";
+    sha256 = "13ghra0myq6h6yx8qli55bh8dg91nf1hpd8l7d7xamgrw6b188sm";
   };
 
   patches = [
@@ -31,6 +35,13 @@ pythonPackages.buildPythonApplication rec {
     # 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
+
+    # https://gitlab.com/duplicity/duplicity/-/merge_requests/64
+    # remove on next release
+    (fetchpatch {
+      url = "https://gitlab.com/duplicity/duplicity/-/commit/5c229a9b42f67257c747fbc0022c698fec405bbc.patch";
+      sha256 = "05v931rnawfv11cyxj8gykmal8rj5vq2ksdysyr2mb4sl81mi7v0";
+    })
   ] ++ lib.optionals stdenv.isLinux [
     # Broken on Linux in Nix' build environment
     ./linux-disable-timezone-test.patch
@@ -38,6 +49,15 @@ pythonPackages.buildPythonApplication rec {
 
   SETUPTOOLS_SCM_PRETEND_VERSION = version;
 
+  preConfigure = ''
+    # fix version displayed by duplicity --version
+    # see SourceCopy in setup.py
+    ls
+    for i in bin/*.1 duplicity/__init__.py; do
+      substituteInPlace "$i" --replace '$version' "${version}"
+    done
+  '';
+
   nativeBuildInputs = [
     makeWrapper
     gettext
@@ -50,7 +70,6 @@ pythonPackages.buildPythonApplication rec {
 
   pythonPath = with pythonPackages; [
     b2sdk
-    boto
     boto3
     cffi
     cryptography
@@ -81,7 +100,7 @@ pythonPackages.buildPythonApplication rec {
     mock
     pexpect
     pytest
-    pytestrunner
+    pytest-runner
   ]);
 
   postInstall = ''
@@ -102,6 +121,9 @@ pythonPackages.buildPythonApplication rec {
 
     # Don't run developer-only checks (pep8, etc.).
     export RUN_CODE_TESTS=0
+
+    # check version string
+    duplicity --version | grep ${version}
   '' + lib.optionalString stdenv.isDarwin ''
     # Work around the following error when running tests:
     # > Max open files of 256 is too low, should be >= 1024.