From e41048f453902de2908da52caea04318c49bae12 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 7 Sep 2026 14:07:04 +0200 Subject: [PATCH 1/2] intbitset: add build-intbitset.yml for riscv64 wheels Build-from-checkout cibuildwheel workflow for intbitset, CERN/Invenio's C-extension integer bitset. Simple self-contained setup.py Extension build, no native deps. --- .github/workflows/build-intbitset.yml | 89 +++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/build-intbitset.yml diff --git a/.github/workflows/build-intbitset.yml b/.github/workflows/build-intbitset.yml new file mode 100644 index 000000000..966f83c58 --- /dev/null +++ b/.github/workflows/build-intbitset.yml @@ -0,0 +1,89 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_wheels` job of +# https://github.com/inveniosoftware-contrib/intbitset/blob/v4.1.2/.github/workflows/test-and-build.yml +name: Build intbitset wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'intbitset version to build (git tag, e.g. v4.1.2)' + required: true + default: 'v4.1.2' + pull_request: + paths: + - '.github/workflows/build-intbitset.yml' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || 'v4.1.2' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + INTBITSET_VERSION: ${{ inputs.version || 'v4.1.2' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build intbitset ${{ inputs.version || 'v4.1.2' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + strategy: + fail-fast: false + matrix: + python: + - "cp312" + - "cp313" + - "cp314" + - "cp314t" + + steps: + - name: Checkout intbitset ${{ env.INTBITSET_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: inveniosoftware-contrib/intbitset + ref: ${{ env.INTBITSET_VERSION }} + persist-credentials: false + + - 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-xdist + CIBW_TEST_COMMAND: pytest {package}/tests -n4 + + - name: Check the C extension made it into the wheel + run: | + python3 - wheelhouse/*.whl <<'EOF' + import sys, zipfile + for whl in sys.argv[1:]: + names = zipfile.ZipFile(whl).namelist() + assert any(n.startswith("intbitset.") and n.endswith(".so") for n in names), (whl, names) + print(whl, "ok") + EOF + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: intbitset-${{ env.INTBITSET_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish intbitset ${{ inputs.version || 'v4.1.2' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: intbitset-${{ inputs.version || 'v4.1.2' }}-*-manylinux_riscv64 From d1736cd92c09c54a5185dbf2b30f6d057ae9eb47 Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Mon, 7 Sep 2026 14:19:29 +0200 Subject: [PATCH 2/2] intbitset: patch test_set_consistency for zlib-ng-compat on riscv64 fastdump()'s test hardcodes the exact zlib-compressed bytes it expects, which only holds for whatever zlib build produced the fixture. The manylinux_riscv64 image links zlib-ng-compat, producing a functionally identical but byte-different compressed stream, so cp313/cp314/cp314t each failed this single assertion (13929/13930 passing). Compare decompressed content instead. --- .github/workflows/build-intbitset.yml | 9 ++++ ...ency-compare-fastdump-by-decompresse.patch | 45 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 patches/intbitset/v4.1.2/0001-test_set_consistency-compare-fastdump-by-decompresse.patch diff --git a/.github/workflows/build-intbitset.yml b/.github/workflows/build-intbitset.yml index 966f83c58..6dff28267 100644 --- a/.github/workflows/build-intbitset.yml +++ b/.github/workflows/build-intbitset.yml @@ -52,6 +52,15 @@ jobs: ref: ${{ env.INTBITSET_VERSION }} persist-credentials: false + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch intbitset source + run: git apply python-wheels/patches/intbitset/${{ env.INTBITSET_VERSION }}/00*.patch + - name: Build wheels uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 with: diff --git a/patches/intbitset/v4.1.2/0001-test_set_consistency-compare-fastdump-by-decompresse.patch b/patches/intbitset/v4.1.2/0001-test_set_consistency-compare-fastdump-by-decompresse.patch new file mode 100644 index 000000000..163d31c1a --- /dev/null +++ b/patches/intbitset/v4.1.2/0001-test_set_consistency-compare-fastdump-by-decompresse.patch @@ -0,0 +1,45 @@ +From 8faa680140e0824c716c234b1e1401d85cd49579 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Mon, 7 Sep 2026 14:18:17 +0200 +Subject: [PATCH] test_set_consistency: compare fastdump() by decompressed + content, not exact zlib bytes + +fastdump() zlib-compresses intbitset's internal representation via the +stdlib zlib module (intbitset.pyx: return zlib.compress(tmp)), and +test_set_consistency hardcodes the exact compressed byte string it expects +back. deflate does not guarantee identical output across zlib builds - only +that decompressing it recovers the original bytes - so the test is only +stable on whatever zlib build produced the fixture data. manylinux_riscv64 +(quay.io/pypa/manylinux_2_39_riscv64) links zlib-ng-compat, which compresses +this input to a functionally identical but byte-different stream, failing +the raw equality on every interpreter (cp313/cp314/cp314t all hit the same +single assertion, 13929/13930 tests otherwise passing). + +Comparing zlib.decompress() of both sides keeps the real check - that +fastdump()'s output decodes back to the expected uncompressed +representation - without assuming a specific zlib build's compression +output. intbitset1 == intbitset3 and intbitset2 == intbitset4 (parsing the +same hardcoded dumped bytes back into a set) already cover fastload()'s +correctness independently. + +Upstream-Status: To upstream [not submitted from this automated port run; needs a pull request against inveniosoftware-contrib/intbitset] +--- + tests/test_intbitset.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/test_intbitset.py b/tests/test_intbitset.py +index 6418b38..c44b0b8 100644 +--- a/tests/test_intbitset.py ++++ b/tests/test_intbitset.py +@@ -762,9 +762,9 @@ def test_set_consistency(original, dumped, dumped_trailing_bits): + check_bitset(intbitset3) + check_bitset(intbitset4) + +- assert intbitset1.fastdump() == dumped ++ assert zlib.decompress(intbitset1.fastdump()) == zlib.decompress(dumped) + assert intbitset1 == intbitset3 +- assert intbitset2.fastdump() == dumped_trailing_bits ++ assert zlib.decompress(intbitset2.fastdump()) == zlib.decompress(dumped_trailing_bits) + assert intbitset2 == intbitset4 + +