Skip to content

Commit aa7e780

Browse files
committed
ci(temp): _dump_diagnostics writes to /tmp/ocv_diag.txt (not swallowed log.error)
Per review: mcpp/xlings interface mode swallows the hook's log.* output, so log.error was useless for surfacing the build log. Write the failure detail (build log / raised error / PATH) to /tmp/ocv_diag.txt and cat it in the CI diagnostic step — the file+external-cat pattern, same as the trace.
1 parent 7d6c502 commit aa7e780

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/validate.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ jobs:
204204
run: |
205205
echo "=== opencv install() trace ==="
206206
cat /tmp/ocv_trace.txt 2>/dev/null || echo "(no trace)"
207+
echo "=== opencv install() diag (build log / error, written by the hook) ==="
208+
cat /tmp/ocv_diag.txt 2>/dev/null || echo "(no diag)"
207209
echo "=== opencv build log(s) ==="
208210
find "$GITHUB_WORKSPACE" "$HOME" -name 'mcpp_opencv_build.log' 2>/dev/null | while read -r f; do
209211
echo "--- $f ---"; cat "$f"; echo "--- end ---"

pkgs/c/compat.opencv.lua

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,17 +351,19 @@ end
351351
-- mode suppresses the cmake/make subprocess stdout, so without this a failed CI
352352
-- build is invisible (the only symptom is the downstream "opencv2/core.hpp: No
353353
-- such file"). Fires whether _install_impl raised or returned false.
354+
-- xlings' interface mode swallows log.*/subprocess output, so write the failure
355+
-- detail to a file the CI step can `cat` instead of logging it.
354356
local function _dump_diagnostics(raised, err)
355-
if raised then
356-
log.error("compat.opencv install() raised: %s", tostring(err))
357-
end
357+
local out = {}
358+
if raised then table.insert(out, "install() raised: " .. tostring(err)) end
358359
local logf = path.join(pkginfo.install_dir(), "mcpp_opencv_build.log")
359360
if os.isfile(logf) then
360-
log.error("---- mcpp_opencv_build.log ----\n%s", tostring(io.readfile(logf)))
361+
table.insert(out, "---- mcpp_opencv_build.log ----\n" .. tostring(io.readfile(logf)))
361362
else
362-
log.error("compat.opencv: no build log at %s", logf)
363-
log.error("compat.opencv: PATH=%s", tostring(os.getenv("PATH")))
363+
table.insert(out, "no build log at " .. logf)
364+
table.insert(out, "PATH=" .. tostring(os.getenv("PATH")))
364365
end
366+
pcall(function() io.writefile("/tmp/ocv_diag.txt", table.concat(out, "\n") .. "\n") end)
365367
end
366368

367369
function install()

0 commit comments

Comments
 (0)