Fix Ubuntu OpenJPEG provisioning (#113)
Some checks failed
Native code generation / deterministic (push) Successful in 14m51s
Imaging and meshing gate / native (push) Failing after 2m1s
JPEG 2000 feature / linux (push) Successful in 2m42s
Native Rust workspace compile / compile (push) Has been cancelled

This commit is contained in:
2026-08-10 11:57:42 +00:00
parent ed516a1a5d
commit b64020d45b
5 changed files with 87 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ on:
- "codegen/**" - "codegen/**"
- "tools/codegen/**" - "tools/codegen/**"
- "tools/generate_*.py" - "tools/generate_*.py"
- "tools/install_openjpeg_2_5_4.sh"
- "tools/check_api_coverage.py" - "tools/check_api_coverage.py"
- "tools/check_codegen_gate.py" - "tools/check_codegen_gate.py"
- "tools/check_milestone_08.py" - "tools/check_milestone_08.py"
@@ -51,6 +52,7 @@ on:
- "codegen/**" - "codegen/**"
- "tools/codegen/**" - "tools/codegen/**"
- "tools/generate_*.py" - "tools/generate_*.py"
- "tools/install_openjpeg_2_5_4.sh"
- "tools/check_api_coverage.py" - "tools/check_api_coverage.py"
- "tools/check_codegen_gate.py" - "tools/check_codegen_gate.py"
- "tools/check_milestone_08.py" - "tools/check_milestone_08.py"
@@ -88,11 +90,20 @@ on:
jobs: jobs:
deterministic: deterministic:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
OPENJPEG_PREFIX: /tmp/metacrate-openjpeg-${{ github.run_id }}
PKG_CONFIG_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib/pkgconfig
LD_LIBRARY_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
components: clippy,rustfmt components: clippy,rustfmt
- name: Install audited OpenJPEG 2.5.4
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake pkg-config
tools/install_openjpeg_2_5_4.sh "$OPENJPEG_PREFIX"
- name: Test diagnostics and byte-identical generation - name: Test diagnostics and byte-identical generation
run: cargo test -p libremetaverse-codegen run: cargo test -p libremetaverse-codegen
- name: Verify vendored hashes and checked-in output - name: Verify vendored hashes and checked-in output

View File

@@ -21,6 +21,7 @@ on:
- "tests/compat/tests/imaging_meshing_semantics.rs" - "tests/compat/tests/imaging_meshing_semantics.rs"
- "tests/upstream-tests.json" - "tests/upstream-tests.json"
- "tools/check_milestone_06.py" - "tools/check_milestone_06.py"
- "tools/install_openjpeg_2_5_4.sh"
pull_request: pull_request:
paths: paths:
- ".gitea/workflows/imaging-meshing.yml" - ".gitea/workflows/imaging-meshing.yml"
@@ -41,6 +42,7 @@ on:
- "tests/compat/tests/imaging_meshing_semantics.rs" - "tests/compat/tests/imaging_meshing_semantics.rs"
- "tests/upstream-tests.json" - "tests/upstream-tests.json"
- "tools/check_milestone_06.py" - "tools/check_milestone_06.py"
- "tools/install_openjpeg_2_5_4.sh"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@@ -48,6 +50,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
RUSTDOCFLAGS: -D warnings RUSTDOCFLAGS: -D warnings
OPENJPEG_PREFIX: /tmp/metacrate-openjpeg-${{ github.run_id }}
PKG_CONFIG_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib/pkgconfig
LD_LIBRARY_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-python@v5 - uses: actions/setup-python@v5
@@ -56,6 +61,11 @@ jobs:
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
components: clippy,rustfmt components: clippy,rustfmt
- name: Install audited OpenJPEG 2.5.4
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake pkg-config
tools/install_openjpeg_2_5_4.sh "$OPENJPEG_PREFIX"
- name: Audit milestone ownership and feature isolation - name: Audit milestone ownership and feature isolation
run: python tools/check_milestone_06.py run: python tools/check_milestone_06.py
- name: Test native imaging and meshing crates - name: Test native imaging and meshing crates

View File

@@ -10,6 +10,7 @@ on:
- "crates/libremetaverse-types/**" - "crates/libremetaverse-types/**"
- "crates/libremetaverse-imaging/**" - "crates/libremetaverse-imaging/**"
- "crates/libremetaverse-openjpeg/**" - "crates/libremetaverse-openjpeg/**"
- "tools/install_openjpeg_2_5_4.sh"
pull_request: pull_request:
paths: paths:
- ".gitea/workflows/jpeg2000.yml" - ".gitea/workflows/jpeg2000.yml"
@@ -19,16 +20,18 @@ on:
- "crates/libremetaverse-types/**" - "crates/libremetaverse-types/**"
- "crates/libremetaverse-imaging/**" - "crates/libremetaverse-imaging/**"
- "crates/libremetaverse-openjpeg/**" - "crates/libremetaverse-openjpeg/**"
- "tools/install_openjpeg_2_5_4.sh"
workflow_dispatch: workflow_dispatch:
jobs: jobs:
linux: linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
# Ubuntu 24.04 also ships an older libopenjp2.so.7. Ensure both # Ubuntu also ships an older libopenjp2.so.7. Ensure both pkg-config and
# pkg-config and the runtime loader select the audited 2.5.4 install. # the runtime loader select this run's isolated, audited 2.5.4 install.
PKG_CONFIG_PATH: /usr/local/lib/pkgconfig OPENJPEG_PREFIX: /tmp/metacrate-openjpeg-${{ github.run_id }}
LD_LIBRARY_PATH: /usr/local/lib PKG_CONFIG_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib/pkgconfig
LD_LIBRARY_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
@@ -36,12 +39,7 @@ jobs:
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install --yes build-essential cmake pkg-config sudo apt-get install --yes build-essential cmake pkg-config
git clone --branch v2.5.4 --depth 1 https://github.com/uclouvain/openjpeg.git /tmp/openjpeg-2.5.4 tools/install_openjpeg_2_5_4.sh "$OPENJPEG_PREFIX"
cmake -S /tmp/openjpeg-2.5.4 -B /tmp/openjpeg-build -DBUILD_CODEC=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release
cmake --build /tmp/openjpeg-build --parallel
sudo cmake --install /tmp/openjpeg-build
sudo ldconfig
test "$(pkg-config --modversion libopenjp2)" = "2.5.4"
- name: Build and test optional feature - name: Build and test optional feature
run: | run: |
cargo test -p libremetaverse-imaging --features jpeg2000 cargo test -p libremetaverse-imaging --features jpeg2000

View File

@@ -4,12 +4,14 @@ on:
push: push:
paths: paths:
- ".gitea/workflows/rust-workspace.yml" - ".gitea/workflows/rust-workspace.yml"
- "tools/install_openjpeg_2_5_4.sh"
- "**/*.rs" - "**/*.rs"
- "**/Cargo.toml" - "**/Cargo.toml"
- "Cargo.lock" - "Cargo.lock"
pull_request: pull_request:
paths: paths:
- ".gitea/workflows/rust-workspace.yml" - ".gitea/workflows/rust-workspace.yml"
- "tools/install_openjpeg_2_5_4.sh"
- "**/*.rs" - "**/*.rs"
- "**/Cargo.toml" - "**/Cargo.toml"
- "Cargo.lock" - "Cargo.lock"
@@ -18,11 +20,20 @@ on:
jobs: jobs:
compile: compile:
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
OPENJPEG_PREFIX: /tmp/metacrate-openjpeg-${{ github.run_id }}
PKG_CONFIG_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib/pkgconfig
LD_LIBRARY_PATH: /tmp/metacrate-openjpeg-${{ github.run_id }}/lib
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable - uses: dtolnay/rust-toolchain@stable
with: with:
components: rustfmt components: rustfmt
- name: Install audited OpenJPEG 2.5.4
run: |
sudo apt-get update
sudo apt-get install --yes build-essential cmake pkg-config
tools/install_openjpeg_2_5_4.sh "$OPENJPEG_PREFIX"
- name: Check formatting - name: Check formatting
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Audit native milestone 09 boundaries - name: Audit native milestone 09 boundaries

47
tools/install_openjpeg_2_5_4.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/sh
set -eu
OPENJPEG_VERSION=2.5.4
OPENJPEG_COMMIT=6c4a29b00211eb0430fa0e5e890f1ce5c80f409f
if [ "$#" -ne 1 ] || [ -z "$1" ]; then
echo "usage: $0 INSTALL_PREFIX" >&2
exit 2
fi
install_prefix=$1
pkg_config_path="$install_prefix/lib/pkgconfig"
if [ -f "$pkg_config_path/libopenjp2.pc" ] &&
PKG_CONFIG_PATH="$pkg_config_path" pkg-config --exact-version "$OPENJPEG_VERSION" libopenjp2
then
exit 0
fi
work_dir=$(mktemp -d "${TMPDIR:-/tmp}/metacrate-openjpeg.XXXXXX")
trap 'rm -rf "$work_dir"' EXIT HUP INT TERM
source_dir="$work_dir/source"
build_dir="$work_dir/build"
git clone --branch "v$OPENJPEG_VERSION" --depth 1 \
https://github.com/uclouvain/openjpeg.git "$source_dir"
actual_commit=$(git -C "$source_dir" rev-parse HEAD)
if [ "$actual_commit" != "$OPENJPEG_COMMIT" ]; then
echo "OpenJPEG v$OPENJPEG_VERSION resolved to unexpected commit $actual_commit" >&2
exit 1
fi
cmake -S "$source_dir" -B "$build_dir" \
-DBUILD_CODEC=OFF \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_INSTALL_PREFIX="$install_prefix"
cmake --build "$build_dir" --parallel
cmake --install "$build_dir"
PKG_CONFIG_PATH="$pkg_config_path" pkg-config --exact-version "$OPENJPEG_VERSION" libopenjp2