diff --git a/.github/workflows/build-home-assistant-chip-core.yml b/.github/workflows/build-home-assistant-chip-core.yml new file mode 100644 index 000000000000..35b24b446b7b --- /dev/null +++ b/.github/workflows/build-home-assistant-chip-core.yml @@ -0,0 +1,337 @@ +# SPDX-FileCopyrightText: 2026 The RISE Project +# SPDX-License-Identifier: MIT +--- +# This workflow is based on the `build_prepare`/`build_linux_python_lib` jobs of: +# https://github.com/home-assistant-libs/chip-wheels/blob/2025.7.0/.github/workflows/build.yaml +name: Build home-assistant-chip-core wheels (riscv64) + +on: + workflow_dispatch: + inputs: + version: + description: 'Version glob to (re)build; empty builds every version of docs/packages/home-assistant-chip-core.yaml not released yet' + required: false + default: '' + pull_request: + branches: [main] + paths: + - '.github/workflows/build-home-assistant-chip-core.yml' + - 'docs/packages/home-assistant-chip-core.yaml' + - 'patches/home-assistant-chip-core/**' + push: + branches: [main] + paths: + - '.github/workflows/build-home-assistant-chip-core.yml' + - 'docs/packages/home-assistant-chip-core.yaml' + - 'patches/home-assistant-chip-core/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read # to fetch code (actions/checkout) + +env: + # gn/gn git_revision pinned by the Pigweed submodule's cipd_setup/pigweed.json + GN_REVISION: 487f8353f15456474437df32bb186187b0940b45 + # infra/3pp/tools/protoc version pinned by the same pigweed.json + PROTOC_VERSION: '28.2' + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 + +jobs: + setup: + uses: $/.github/workflows/_setup.yml + with: + package: home-assistant-chip-core + version: ${{ inputs.version }} + + # ZAP code generation has no riscv64 build (project-chip/zap ships prebuilt + # Electron/node binaries for x86_64/arm64 only), so it runs once here on a + # regular x86_64 runner, as in chip-wheels' own build_prepare, and + # build_wheels consumes it via chip_code_pre_generated_directory, which + # never invokes ZAP itself. Unlike chip-wheels, only zzz_pregenerated/ is + # handed over, not a tar of the whole SDK: the riscv64 runners download + # Actions artifacts at ~1 MB/s in one non-resumable stream, so that ~4 GB tar + # took over an hour and failed whenever the stream broke, while the same + # checkout and patches straight from GitHub take minutes there. + build_prepare: + name: Prepare home-assistant-chip-core ${{ matrix.version }} + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + runs-on: ubuntu-24.04 + env: + CHIP_VERSION: ${{ matrix.version }} + + steps: + - name: Checkout home-assistant-libs/chip-wheels ${{ env.CHIP_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: home-assistant-libs/chip-wheels + ref: ${{ env.CHIP_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: Checkout connectedhomeip submodules + working-directory: connectedhomeip + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Apply riscv64 patches + working-directory: connectedhomeip + run: git apply ../python-wheels/patches/home-assistant-chip-core/${{ env.CHIP_VERSION }}/*.patch + + - name: Apply chip-wheels patches + working-directory: connectedhomeip + run: | + for patch in ../*.patch; do + echo "Applying ${patch}" + patch -p1 < "$patch" + done + + - name: Bootstrap + working-directory: connectedhomeip + run: bash scripts/bootstrap.sh -p all,linux + + - name: ZAP code pre-generation + working-directory: connectedhomeip + run: scripts/run_in_build_env.sh "scripts/codepregen.py ./zzz_pregenerated/" + + - name: Create ZAP pre-generated code tar + run: tar -caf zzz_pregenerated-${{ env.CHIP_VERSION }}.tar.zst --use-compress-program=zstdmt -C connectedhomeip zzz_pregenerated + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: home-assistant-chip-core-${{ env.CHIP_VERSION }}-zap-pregenerated + path: zzz_pregenerated-${{ env.CHIP_VERSION }}.tar.zst + if-no-files-found: error + + build_wheels: + needs: [setup, build_prepare] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Build home-assistant-chip-core ${{ matrix.version }} cp37-abi3-manylinux_riscv64 + runs-on: ubuntu-24.04-riscv + timeout-minutes: 1440 # full Pigweed/GN/Ninja CHIP SDK compile from source + # container.image can't read the env context, so the image is repeated + # literally here; MANYLINUX_RISCV64_IMAGE below still pins gpl_sources to + # the same one. + container: + image: quay.io/pypa/manylinux_2_39_riscv64 + + defaults: + run: + working-directory: connectedhomeip + + env: + CHIP_VERSION: ${{ matrix.version }} + # CHIP's constraints.txt pins protobuf==5.28.3, which ships binary (upb) + # wheels for x86_64/aarch64 only, so on riscv64 pip picks its + # py3-none-any wheel: the pure-Python backend. That backend has no + # FieldOptions.RegisterExtension, which the extensions_pb2.py bundled in + # the pinned mypy-protobuf 3.5.0 calls, so every protoc --mypy_out step + # in Bootstrap fails. Build protobuf from its sdist instead, which + # compiles the same upb extension the other platforms get. + PIP_NO_BINARY: protobuf + # Pigweed pip-installs its own package with --no-build-isolation, so a + # dependency with no riscv64 wheel is built in the Pigweed venv, which + # has no maturin (or Rust) for cryptography's sdist. Take cryptography + # (pinned to 43.0.1 by patch 0004) and its cffi from our registry. + # Patch 0005 also moves that venv's pip off CHIP's 23.2.1, which lists + # no manylinux_*_riscv64 tags and so can't see these wheels at all + # (gotchas 234/640). + PIP_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ + PIP_ONLY_BINARY: cryptography,cffi + + steps: + - name: Checkout home-assistant-libs/chip-wheels ${{ env.CHIP_VERSION }} + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: home-assistant-libs/chip-wheels + ref: ${{ env.CHIP_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: Install system dependencies + working-directory: ./ + run: | + # cairo-gobject-devel ships cairo-gobject.h; chip-repl's pygobject==3.50.0 + # dependency needs it for its pygi-foreign-cairo.c Cairo integration. + dnf install -y --enablerepo=crb zstd \ + openssl-devel glib2-devel libnl3-devel cairo-devel \ + cairo-gobject-devel gobject-introspection-devel dbus-devel \ + python3-devel libstdc++-static + git config --global --add safe.directory '*' + echo "/opt/python/cp312-cp312/bin" >> "$GITHUB_PATH" + + - name: Checkout connectedhomeip submodules + run: scripts/checkout_submodules.py --shallow --platform linux + + - name: Apply riscv64 patches + run: git apply ../python-wheels/patches/home-assistant-chip-core/${{ env.CHIP_VERSION }}/*.patch + + - name: Apply chip-wheels patches + run: | + for patch in ../*.patch; do + echo "Applying ${patch}" + patch -p1 < "$patch" + done + + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: home-assistant-chip-core-${{ env.CHIP_VERSION }}-zap-pregenerated + + - name: Extract ZAP pre-generated code + run: tar -xaf ../zzz_pregenerated-${{ env.CHIP_VERSION }}.tar.zst --use-compress-program=zstdmt + + # Rocky 10's riscv64 CIPD backend has no fuchsia/third_party/ninja build + # at all, and gn_gen.sh's own gn/ninja fetch goes through the CIPD + # client this job's patched pigweed wrapper.py bootstraps -- same "no + # CIPD gn/ninja on riscv64" situation build-skia-python.yml/ + # build-skia-pathops.yml already solved: build gn from source and get + # ninja from its own riscv64 PyPI wheel, ahead of bootstrap.sh. + # + # gn's own link step passes -static-libstdc++, which needs + # libstdc++.a -- the riscv64 manylinux image doesn't ship it by + # default (CLAUDE.md gotcha 77), hence libstdc++-static above. + - name: Install gn and ninja + run: | + set -e + python3 -m pip install ninja + git clone https://gn.googlesource.com/gn /tmp/gn + git -C /tmp/gn checkout "${GN_REVISION}" + (cd /tmp/gn && CXX=g++ python3 build/gen.py --allow-warnings && ninja -C out gn) + install -m 0755 /tmp/gn/out/gn /usr/local/bin/gn + + # Pigweed's bootstrap runs a bare `protoc` from PATH to generate the + # Python protos, and infra/3pp/tools/protoc has no linux-riscv64 CIPD + # build. CRB's protobuf-compiler (3.19.6) rejects --experimental_editions + # and the riscv64 grpcio-tools bundles protoc 35, whose output won't load + # under CHIP's protobuf==5.28.3, so build Pigweed's own version. The + # well-known .protos go in /opt/protoc/include, found relative to the binary. + - name: Install protoc + run: | + set -e + git clone --depth 1 --branch "v${PROTOC_VERSION}" https://github.com/protocolbuffers/protobuf /tmp/protobuf + git -C /tmp/protobuf submodule update --init --depth 1 third_party/abseil-cpp + cmake -S /tmp/protobuf -B /tmp/protobuf/build -G Ninja \ + -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/protoc \ + -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_LIBUPB=OFF -Dprotobuf_WITH_ZLIB=OFF + cmake --build /tmp/protobuf/build --target protoc + cmake --install /tmp/protobuf/build --component protoc + cmake --install /tmp/protobuf/build --component protobuf-headers + ln -s /opt/protoc/bin/protoc /usr/local/bin/protoc + protoc --version + + - name: Bootstrap + run: bash scripts/bootstrap.sh -p linux + + - name: Setup build and run build + run: | + scripts/build/gn_gen.sh --args=" \ + chip_project_config_include_dirs=[\"//..\"] \ + chip_crypto=\"boringssl\" \ + enable_rtti=true \ + chip_config_memory_debug_checks=false \ + chip_config_memory_debug_dmalloc=false \ + chip_exchange_node_id_logging=true \ + chip_mdns=\"minimal\" \ + chip_minmdns_default_policy=\"libnl\" \ + chip_python_version=\"${{ env.CHIP_VERSION }}\" \ + chip_python_package_prefix=\"home-assistant-chip\" \ + chip_python_platform_tag=\"manylinux_2_39\" \ + chip_code_pre_generated_directory=\"$(pwd)/zzz_pregenerated\" \ + " + scripts/run_in_build_env.sh "ninja -C ./out chip-repl" + + - name: Run Python library specific unit tests + run: | + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_core-${{ env.CHIP_VERSION }}-cp37-abi3-manylinux_2_39_riscv64.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_clusters-${{ env.CHIP_VERSION }}-py3-none-any.whl' + scripts/run_in_build_env.sh 'pip3 install ./out/controller/python/home_assistant_chip_repl-${{ env.CHIP_VERSION }}-py3-none-any.whl' + scripts/run_in_build_env.sh '(cd src/controller/python/test/unit_tests/ && python3 -m unittest -v)' + + # Only chip-core goes in the wheelhouse. The build also emits + # home_assistant_chip_clusters and home_assistant_chip_repl, which the + # unit tests above install, but those are separate PyPI projects that + # upstream already ships as pure-Python py3-none-any wheels (no + # extension, Root-Is-Purelib), so riscv64 installs them from PyPI as is. + # _publish-wheel.yml also publishes exactly one project per run and + # rejects a wheelhouse mixing project names. + - name: Repair wheel + run: | + mkdir -p ../wheelhouse + pip3 install auditwheel + auditwheel repair -w ../wheelhouse --plat manylinux_2_39_riscv64 \ + out/controller/python/home_assistant_chip_core-${{ env.CHIP_VERSION }}-cp37-abi3-manylinux_2_39_riscv64.whl + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: home-assistant-chip-core-${{ env.CHIP_VERSION }}-manylinux_riscv64 + path: wheelhouse/*.whl + if-no-files-found: error + + gpl_sources: + needs: [setup] + if: needs.setup.outputs.versions != '[]' + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + name: Collect GPL sources (glib2, libnl3) for home-assistant-chip-core ${{ matrix.version }} + runs-on: ubuntu-24.04-riscv + env: + CHIP_VERSION: ${{ matrix.version }} + + steps: + # auditwheel vendors the image's libglib-2.0/libgobject-2.0/libgio-2.0 + # (glib2, LGPL) and libnl-3/libnl-route-3 (libnl3, LGPL) into the wheel. + - name: Collect glib2/libnl3 source RPMs from manylinux_riscv64 + uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main + with: + image: ${{ env.MANYLINUX_RISCV64_IMAGE }} + packages: glib2 libnl3 + output: gpl-sources.tar + + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: home-assistant-chip-core-${{ env.CHIP_VERSION }}-gpl-sources + path: gpl-sources.tar + if-no-files-found: error + + publish: + name: Publish home-assistant-chip-core ${{ matrix.version }} + needs: [setup, build_wheels, gpl_sources] + 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: home-assistant-chip-core-${{ matrix.version }}-manylinux_riscv64 + gpl-sources-artifact: home-assistant-chip-core-${{ matrix.version }}-gpl-sources + gpl-sources-description: glib2, libnl3 diff --git a/docs/packages/home-assistant-chip-core.yaml b/docs/packages/home-assistant-chip-core.yaml new file mode 100644 index 000000000000..c7f272eab039 --- /dev/null +++ b/docs/packages/home-assistant-chip-core.yaml @@ -0,0 +1,5 @@ +package-name: home-assistant-chip-core +source-code: https://github.com/home-assistant-libs/chip-wheels +license: Apache-2.0 +versions: +- version: 2025.7.0 diff --git a/patches/home-assistant-chip-core/2025.7.0/0001-pigweed-cipd_setup-wrapper-support-linux-riscv64.patch b/patches/home-assistant-chip-core/2025.7.0/0001-pigweed-cipd_setup-wrapper-support-linux-riscv64.patch new file mode 100644 index 000000000000..4f0f2d88d079 --- /dev/null +++ b/patches/home-assistant-chip-core/2025.7.0/0001-pigweed-cipd_setup-wrapper-support-linux-riscv64.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Thu, 15 Oct 2026 00:00:00 +0000 +Subject: [PATCH] pigweed: cipd_setup/wrapper.py: support linux-riscv64 + +Upstream-Status: To upstream [not yet submitted to google/pigweed] + +cipd_setup/wrapper.py bootstraps the standalone `cipd` client binary +used by Pigweed's env setup. Two separate bugs there make it reject +riscv64 entirely, even though the CIPD backend itself already serves a +linux-riscv64 client (chrome-infra-packages.appspot.com, and +.cipd_version.digests lists a linux-riscv64 sha256 for the pinned +client version): + +- arch_normalized() only special-cases arm/aarch64; everything else + falls through to `machine.endswith('64')`, which maps the literal + string "riscv64" to "amd64" because it also ends in "64". +- SUPPORTED_PLATFORMS is a hardcoded tuple that never listed + "linux-riscv64" to begin with, so client_bytes() would raise + UnsupportedPlatform even with the arch mapping fixed. + +Neither function used by this wheel's actual package-selection logic +(cipd_setup/update.py:platform(), which already falls back to the +literal "riscv64" string) needs a patch; only the client bootstrap +path in this file does. + +Signed-off-by: Ludovic Henry +--- + third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/wrapper.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/wrapper.py b/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/wrapper.py +index 151745d..75228bc 100644 +--- a/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/wrapper.py ++++ b/third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/cipd_setup/wrapper.py +@@ -51,6 +51,7 @@ SUPPORTED_PLATFORMS = ( + 'linux-mipsle', + 'linux-ppc64', + 'linux-ppc64le', ++ 'linux-riscv64', + 'linux-s390x', + 'mac-amd64', + 'mac-arm64', +@@ -135,6 +136,8 @@ def arch_normalized(rosetta=False): + if machine == 'arm64': + return machine + return 'armv6l' ++ if machine == 'riscv64': ++ return machine + if machine.endswith('64'): + return 'amd64' + if machine.endswith('86'): +-- +2.50.1 diff --git a/patches/home-assistant-chip-core/2025.7.0/0002-scripts-setup-exclude-gn-ninja-clang-from-cipd.patch b/patches/home-assistant-chip-core/2025.7.0/0002-scripts-setup-exclude-gn-ninja-clang-from-cipd.patch new file mode 100644 index 000000000000..f7c01be202f9 --- /dev/null +++ b/patches/home-assistant-chip-core/2025.7.0/0002-scripts-setup-exclude-gn-ninja-clang-from-cipd.patch @@ -0,0 +1,55 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Thu, 15 Oct 2026 00:00:00 +0000 +Subject: [PATCH] scripts/setup: exclude gn/ninja/clang from the Pigweed CIPD + fetch on riscv64 + +Upstream-Status: Inappropriate [riscv64 CI infra choice: gn/ninja/clang come from this repo's build-skia-python.yml precedent instead of CIPD, not a bug in gen_pigweed_cipd_json.py] + +fuchsia/third_party/ninja has no linux-riscv64 CIPD build at all (404 +against the live backend, confirmed at the pinned git_revision), and +while gn/gn and fuchsia/third_party/clang both do, chip_python_wheel_action +only runs Python scripts (build-chip-wheel.py) and nothing in +BUILD.gn/python_wheel.gni references clang or protoc directly, so +clang is unnecessary for this build. Reuse the mechanism this file +already uses to keep fuchsia/third_party/rust/ and +infra/3pp/tools/renode out of the generated CIPD package list, instead +of relying on CIPD's riscv64 coverage (or lack of it) for these three +tools: gn is built from source and ninja comes from its own riscv64 +PyPI wheel, exactly as this repo's build-skia-python.yml/ +build-skia-pathops.yml already do for the same gn/Ninja GN-based +family, put on PATH ahead of bootstrap.sh. + +This script runs on both the x86_64 build_prepare job (ZAP codegen, +which genuinely needs gn/ninja/clang from CIPD) and the riscv64 +build_wheels job (which carries over the same patched checkout and +runs its own bootstrap.sh), so the three riscv64-only exclusions are +gated on `platform.machine() == 'riscv64'` rather than applied +unconditionally; the pre-existing rust/renode exclusions are left +unconditional since they are unrelated to riscv64. + +Signed-off-by: Ludovic Henry +--- + scripts/setup/gen_pigweed_cipd_json.py | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/scripts/setup/gen_pigweed_cipd_json.py b/scripts/setup/gen_pigweed_cipd_json.py +index 4fe77aa..8ee7478 100644 +--- a/scripts/setup/gen_pigweed_cipd_json.py ++++ b/scripts/setup/gen_pigweed_cipd_json.py +@@ -25,6 +25,13 @@ _LIST_OF_PACKAGES_TO_EXCLUDE = { + 'infra/3pp/tools/renode', + } + ++if platform.machine() == 'riscv64': ++ _LIST_OF_PACKAGES_TO_EXCLUDE.update({ ++ 'gn/gn/', ++ 'fuchsia/third_party/ninja/', ++ 'fuchsia/third_party/clang/', ++ }) ++ + + def include_package(package: dict) -> bool: + if 'path' in package: +-- +2.50.1 diff --git a/patches/home-assistant-chip-core/2025.7.0/0003-build-support-native-linux-riscv64-hosts.patch b/patches/home-assistant-chip-core/2025.7.0/0003-build-support-native-linux-riscv64-hosts.patch new file mode 100644 index 000000000000..da12b5d8877b --- /dev/null +++ b/patches/home-assistant-chip-core/2025.7.0/0003-build-support-native-linux-riscv64-hosts.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sat, 17 Oct 2026 00:00:00 +0000 +Subject: [PATCH] build: support native linux riscv64 hosts + +Upstream-Status: To upstream [not yet submitted to project-chip/connectedhomeip] + +Two places in the GN build only know about the Linux CPUs upstream +already builds on (x64, x86, arm, arm64), so a native riscv64 host +can't generate the build at all: + +- build/config/BUILDCONFIG.gn picks the default Linux toolchain as + //build/toolchain/linux:linux_${target_cpu}_${compiler}, which on a + riscv64 host is linux_riscv64_gcc, but build/toolchain/linux/BUILD.gn + never defines it. Every target then fails to resolve with "needs + //build/toolchain/linux:linux_riscv64_gcc()", starting with the + `gn gen` Pigweed's bootstrap runs to install the Python packages. + Add it next to the existing ones. It mirrors linux_x64_gcc rather + than the cross-prefixed arm/arm64 ones, since this is a native build + with the host gcc/g++/ar; build/config/compiler/BUILD.gn has no + riscv64-specific flags to add (its "riscv" branch is the embedded + FreeRTOS one), so the compiler's own rv64gc/lp64d defaults apply. +- chip_enable_python_modules defaults to false unless host_cpu is x64, + arm64 or arm, which leaves //src/controller/python:chip-repl out of + the graph (and rejects chip_python_package_prefix as an unused arg + under gn_gen.sh's --fail-on-unused-args). Add riscv64 to that list, + the same way arm was added for Raspbian. + +src/controller/python/BUILD.gn already falls back to cpu_tag = +current_cpu, so the wheel comes out as *_riscv64 with no change there. + +Signed-off-by: Ludovic Henry +--- + BUILD.gn | 3 ++- + build/toolchain/linux/BUILD.gn | 8 ++++++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/BUILD.gn b/BUILD.gn +index 465eccc..88be251 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -43,7 +43,8 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { + declare_args() { + chip_enable_python_modules = + (current_os == "mac" || current_os == "linux") && +- (host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm") ++ (host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm" || ++ host_cpu == "riscv64") + + # Build the Linux all clusters app example with default group + chip_build_all_clusters_app = false +diff --git a/build/toolchain/linux/BUILD.gn b/build/toolchain/linux/BUILD.gn +index abc61ab..5f912cf 100644 +--- a/build/toolchain/linux/BUILD.gn ++++ b/build/toolchain/linux/BUILD.gn +@@ -91,3 +91,11 @@ gcc_toolchain("linux_arm64_clang") { + is_clang = true + } + } ++ ++gcc_toolchain("linux_riscv64_gcc") { ++ toolchain_args = { ++ current_os = "linux" ++ current_cpu = "riscv64" ++ is_clang = false ++ } ++} +-- +2.50.1 diff --git a/patches/home-assistant-chip-core/2025.7.0/0004-scripts-setup-constrain-cryptography-to-43.0.1.patch b/patches/home-assistant-chip-core/2025.7.0/0004-scripts-setup-constrain-cryptography-to-43.0.1.patch new file mode 100644 index 000000000000..90cf09905e27 --- /dev/null +++ b/patches/home-assistant-chip-core/2025.7.0/0004-scripts-setup-constrain-cryptography-to-43.0.1.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 18 Oct 2026 00:00:00 +0000 +Subject: [PATCH] scripts/setup: constrain cryptography to 43.0.1 + +Upstream-Status: Inappropriate [riscv64 wheel availability: cryptography 43.0.0 has no riscv64 wheel, 43.0.1 is on pypi.riseproject.dev] + +Pigweed's pip_install_pigweed_package target (pw_python_pip_install) +always installs the generated `pigweed` package with +--no-build-isolation, so every third-party dependency it pulls in that +has no wheel for the host is built inside the Pigweed venv itself. +cryptography==43.0.0 ships no riscv64 wheel on PyPI, so pip falls back +to its sdist, whose maturin build backend isn't in that venv +(ModuleNotFoundError: No module named 'maturin'); building it would +also need a Rust toolchain the manylinux image doesn't have. + +pypi.riseproject.dev ships cryptography 43.0.1 for riscv64 +(cp39-abi3), a patch release whose only change is the OpenSSL version +compiled into the upstream wheels. Pin that version so the riscv64 +build_wheels job can install it as a wheel. x86_64 (build_prepare) +gets 43.0.1 from PyPI just like 43.0.0. + +Signed-off-by: Ludovic Henry +--- + scripts/setup/constraints.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt +index 905ef7c..89cd541 100644 +--- a/scripts/setup/constraints.txt ++++ b/scripts/setup/constraints.txt +@@ -55,7 +55,7 @@ contextlib2==21.6.0 + # via + # idf-component-manager + # schema +-cryptography==43.0.0 ++cryptography==43.0.1 + # via + # -c constraints.esp32.txt + # -r requirements.all.txt +-- +2.50.1 diff --git a/patches/home-assistant-chip-core/2025.7.0/0005-scripts-setup-constrain-pip-to-24.3.1.patch b/patches/home-assistant-chip-core/2025.7.0/0005-scripts-setup-constrain-pip-to-24.3.1.patch new file mode 100644 index 000000000000..527f3ba819b1 --- /dev/null +++ b/patches/home-assistant-chip-core/2025.7.0/0005-scripts-setup-constrain-pip-to-24.3.1.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Ludovic Henry +Date: Sun, 18 Oct 2026 00:00:00 +0000 +Subject: [PATCH] scripts/setup: constrain pip to 24.3.1 + +Upstream-Status: Inappropriate [riscv64 wheel availability: pip 23.2.1 lists no manylinux_*_riscv64 tags, so it can't install any riscv64 wheel] + +Pigweed's virtualenv setup upgrades the bootstrap venv's pip under +CHIP's constraints.txt, which pins pip==23.2.1. That pip vendors +packaging 21.3, whose manylinux arch allowlist has no riscv64, so on a +riscv64 host it reports only linux_riscv64 tags and treats every +manylinux_*_riscv64 wheel as incompatible. With cryptography taken as a +binary only (patch 0004, PIP_ONLY_BINARY), pip then finds no candidate +for cryptography==43.0.1, even though pypi.riseproject.dev serves it as +cp39-abi3-manylinux_2_35_riscv64, and the install of the generated +`pigweed` package fails with ResolutionImpossible. + +pip 24.1 is the first release whose vendored packaging (24.1) lists +riscv64. Pin 24.3.1, the version this Pigweed revision's own +python_base_requirements.txt pins and the one it already installs in +the GN build venv, which ignores constraints.txt for that step. + +Signed-off-by: Ludovic Henry +--- + scripts/setup/constraints.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt +index 89cd541..2a95ba8 100644 +--- a/scripts/setup/constraints.txt ++++ b/scripts/setup/constraints.txt +@@ -277,7 +277,7 @@ wheel==0.38.4 ; sys_platform == "linux" + # pip-tools + + # The following packages are considered to be unsafe in a requirements file: +-pip==23.2.1 ++pip==24.3.1 + # via + # fastcore + # ghapi +-- +2.50.1