From 0961085fe73af5c3a98ec7e8a4cc4126d9610e7f Mon Sep 17 00:00:00 2001 From: Ludovic Henry Date: Sun, 6 Sep 2026 16:18:16 +0200 Subject: [PATCH] qdldl: add build-qdldl.yml for riscv64 wheels Builds riscv64 wheels for qdldl 0.1.9.post1 (the LDL' factorization solver used by the already-merged osqp package), following the build-from-checkout shape used by build-osqp.yml/build-fonttools.yml. The C library is vendored as a git submodule rather than FetchContent (unlike osqp's own C core), so the checkout step needs submodules: true instead. Includes a patch to package the vendored AMD ordering library's BSD-3-Clause licence alongside qdldl-python's own Apache-2.0 LICENSE, mirroring the osqp/osqp-python licensing fix for the same underlying AMD dependency. --- .github/workflows/build-qdldl.yml | 95 +++++++++++++++++++ ...dored-AMD-ordering-library-s-licence.patch | 73 ++++++++++++++ 2 files changed, 168 insertions(+) create mode 100644 .github/workflows/build-qdldl.yml create mode 100644 patches/qdldl/0.1.9.post1/0001-Package-the-vendored-AMD-ordering-library-s-licence.patch diff --git a/.github/workflows/build-qdldl.yml b/.github/workflows/build-qdldl.yml new file mode 100644 index 000000000..40b9e0339 --- /dev/null +++ b/.github/workflows/build-qdldl.yml @@ -0,0 +1,95 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on: https://github.com/osqp/qdldl-python/blob/v0.1.9.post1/.github/workflows/build.yml +name: Build qdldl wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'qdldl version to build (git tag without the leading v, e.g. 0.1.9.post1)' + required: true + default: '0.1.9.post1' + pull_request: + paths: + - '.github/workflows/build-qdldl.yml' + - 'patches/qdldl/**' + +concurrency: + group: ${{ github.workflow }}-${{ inputs.version || '0.1.9.post1' }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # `inputs.version` is empty on pull_request events; default to 0.1.9.post1 there. + QDLDL_VERSION: ${{ inputs.version || '0.1.9.post1' }} + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + + build_wheels: + needs: [setup] + name: Build qdldl ${{ inputs.version || '0.1.9.post1' }} ${{ matrix.python }}-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 90 + strategy: + fail-fast: false + matrix: + python: ["cp312", "cp313", "cp314", "cp314t"] + + steps: + - name: Checkout qdldl-python v${{ env.QDLDL_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: osqp/qdldl-python + ref: v${{ env.QDLDL_VERSION }} + submodules: true + persist-credentials: false + + - name: Checkout python-wheels + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: python-wheels + persist-credentials: false + + - name: Patch qdldl-python source + run: git apply python-wheels/patches/qdldl/${{ env.QDLDL_VERSION }}/*.patch + + - 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 }} + # numpy is a build-time requirement too, and has no riscv64 wheel on + # public PyPI; scipy is only needed at test time. Both are on our registry. + CIBW_ENVIRONMENT: >- + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ + CMAKE_GENERATOR="Unix Makefiles" + CIBW_TEST_ENVIRONMENT: PIP_ONLY_BINARY=numpy,scipy + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: >- + python -c "import importlib.metadata as m; f = sorted(str(p).split('licenses/', 1)[1] for p in m.files('qdldl') if '.dist-info/licenses/' in str(p)); assert f == ['LICENSE', 'LICENSE.amd'], f" && + python -m pytest {project}/tests + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: qdldl-${{ env.QDLDL_VERSION }}-${{ matrix.python }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + publish: + name: Publish qdldl ${{ inputs.version || '0.1.9.post1' }} + needs: [setup, build_wheels] + permissions: + contents: write + pull-requests: write + uses: $/.github/workflows/_publish-wheel.yml + with: + artifact-pattern: qdldl-${{ inputs.version || '0.1.9.post1' }}-*-manylinux_riscv64 diff --git a/patches/qdldl/0.1.9.post1/0001-Package-the-vendored-AMD-ordering-library-s-licence.patch b/patches/qdldl/0.1.9.post1/0001-Package-the-vendored-AMD-ordering-library-s-licence.patch new file mode 100644 index 000000000..64ca506a8 --- /dev/null +++ b/patches/qdldl/0.1.9.post1/0001-Package-the-vendored-AMD-ordering-library-s-licence.patch @@ -0,0 +1,73 @@ +From d8c9182a50051c90bf3797f02d7369669e6173cf Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 6 Sep 2026 16:14:02 +0200 +Subject: [PATCH] Package the vendored AMD ordering library's licence +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The extension statically links libqdldlamd.a, which c/CMakeLists.txt builds +from c/amd (AMD's approximate-minimum-degree ordering routine, vendored from +SuiteSparse under BSD-3-Clause) together with the qdldl object library. The +published wheel nevertheless carries only qdldl-python's own Apache-2.0 +LICENSE in dist-info/licenses/: BSD-3-Clause requires its own copyright +notice and disclaimer to travel with binary redistributions of the code it +covers, which a wheel that omits c/amd/LICENSE does not satisfy. + +setuptools auto-discovers license files at the project root matching +LICEN[CS]E*, so copying c/amd/LICENSE to LICENSE.amd is enough to get it +into dist-info/licenses/ alongside LICENSE — no pyproject.toml/setup.cfg +change needed (verified locally: a wheel built from this tree carries both +licenses/LICENSE and licenses/LICENSE.amd). + +Upstream-Status: To upstream [not yet submitted; the same gap exists in every qdldl wheel on PyPI, so it needs a maintainer discussion rather than a drive-by PR] +--- + LICENSE.amd | 36 ++++++++++++++++++++++++++++++++++++ + 1 file changed, 36 insertions(+) + create mode 100644 LICENSE.amd + +diff --git a/LICENSE.amd b/LICENSE.amd +new file mode 100644 +index 0000000..36de6d8 +--- /dev/null ++++ b/LICENSE.amd +@@ -0,0 +1,36 @@ ++AMD, Copyright (c), 1996-2015, Timothy A. Davis, ++Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. ++ ++Availability: ++ ++ http://www.suitesparse.com ++ ++------------------------------------------------------------------------------- ++AMD License: BSD 3-clause: ++------------------------------------------------------------------------------- ++ ++ Redistribution and use in source and binary forms, with or without ++ modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the organizations to which the authors are ++ affiliated, nor the names of its contributors may be used to endorse ++ or promote products derived from this software without specific prior ++ written permission. ++ ++ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR ++ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER ++ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT ++ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY ++ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH ++ DAMAGE. ++ ++ +-- +2.50.1 (Apple Git-155) +