12 (buildPythonPackage rec {
15 src = fetchFromGitHub {
19 hash = "sha256-3JbJgKD17aYkrB/aaww7IQU8fLFrTCh868KWlLPxmlk=";
22 # Replace the ad-hoc python executable finding
23 # and change the shebangs from `#!/bin/sh` to `#!/usr/bin/env python`
24 # for fixup phase to work correctly.
26 for script in src/gfal-*; do
27 patch "$script" ${./gfal-util-script.patch}
31 propagatedBuildInputs = [ gfal2-python ];
33 pythonImportsCheck = [ "gfal2_util" ];
36 description = "CLI for gfal2";
37 homepage = "https://github.com/cern-fts/gfal2-utils";
38 license = licenses.asl20;
39 maintainers = with maintainers; [ ShamrockLee ];
43 finalAttrs: previousAttrs:
44 lib.recursiveUpdate previousAttrs {
46 inherit (gfal2-python) gfal2;
48 fetchGfal2 = lib.makeOverridable (
49 callPackage ./fetchgfal2.nix { gfal2-util = finalAttrs.finalPackage; }
52 # With these functionality tests, it should be safe to merge version bumps once all the tests are passed.
55 # Use the the bin output hash of gfal2-util as version to ensure that
56 # the test gets rebuild everytime gfal2-util gets rebuild
58 finalAttrs.version + "-" + lib.substring (lib.stringLength builtins.storeDir + 1) 32 "${self}";
59 self = finalAttrs.finalPackage;
61 lib.optionalAttrs gfal2-python.gfal2.enablePluginStatus.xrootd (
63 # Test against a real-world dataset from CERN Open Data
64 # borrowed from `xrootd.tests`.
65 urlTestFile = xrootd.tests.test-xrdcp.url;
66 hashTestFile = xrootd.tests.test-xrdcp.outputHash;
67 urlTestDir = dirOf urlTestFile;
70 test-copy-file-xrootd = finalAttrs.passthru.fetchGfal2 {
73 extraGfalCopyFlags = [ "--verbose" ];
74 pname = "gfal2-util-test-copy-file-xrootd";
75 version = versionFODTests;
76 allowSubstitutes = false;
79 test-copy-dir-xrootd = finalAttrs.passthru.fetchGfal2 {
81 hash = "sha256-vOahIhvx1oE9sfkqANMGUvGeLHS737wyfYWo4rkvrxw=";
83 extraGfalCopyFlags = [ "--verbose" ];
84 pname = "gfal2-util-test-copy-dir-xrootd";
85 version = versionFODTests;
86 allowSubstitutes = false;
90 (runCommandLocal "test-gfal2-util-ls-dir-xrootd" { } ''
92 gfal-ls "$url" | grep "$baseNameExpected" | tee "$out"
95 finalAttrs: previousAttrs: {
96 pname = previousAttrs.name;
97 version = versionFODTests;
98 name = "${finalAttrs.pname}-${finalAttrs.version}";
99 nativeBuildInputs = [ self ];
101 baseNameExpected = baseNameOf urlTestFile;
102 outputHashMode = "flat";
103 outputHashAlgo = "sha256";
104 outputHash = builtins.hashString finalAttrs.outputHashAlgo (finalAttrs.baseNameExpected + "\n");