From 84b30f7ee0c45d5550f4fe6f452791e2c7d9b0fe Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 26 Sep 2026 01:41:54 +0000 Subject: [PATCH 1/3] osmium: Add version 4.3.1 --- .github/workflows/build-osmium.yml | 201 +++++++++++++++++++++++++++++ docs/packages/osmium.yaml | 5 + 2 files changed, 206 insertions(+) create mode 100644 .github/workflows/build-osmium.yml create mode 100644 docs/packages/osmium.yaml diff --git a/.github/workflows/build-osmium.yml b/.github/workflows/build-osmium.yml new file mode 100644 index 00000000000..97e08c1fb7b --- /dev/null +++ b/.github/workflows/build-osmium.yml @@ -0,0 +1,201 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# Based on upstream's own wheel builder: +# https://github.com/osmcode/pyosmium/blob/v4.3.1/.github/workflows/build_wheels.yml +name: Build osmium wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/osmium.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-osmium.yml' + - 'docs/packages/osmium.yaml' + push: + branches: [main] + paths: + - '.github/workflows/build-osmium.yml' + - 'docs/packages/osmium.yaml' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: osmium + version: ${{ inputs.version }} + + build_sdist: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build osmium ${{ matrix.version }} sdist + runs-on: ubuntu-latest + env: + OSMIUM_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout pyosmium v${{ env.OSMIUM_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: osmcode/pyosmium + ref: v${{ env.OSMIUM_VERSION }} + persist-credentials: false + + - name: Install Python + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: '3.14' + activate-environment: true + enable-cache: false + + - name: Get dependencies via sdist + run: | + uv pip install build + python -m build --sdist + + - name: Upload sdist artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: osmium-${{ env.OSMIUM_VERSION }}-sdist + path: dist/*.tar.gz + if-no-files-found: error + + build_wheels: + needs: [setup, build_sdist] + if: needs.setup.outputs.versions != '[]' + name: Build osmium ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + python: ["cp312", "cp313", "cp314", "cp314t"] + + env: + OSMIUM_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout pyosmium v${{ env.OSMIUM_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: osmcode/pyosmium + ref: v${{ env.OSMIUM_VERSION }} + persist-credentials: false + + - name: Download sdist + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: osmium-${{ env.OSMIUM_VERSION }}-sdist + path: dist/ + + # Upstream builds from the checkout once its sdist step has fetched libosmium and + # protozero into contrib/; the test fixtures (*.pbf, *.osc) are not in the sdist. + - name: Stage contrib/ and the licences of what the wheel carries + run: | + tar xzf dist/osmium-*.tar.gz --strip-components=1 --wildcards '*/contrib/*' + cp contrib/libosmium/LICENSE LICENSE.libosmium + cp contrib/protozero/LICENSE LICENSE.protozero + cat > collect-licenses.sh <<'COLLECT_EOF' + #!/bin/bash + # SPDX-FileCopyrightText: 2026 The RISE Project + # SPDX-License-Identifier: MIT + # + # Stage, at the project root, the licence of every image library auditwheel + # vendors into the wheel (zlib is on the manylinux allowlist and stays external). + set -euo pipefail + + project="${1:?usage: collect-licenses.sh }" + + for pkg in expat bzip2-libs lz4-libs; do + mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) + + # Some packages mark it %doc rather than %license, and the image installs no docs. + if [ -z "${files[0]:-}" ]; then + dnf -y --disablerepo=extras reinstall --setopt=tsflags= "$pkg" >/dev/null + mapfile -t files < <(rpm -qd "$pkg" | grep -iE '/(LICEN[CS]E|COPYING)') + fi + + for f in "${files[@]}"; do + [ -f "$f" ] || continue + cp "$f" "$project/LICENSE.${pkg}.$(basename "$f")" + done + compgen -G "$project/LICENSE.$pkg.*" >/dev/null || + { echo "no licence file found for $pkg" >&2; exit 1; } + done + + ls -1 "$project"/LICENSE.* + COLLECT_EOF + + - name: Build wheels + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 + with: + output-dir: wheelhouse/ + only: ${{ matrix.python }}-manylinux_riscv64 + env: + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} + CIBW_TEST_REQUIRES: pytest pytest-httpserver + CIBW_TEST_COMMAND: pytest {project}/test + CIBW_BUILD_FRONTEND: build + CIBW_BEFORE_BUILD_LINUX: >- + yum install -y expat-devel zlib-devel bzip2-devel lz4-devel && + bash {project}/collect-licenses.sh {project} + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + + - name: Check the extensions and licences made it into the wheel + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + sos = {n.split("/")[-1].split(".")[0] for n in names if n.startswith("osmium/") and n.endswith(".so")} + assert {"_osmium", "geom", "index", "io", "area", "filter", "_osm", "_replication"} <= sos, sos + grafted = sorted(n.split("/")[-1] for n in names if n.startswith("osmium.libs/")) + assert all(g.startswith(("libexpat", "libbz2", "liblz4")) for g in grafted), grafted + licences = {n.split("/")[-1] for n in names if ".dist-info/licenses/" in n} - {""} + pkgs = {f.split(".")[1] for f in licences if f.startswith("LICENSE.")} + assert {"LICENSE.TXT", "LICENSE.libosmium", "LICENSE.protozero"} <= licences, licences + assert {"expat", "bzip2-libs", "lz4-libs"} <= pkgs, licences + print(whl, "ok", grafted, sorted(licences)) + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: osmium-${{ env.OSMIUM_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: ./wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish osmium ${{ matrix.version }} + needs: [setup, build_wheels] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + secrets: + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} + with: + artifact-pattern: osmium-${{ matrix.version }}-*-manylinux_riscv64 diff --git a/docs/packages/osmium.yaml b/docs/packages/osmium.yaml new file mode 100644 index 00000000000..f133fb29245 --- /dev/null +++ b/docs/packages/osmium.yaml @@ -0,0 +1,5 @@ +package-name: osmium +source-code: https://github.com/osmcode/pyosmium +license: BSD-2-Clause +versions: +- version: 4.3.1 From 53910237eceb6f35620157c057bfa8771346b744 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 26 Sep 2026 01:44:43 +0000 Subject: [PATCH 2/3] osmium: Add version 4.3.1 --- .github/workflows/build-osmium.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-osmium.yml b/.github/workflows/build-osmium.yml index 97e08c1fb7b..99268914ac7 100644 --- a/.github/workflows/build-osmium.yml +++ b/.github/workflows/build-osmium.yml @@ -113,7 +113,12 @@ jobs: run: | tar xzf dist/osmium-*.tar.gz --strip-components=1 --wildcards '*/contrib/*' cp contrib/libosmium/LICENSE LICENSE.libosmium - cp contrib/protozero/LICENSE LICENSE.protozero + # upstream's sdist include list names a contrib/protozero/LICENSE that protozero + # does not have, so fetch its licences at the commit CMakeLists.txt pins + protozero=$(grep -A1 'mapbox/protozero' CMakeLists.txt | grep -oE '[0-9a-f]{40}') + for f in LICENSE.md LICENSE.from_folly; do + curl -fsSL -o "LICENSE.protozero.$f" "https://raw.githubusercontent.com/mapbox/protozero/$protozero/$f" + done cat > collect-licenses.sh <<'COLLECT_EOF' #!/bin/bash # SPDX-FileCopyrightText: 2026 The RISE Project @@ -172,8 +177,8 @@ jobs: assert all(g.startswith(("libexpat", "libbz2", "liblz4")) for g in grafted), grafted licences = {n.split("/")[-1] for n in names if ".dist-info/licenses/" in n} - {""} pkgs = {f.split(".")[1] for f in licences if f.startswith("LICENSE.")} - assert {"LICENSE.TXT", "LICENSE.libosmium", "LICENSE.protozero"} <= licences, licences - assert {"expat", "bzip2-libs", "lz4-libs"} <= pkgs, licences + assert {"LICENSE.TXT", "LICENSE.libosmium"} <= licences, licences + assert {"protozero", "expat", "bzip2-libs", "lz4-libs"} <= pkgs, licences print(whl, "ok", grafted, sorted(licences)) EOF From 279c8eefa8004342a5535bcc4ab51075f5fc25bf Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sat, 26 Sep 2026 02:04:37 +0000 Subject: [PATCH 3/3] osmium: Add version 4.3.1 --- .github/workflows/build-osmium.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-osmium.yml b/.github/workflows/build-osmium.yml index 99268914ac7..89f44266fcf 100644 --- a/.github/workflows/build-osmium.yml +++ b/.github/workflows/build-osmium.yml @@ -125,12 +125,12 @@ jobs: # SPDX-License-Identifier: MIT # # Stage, at the project root, the licence of every image library auditwheel - # vendors into the wheel (zlib is on the manylinux allowlist and stays external). + # vendors into the wheel (zlib and expat are on the manylinux allowlist and stay external). set -euo pipefail project="${1:?usage: collect-licenses.sh }" - for pkg in expat bzip2-libs lz4-libs; do + for pkg in bzip2-libs lz4-libs; do mapfile -t files < <(rpm -q --licensefiles "$pkg" 2>/dev/null || true) # Some packages mark it %doc rather than %license, and the image installs no docs. @@ -173,12 +173,12 @@ jobs: names = zipfile.ZipFile(whl).namelist() sos = {n.split("/")[-1].split(".")[0] for n in names if n.startswith("osmium/") and n.endswith(".so")} assert {"_osmium", "geom", "index", "io", "area", "filter", "_osm", "_replication"} <= sos, sos - grafted = sorted(n.split("/")[-1] for n in names if n.startswith("osmium.libs/")) - assert all(g.startswith(("libexpat", "libbz2", "liblz4")) for g in grafted), grafted + grafted = sorted(n.split("/")[-1] for n in names if n.startswith("osmium.libs/") and not n.endswith("/")) + assert [g.split("-")[0] for g in grafted] == ["libbz2", "liblz4"], grafted licences = {n.split("/")[-1] for n in names if ".dist-info/licenses/" in n} - {""} pkgs = {f.split(".")[1] for f in licences if f.startswith("LICENSE.")} assert {"LICENSE.TXT", "LICENSE.libosmium"} <= licences, licences - assert {"protozero", "expat", "bzip2-libs", "lz4-libs"} <= pkgs, licences + assert {"protozero", "bzip2-libs", "lz4-libs"} <= pkgs, licences print(whl, "ok", grafted, sorted(licences)) EOF