diff options
Diffstat (limited to 'pkgs/development/python-modules/gfal2-util/default.nix')
| -rw-r--r-- | pkgs/development/python-modules/gfal2-util/default.nix | 146 |
1 files changed, 77 insertions, 69 deletions
diff --git a/pkgs/development/python-modules/gfal2-util/default.nix b/pkgs/development/python-modules/gfal2-util/default.nix index 2aabf3b43e88..4294aa48b741 100644 --- a/pkgs/development/python-modules/gfal2-util/default.nix +++ b/pkgs/development/python-modules/gfal2-util/default.nix @@ -1,12 +1,13 @@ -{ lib -, buildPythonPackage -, callPackage -, fetchFromGitHub -, runCommandLocal +{ + lib, + buildPythonPackage, + callPackage, + fetchFromGitHub, + runCommandLocal, # Build inputs -, gfal2-python + gfal2-python, # For tests -, xrootd # pkgs.xrootd + xrootd, # pkgs.xrootd }: (buildPythonPackage rec { pname = "gfal2-util"; @@ -27,13 +28,9 @@ done ''; - propagatedBuildInputs = [ - gfal2-python - ]; + propagatedBuildInputs = [ gfal2-python ]; - pythonImportsCheck = [ - "gfal2_util" - ]; + pythonImportsCheck = [ "gfal2_util" ]; meta = with lib; { description = "CLI for gfal2"; @@ -41,63 +38,74 @@ license = licenses.asl20; maintainers = with maintainers; [ ShamrockLee ]; }; -}).overrideAttrs (finalAttrs: previousAttrs: lib.recursiveUpdate previousAttrs { - passthru = { - inherit (gfal2-python) gfal2; +}).overrideAttrs + ( + finalAttrs: previousAttrs: + lib.recursiveUpdate previousAttrs { + passthru = { + inherit (gfal2-python) gfal2; - fetchGfal2 = lib.makeOverridable (callPackage ./fetchgfal2.nix { gfal2-util = finalAttrs.finalPackage; }); + fetchGfal2 = lib.makeOverridable ( + callPackage ./fetchgfal2.nix { gfal2-util = finalAttrs.finalPackage; } + ); - # With these functionality tests, it should be safe to merge version bumps once all the tests are passed. - tests = - let - # Use the the bin output hash of gfal2-util as version to ensure that - # the test gets rebuild everytime gfal2-util gets rebuild - versionFODTests = finalAttrs.version + "-" + lib.substring (lib.stringLength builtins.storeDir + 1) 32 "${self}"; - self = finalAttrs.finalPackage; - in - lib.optionalAttrs gfal2-python.gfal2.enablePluginStatus.xrootd ( - let - # Test against a real-world dataset from CERN Open Data - # borrowed from `xrootd.tests`. - urlTestFile = xrootd.tests.test-xrdcp.url; - hashTestFile = xrootd.tests.test-xrdcp.outputHash; - urlTestDir = dirOf urlTestFile; - in - { - test-copy-file-xrootd = finalAttrs.passthru.fetchGfal2 { - url = urlTestFile; - hash = hashTestFile; - extraGfalCopyFlags = [ "--verbose" ]; - pname = "gfal2-util-test-copy-file-xrootd"; - version = versionFODTests; - allowSubstitutes = false; - }; + # With these functionality tests, it should be safe to merge version bumps once all the tests are passed. + tests = + let + # Use the the bin output hash of gfal2-util as version to ensure that + # the test gets rebuild everytime gfal2-util gets rebuild + versionFODTests = + finalAttrs.version + "-" + lib.substring (lib.stringLength builtins.storeDir + 1) 32 "${self}"; + self = finalAttrs.finalPackage; + in + lib.optionalAttrs gfal2-python.gfal2.enablePluginStatus.xrootd ( + let + # Test against a real-world dataset from CERN Open Data + # borrowed from `xrootd.tests`. + urlTestFile = xrootd.tests.test-xrdcp.url; + hashTestFile = xrootd.tests.test-xrdcp.outputHash; + urlTestDir = dirOf urlTestFile; + in + { + test-copy-file-xrootd = finalAttrs.passthru.fetchGfal2 { + url = urlTestFile; + hash = hashTestFile; + extraGfalCopyFlags = [ "--verbose" ]; + pname = "gfal2-util-test-copy-file-xrootd"; + version = versionFODTests; + allowSubstitutes = false; + }; - test-copy-dir-xrootd = finalAttrs.passthru.fetchGfal2 { - url = urlTestDir; - hash = "sha256-vOahIhvx1oE9sfkqANMGUvGeLHS737wyfYWo4rkvrxw="; - recursive = true; - extraGfalCopyFlags = [ "--verbose" ]; - pname = "gfal2-util-test-copy-dir-xrootd"; - version = versionFODTests; - allowSubstitutes = false; - }; + test-copy-dir-xrootd = finalAttrs.passthru.fetchGfal2 { + url = urlTestDir; + hash = "sha256-vOahIhvx1oE9sfkqANMGUvGeLHS737wyfYWo4rkvrxw="; + recursive = true; + extraGfalCopyFlags = [ "--verbose" ]; + pname = "gfal2-util-test-copy-dir-xrootd"; + version = versionFODTests; + allowSubstitutes = false; + }; - test-ls-dir-xrootd = (runCommandLocal "test-gfal2-util-ls-dir-xrootd" { } '' - set -eu -o pipefail - gfal-ls "$url" | grep "$baseNameExpected" | tee "$out" - '').overrideAttrs (finalAttrs: previousAttrs: { - pname = previousAttrs.name; - version = versionFODTests; - name = "${finalAttrs.pname}-${finalAttrs.version}"; - nativeBuildInputs = [ self ]; - url = urlTestDir; - baseNameExpected = baseNameOf urlTestFile; - outputHashMode = "flat"; - outputHashAlgo = "sha256"; - outputHash = builtins.hashString finalAttrs.outputHashAlgo (finalAttrs.baseNameExpected + "\n"); - }); - } - ); - }; -}) + test-ls-dir-xrootd = + (runCommandLocal "test-gfal2-util-ls-dir-xrootd" { } '' + set -eu -o pipefail + gfal-ls "$url" | grep "$baseNameExpected" | tee "$out" + '').overrideAttrs + ( + finalAttrs: previousAttrs: { + pname = previousAttrs.name; + version = versionFODTests; + name = "${finalAttrs.pname}-${finalAttrs.version}"; + nativeBuildInputs = [ self ]; + url = urlTestDir; + baseNameExpected = baseNameOf urlTestFile; + outputHashMode = "flat"; + outputHashAlgo = "sha256"; + outputHash = builtins.hashString finalAttrs.outputHashAlgo (finalAttrs.baseNameExpected + "\n"); + } + ); + } + ); + }; + } + ) |
