From 2c6dce83de3408c5baa7142ebf06b955f16eb481 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 7 Mar 2025 14:57:12 -0400 Subject: [PATCH] make OUTPUT subdirs Simplifies compute programs. --- Remote/Compute.hs | 5 +++++ doc/design/compute_special_remote_interface.mdwn | 1 - doc/special_remotes/compute/git-annex-compute-imageconvert | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Remote/Compute.hs b/Remote/Compute.hs index d4bcd3359a..c41c1b91dc 100644 --- a/Remote/Compute.hs +++ b/Remote/Compute.hs @@ -476,6 +476,11 @@ runComputeProgram (ComputeProgram program) state (ImmutableState immutablestate) liftIO $ hPutStrLn (stdinHandle p) $ toCommand' (File f) liftIO $ hFlush (stdinHandle p) + -- If the output file is in a subdirectory, make + -- the directories so the compute program doesn't + -- need to. + liftIO $ createDirectoryIfMissing True $ + takeDirectory (subdir f') knownoutput <- case M.lookup f' (computeOutputs $ computeState result) of Nothing -> return False Just mk -> do diff --git a/doc/design/compute_special_remote_interface.mdwn b/doc/design/compute_special_remote_interface.mdwn index 5a55e2fe2c..93da38147b 100644 --- a/doc/design/compute_special_remote_interface.mdwn +++ b/doc/design/compute_special_remote_interface.mdwn @@ -110,6 +110,5 @@ An example `git-annex-compute-foo` shell script follows: echo REPRODUCIBLE if [ -n "$input" ]; then - mkdir -p "$(dirname "$output")" frobnicate --passes="$ANNEX_COMPUTE_passes" <"$input" >"$output" fi diff --git a/doc/special_remotes/compute/git-annex-compute-imageconvert b/doc/special_remotes/compute/git-annex-compute-imageconvert index 16eb14da07..3ecd4c0790 100755 --- a/doc/special_remotes/compute/git-annex-compute-imageconvert +++ b/doc/special_remotes/compute/git-annex-compute-imageconvert @@ -17,6 +17,5 @@ echo "OUTPUT $2" read output if [ -n "$input" ]; then - mkdir -p "$(dirname "$output")" convert "$input" "$output" fi