Merge pull request #299405 from corngood/duplicity

duplicity: 0.8.23 -> 2.2.3

authored by Sandro and committed by GitHub a853dd4c 9e71ae5d

+79 -145
+2
pkgs/development/python-modules/b2sdk/default.nix
··· 4 4 , fetchFromGitHub 5 5 , glibcLocales 6 6 , importlib-metadata 7 + , packaging 7 8 , logfury 8 9 , pyfakefs 9 10 , pytestCheckHook ··· 41 42 ]; 42 43 43 44 propagatedBuildInputs = [ 45 + packaging 44 46 logfury 45 47 requests 46 48 tqdm
+56 -45
pkgs/tools/backup/duplicity/default.nix
··· 11 11 , rsync 12 12 , makeWrapper 13 13 , gettext 14 + , getconf 15 + , testers 16 + , nix-update-script 14 17 }: 15 18 16 - python3.pkgs.buildPythonApplication rec { 19 + let self = python3.pkgs.buildPythonApplication rec { 17 20 pname = "duplicity"; 18 - version = "0.8.23"; 21 + version = "2.2.3"; 19 22 20 23 src = fetchFromGitLab { 21 24 owner = "duplicity"; 22 25 repo = "duplicity"; 23 26 rev = "rel.${version}"; 24 - sha256 = "0my015zc8751smjgbsysmca7hvdm96cjw5zilqn3zq971nmmrksb"; 27 + hash = "sha256-4IwKqXlG7jh1siuPT5pVgiYB+KlmCzF6+OMPT3I3yTQ="; 25 28 }; 26 29 27 30 patches = [ 28 - # We use the tar binary on all platforms. 29 - ./gnutar-in-test.patch 30 - 31 - # Our Python infrastructure runs test in installCheckPhase so we need 32 - # to make the testing code stop assuming it is run from the source directory. 33 - ./use-installed-scripts-in-test.patch 34 - ] ++ lib.optionals stdenv.isLinux [ 35 - # Broken on Linux in Nix' build environment 36 - ./linux-disable-timezone-test.patch 31 + ./keep-pythonpath-in-testing.patch 37 32 ]; 38 33 39 - preConfigure = '' 40 - # fix version displayed by duplicity --version 41 - # see SourceCopy in setup.py 42 - ls 43 - for i in bin/*.1 duplicity/__init__.py; do 44 - substituteInPlace "$i" --replace '$version' "${version}" 45 - done 34 + postPatch = '' 35 + patchShebangs duplicity/__main__.py 36 + 37 + # don't try to use gtar on darwin/bsd 38 + substituteInPlace testing/functional/test_restart.py \ 39 + --replace-fail 'tarcmd = "gtar"' 'tarcmd = "tar"' 40 + '' + lib.optionalString stdenv.isDarwin '' 41 + # tests try to access these files in the sandbox, but can't deal with EPERM 42 + substituteInPlace testing/unit/test_globmatch.py \ 43 + --replace-fail /var/log /test/log 44 + substituteInPlace testing/unit/test_selection.py \ 45 + --replace-fail /usr/bin /dev 46 + # don't use /tmp/ in tests 47 + substituteInPlace duplicity/backends/_testbackend.py \ 48 + --replace-fail '"/tmp/' 'os.environ.get("TMPDIR")+"/' 46 49 ''; 50 + 51 + disabledTests = lib.optionals stdenv.isDarwin [ 52 + # uses /tmp/ 53 + "testing/unit/test_cli_main.py::CommandlineTest::test_intermixed_args" 54 + ]; 47 55 48 56 nativeBuildInputs = [ 49 57 makeWrapper ··· 80 88 par2cmdline # Add 'par2' to PATH. 81 89 ] ++ lib.optionals stdenv.isLinux [ 82 90 util-linux # Add 'setsid' to PATH. 91 + ] ++ lib.optionals stdenv.isDarwin [ 92 + getconf 83 93 ] ++ (with python3.pkgs; [ 84 94 lockfile 85 95 mock 86 96 pexpect 87 97 pytest 88 98 pytest-runner 99 + fasteners 89 100 ]); 90 101 91 - postInstall = '' 102 + postInstall = let 103 + binPath = lib.makeBinPath ([ 104 + gnupg 105 + ncftp 106 + rsync 107 + ] ++ lib.optionals stdenv.isDarwin [ 108 + getconf 109 + ]); in '' 92 110 wrapProgram $out/bin/duplicity \ 93 - --prefix PATH : "${lib.makeBinPath [ gnupg ncftp rsync ]}" 111 + --prefix PATH : "${binPath}" 94 112 ''; 95 113 96 114 preCheck = '' 115 + # tests need writable $HOME 116 + HOME=$PWD/.home 117 + 97 118 wrapPythonProgramsIn "$PWD/testing/overrides/bin" "$pythonPath" 119 + ''; 98 120 99 - # Add 'duplicity' to PATH for tests. 100 - # Normally, 'setup.py test' adds 'build/scripts-2.7/' to PATH before running 101 - # tests. However, 'build/scripts-2.7/duplicity' is not wrapped, so its 102 - # shebang is incorrect and it fails to run inside Nix' sandbox. 103 - # In combination with use-installed-scripts-in-test.patch, make 'setup.py 104 - # test' use the installed 'duplicity' instead. 105 - PATH="$out/bin:$PATH" 106 - 107 - # Don't run developer-only checks (pep8, etc.). 108 - export RUN_CODE_TESTS=0 121 + doCheck = true; 109 122 110 - # check version string 111 - duplicity --version | grep ${version} 112 - '' + lib.optionalString stdenv.isDarwin '' 113 - # Work around the following error when running tests: 114 - # > Max open files of 256 is too low, should be >= 1024. 115 - # > Use 'ulimit -n 1024' or higher to correct. 116 - ulimit -n 1024 117 - ''; 123 + passthru = { 124 + updateScript = nix-update-script { 125 + extraArgs = [ "--version-regex" "rel\.(.*)" ]; 126 + }; 118 127 119 - # TODO: Fix test failures on macOS 10.13: 120 - # 121 - # > OSError: out of pty devices 122 - doCheck = !stdenv.isDarwin; 128 + tests.version = testers.testVersion { 129 + package = self; 130 + }; 131 + }; 123 132 124 133 meta = with lib; { 125 134 description = "Encrypted bandwidth-efficient backup using the rsync algorithm"; 126 135 homepage = "https://duplicity.gitlab.io/duplicity-web/"; 127 136 license = licenses.gpl2Plus; 128 - maintainers = with maintainers; [ ]; 137 + maintainers = with maintainers; [ corngood ]; 129 138 }; 130 - } 139 + }; 140 + 141 + in self
-20
pkgs/tools/backup/duplicity/gnutar-in-test.patch
··· 1 - diff --git a/testing/functional/test_restart.py b/testing/functional/test_restart.py 2 - index 6d972c82..e8435fd5 100644 3 - --- a/testing/functional/test_restart.py 4 - +++ b/testing/functional/test_restart.py 5 - @@ -350,14 +350,7 @@ class RestartTestWithoutEncryption(RestartTest): 6 - https://launchpad.net/bugs/929067 7 - """ 8 - 9 - - if platform.system().startswith(u'Linux'): 10 - - tarcmd = u"tar" 11 - - elif platform.system().startswith(u'Darwin'): 12 - - tarcmd = u"gtar" 13 - - elif platform.system().endswith(u'BSD'): 14 - - tarcmd = u"gtar" 15 - - else: 16 - - raise Exception(u"Platform %s not supported by tar/gtar." % platform.platform()) 17 - + tarcmd = u"tar" 18 - 19 - # Intial normal backup 20 - self.backup(u"full", u"{0}/testfiles/blocktartest".format(_runtest_dir))
+15
pkgs/tools/backup/duplicity/keep-pythonpath-in-testing.patch
··· 1 + diff --git a/testing/functional/__init__.py b/testing/functional/__init__.py 2 + index 6c82d2c7..22163fa3 100644 3 + --- a/testing/functional/__init__.py 4 + +++ b/testing/functional/__init__.py 5 + @@ -94,8 +94,8 @@ class FunctionalTestCase(DuplicityTestCase): 6 + for item in passphrase_input: 7 + assert isinstance(item, str), f"item {os.fsdecode(item)} in passphrase_input is not unicode" 8 + 9 + - # set python path to be dev directory 10 + - os.environ["PYTHONPATH"] = _top_dir 11 + + # prepend dev directory to python path 12 + + os.environ["PYTHONPATH"] = _top_dir + ":" + os.environ["PYTHONPATH"] 13 + 14 + cmd_list = [] 15 +
-16
pkgs/tools/backup/duplicity/linux-disable-timezone-test.patch
··· 1 - commit f0142706c377b7c133753db57b5c4c90baa2de30 2 - Author: Guillaume Girol <symphorien+git@xlumurb.eu> 3 - Date: Sun Jul 11 17:48:15 2021 +0200 4 - 5 - diff --git a/testing/unit/test_statistics.py b/testing/unit/test_statistics.py 6 - index 4be5000c..80545853 100644 7 - --- a/testing/unit/test_statistics.py 8 - +++ b/testing/unit/test_statistics.py 9 - @@ -63,6 +63,7 @@ class StatsObjTest(UnitTestCase): 10 - s1 = StatsDeltaProcess() 11 - assert s1.get_stat(u'SourceFiles') == 0 12 - 13 - + @unittest.skip("Broken on Linux in Nix' build environment") 14 - def test_get_stats_string(self): 15 - u"""Test conversion of stat object into string""" 16 - s = StatsObj()
-63
pkgs/tools/backup/duplicity/use-installed-scripts-in-test.patch
··· 1 - commit ccd4dd92cd37acce1da20966ad9e4e0c7bcf1709 2 - Author: Guillaume Girol <symphorien+git@xlumurb.eu> 3 - Date: Sun Jul 11 12:00:00 2021 +0000 4 - 5 - use installed duplicity when running tests 6 - 7 - diff --git a/setup.py b/setup.py 8 - index fa474f20..604a242a 100755 9 - --- a/setup.py 10 - +++ b/setup.py 11 - @@ -205,10 +205,6 @@ class TestCommand(test): 12 - except Exception: 13 - pass 14 - 15 - - os.environ[u'PATH'] = u"%s:%s" % ( 16 - - os.path.abspath(build_scripts_cmd.build_dir), 17 - - os.environ.get(u'PATH')) 18 - - 19 - test.run(self) 20 - 21 - 22 - diff --git a/testing/functional/__init__.py b/testing/functional/__init__.py 23 - index 4221576d..3cf44945 100644 24 - --- a/testing/functional/__init__.py 25 - +++ b/testing/functional/__init__.py 26 - @@ -111,7 +111,7 @@ class FunctionalTestCase(DuplicityTestCase): 27 - run_coverage = os.environ.get(u'RUN_COVERAGE', None) 28 - if run_coverage is not None: 29 - cmd_list.extend([u"-m", u"coverage", u"run", u"--source=duplicity", u"-p"]) 30 - - cmd_list.extend([u"{0}/bin/duplicity".format(_top_dir)]) 31 - + cmd_list.extend([u"duplicity"]) 32 - cmd_list.extend(options) 33 - cmd_list.extend([u"-v0"]) 34 - cmd_list.extend([u"--no-print-statistics"]) 35 - diff --git a/testing/functional/test_log.py b/testing/functional/test_log.py 36 - index 9dfc86a6..b9cb55db 100644 37 - --- a/testing/functional/test_log.py 38 - +++ b/testing/functional/test_log.py 39 - @@ -49,9 +49,9 @@ class LogTest(FunctionalTestCase): 40 - # Run actual duplicity command (will fail, because no arguments passed) 41 - basepython = os.environ.get(u'TOXPYTHON', None) 42 - if basepython is not None: 43 - - os.system(u"{0} {1}/bin/duplicity --log-file={2} >/dev/null 2>&1".format(basepython, _top_dir, self.logfile)) 44 - + os.system(u"{0} duplicity --log-file={1} >/dev/null 2>&1".format(basepython, self.logfile)) 45 - else: 46 - - os.system(u"{0}/bin/duplicity --log-file={1} >/dev/null 2>&1".format(_top_dir, self.logfile)) 47 - + os.system(u"duplicity --log-file={0} >/dev/null 2>&1".format(self.logfile)) 48 - 49 - # The format of the file should be: 50 - # """ERROR 2 51 - diff --git a/testing/functional/test_rdiffdir.py b/testing/functional/test_rdiffdir.py 52 - index 0cbfdb33..47acd029 100644 53 - --- a/testing/functional/test_rdiffdir.py 54 - +++ b/testing/functional/test_rdiffdir.py 55 - @@ -44,7 +44,7 @@ class RdiffdirTest(FunctionalTestCase): 56 - basepython = os.environ.get(u'TOXPYTHON', None) 57 - if basepython is not None: 58 - cmd_list.extend([basepython]) 59 - - cmd_list.extend([u"{0}/bin/rdiffdir".format(_top_dir)]) 60 - + cmd_list.extend([u"rdiffdir"]) 61 - cmd_list.extend(argstring.split()) 62 - cmdline = u" ".join([u'"%s"' % x for x in cmd_list]) 63 - self.run_cmd(cmdline)
+6 -1
pkgs/tools/networking/ncftp/default.nix
··· 17 17 # gcc-10. Otherwise build fails as: 18 18 # ld: bookmark.o: (.bss+0x20): multiple definition of `gBm'; 19 19 # gpshare.o:(.bss+0x0): first defined here 20 - env.NIX_CFLAGS_COMPILE = "-fcommon"; 20 + env.NIX_CFLAGS_COMPILE = toString ([ "-fcommon" ] 21 + # these are required for the configure script to work with clang 22 + ++ lib.optionals stdenv.isDarwin [ 23 + "-Wno-implicit-int" 24 + "-Wno-implicit-function-declaration" 25 + ]); 21 26 22 27 preConfigure = '' 23 28 find -name Makefile.in | xargs sed -i '/^TMPDIR=/d'