file(COPY): cannot find file that was just created
This issue only happens once in a 10k builds, but this time I got it logged.
This is from https://koji.fedoraproject.org/koji/taskinfo?taskID=94667057, the aarch64 build. Build log here
In short, we get an error like:
[ 1%] Generating csg_call
...
cd /builddir/build/BUILD/votca-2022/redhat-linux-build/csg/scripts && /usr/bin/cmake -DINPUT="csg_inverse.in2" -DOUTPUT="csg_inverse" -DGIT_EXECUTABLE="" -DTOP_SOURCE_DIR="/builddir/build/BUILD/votca-2022" -P /builddir/build/BUILD/votca-2022/csg/CMakeModules/gitscript.cmake
CMake Error at /builddir/build/BUILD/votca-2022/csg/CMakeModules/gitscript.cmake:25 (file):
file COPY cannot find
"/builddir/build/BUILD/votca-2022/redhat-linux-build/csg/scripts/csg_call.tmp":
No such file or directory.
but looking into gitscript.cmake
, it has:
file(WRITE "${OUTPUT}.tmp" "${NEW_CONTENT}")
file(COPY "${OUTPUT}.tmp" DESTINATION "${OUTPUT}.tmp.x" FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
So the file is written directly before it is copied, so no idea how the error can actually happen. I guess this must be some kind of parallel build issue.
Maybe the solution is to do it one step with file(GENERATE)
.