ci: create the registry src dir before patching ocio-sys

On a fresh runner registry/src has no hash subdir yet, so the unpack
glob never expanded and the step exited 2; derive it from the cache
dir and assert the patched file exists at the end.
This commit is contained in:
2026-08-21 03:34:45 +08:00
parent c9d557e127
commit e8aac4a30d
2 changed files with 22 additions and 8 deletions
+11 -4
View File
@@ -290,17 +290,24 @@ jobs:
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
echo "OCIO_RS_LINK=static" >> "$GITHUB_ENV"
# cargo fetch only downloads the .crate archives; unpack ocio-sys
# so the vendored yaml-cpp can be patched before the build.
# so the vendored yaml-cpp can be patched before the build. The
# registry src dir may not exist yet on a fresh runner — create
# it from the cache dir's hash. The trailing ls asserts the
# patched file actually exists.
cargo fetch --locked
for dir in "$HOME"/.cargo/registry/src/*/; do
if ls "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate >/dev/null 2>&1; then
tar xzf "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate -C "$dir" 2>/dev/null || true
for cache in "$HOME"/.cargo/registry/cache/*/; do
src="$HOME/.cargo/registry/src/$(basename "$cache")"
mkdir -p "$src"
if [ -f "$cache/ocio-sys-0.2.1.crate" ]; then
tar xzf "$cache/ocio-sys-0.2.1.crate" -C "$src"
fi
done
for f in "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp; do
[ -e "$f" ] || continue
grep -q '#include <cstdint>' "$f" || \
sed -i '0,/#include/s||#include <cstdint>\n&|' "$f"
done
ls "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
+11 -4
View File
@@ -126,17 +126,24 @@ jobs:
echo "OCIO_RS_ENABLE_REAL=1" >> "$GITHUB_ENV"
echo "OCIO_RS_LINK=static" >> "$GITHUB_ENV"
# cargo fetch only downloads the .crate archives; unpack ocio-sys
# so the vendored yaml-cpp can be patched before the build.
# so the vendored yaml-cpp can be patched before the build. The
# registry src dir may not exist yet on a fresh runner — create
# it from the cache dir's hash. The trailing ls asserts the
# patched file actually exists.
cargo fetch --locked
for dir in "$HOME"/.cargo/registry/src/*/; do
if ls "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate >/dev/null 2>&1; then
tar xzf "$HOME"/.cargo/registry/cache/*/ocio-sys-0.2.1.crate -C "$dir" 2>/dev/null || true
for cache in "$HOME"/.cargo/registry/cache/*/; do
src="$HOME/.cargo/registry/src/$(basename "$cache")"
mkdir -p "$src"
if [ -f "$cache/ocio-sys-0.2.1.crate" ]; then
tar xzf "$cache/ocio-sys-0.2.1.crate" -C "$src"
fi
done
for f in "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp; do
[ -e "$f" ] || continue
grep -q '#include <cstdint>' "$f" || \
sed -i '0,/#include/s||#include <cstdint>\n&|' "$f"
done
ls "$HOME"/.cargo/registry/src/*/ocio-sys-0.2.1/vendor/OpenColorIO/ext/ocio-rs-deps/yaml-cpp/src/emitterutils.cpp
# ------------------------------------------------------------------
# Caches