Skip to content

Commit 00bbf36

Browse files
authored
couchbase: Add version 4.6.3 (#2184)
1 parent 0dad7aa commit 00bbf36

4 files changed

Lines changed: 251 additions & 0 deletions

File tree

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# This workflow is based on upstream's documented wheel build:
5+
# https://github.com/couchbase/couchbase-python-client/blob/4.6.3/BUILDING.md
6+
name: Build couchbase wheels (riscv64)
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version glob to (re)build; empty builds every version of docs/packages/couchbase.yaml not released yet'
13+
required: false
14+
default: ''
15+
pull_request:
16+
branches: [main]
17+
paths:
18+
- '.github/workflows/build-couchbase.yml'
19+
- 'docs/packages/couchbase.yaml'
20+
push:
21+
branches: [main]
22+
paths:
23+
- '.github/workflows/build-couchbase.yml'
24+
- 'docs/packages/couchbase.yaml'
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
28+
cancel-in-progress: true
29+
30+
permissions:
31+
contents: read # to fetch code (actions/checkout)
32+
33+
env:
34+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
35+
36+
jobs:
37+
setup:
38+
uses: $/.github/workflows/_setup.yml
39+
with:
40+
package: couchbase
41+
version: ${{ inputs.version }}
42+
43+
build_sdist:
44+
needs: [setup]
45+
if: needs.setup.outputs.versions != '[]'
46+
name: Build couchbase ${{ matrix.version }} sdist
47+
runs-on: ubuntu-latest
48+
strategy:
49+
fail-fast: false
50+
matrix:
51+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
52+
env:
53+
COUCHBASE_VERSION: ${{ matrix.version }}
54+
55+
steps:
56+
- name: Checkout couchbase ${{ env.COUCHBASE_VERSION }}
57+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
58+
with:
59+
repository: couchbase/couchbase-python-client
60+
ref: ${{ env.COUCHBASE_VERSION }}
61+
submodules: recursive
62+
persist-credentials: false
63+
64+
- name: Install Python
65+
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
66+
with:
67+
python-version: '3.12'
68+
activate-environment: true
69+
enable-cache: false
70+
71+
# configure_ext populates deps/couchbase-cxx-cache, which MANIFEST.in bundles
72+
# into the sdist; without it the riscv job would have to fetch the C++ core's
73+
# dependencies from inside the build container.
74+
- name: Build sdist
75+
run: |
76+
uv pip install build setuptools twine wheel
77+
PYCBC_SET_CPM_CACHE=ON PYCBC_USE_OPENSSL=OFF python setup.py configure_ext
78+
python setup.py sdist
79+
twine check dist/*
80+
env:
81+
CMAKE_POLICY_VERSION_MINIMUM: '3.5'
82+
83+
- name: Upload sdist artifact
84+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
85+
with:
86+
name: couchbase-${{ env.COUCHBASE_VERSION }}-sdist
87+
path: dist/*.tar.gz
88+
if-no-files-found: error
89+
90+
build_wheels:
91+
needs: [setup, build_sdist]
92+
if: needs.setup.outputs.versions != '[]'
93+
name: Build couchbase ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64
94+
runs-on: ubuntu-24.04-riscv
95+
timeout-minutes: 1440
96+
strategy:
97+
fail-fast: false
98+
matrix:
99+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
100+
python: ["cp312", "cp313", "cp314", "cp314t"]
101+
env:
102+
COUCHBASE_VERSION: ${{ matrix.version }}
103+
104+
steps:
105+
- name: Checkout python-wheels
106+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
107+
with:
108+
path: python-wheels
109+
persist-credentials: false
110+
111+
- name: Download sdist
112+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
113+
with:
114+
name: couchbase-${{ env.COUCHBASE_VERSION }}-sdist
115+
path: dist/
116+
117+
# The patches reach files the git checkout does not have in a patchable
118+
# shape: one lives in the CPM cache only the sdist carries, the other
119+
# inside the couchbase-cxx-client submodule.
120+
- name: Extract and patch couchbase source
121+
run: |
122+
mkdir couchbase-src
123+
tar zxf dist/couchbase-*.tar.gz -C couchbase-src --strip-components=1
124+
git apply --directory=couchbase-src python-wheels/patches/couchbase/"${COUCHBASE_VERSION}"/00*.patch
125+
126+
- name: Build wheels
127+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
128+
with:
129+
package-dir: couchbase-src
130+
output-dir: wheelhouse/
131+
only: ${{ matrix.python }}-manylinux_riscv64
132+
env:
133+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
134+
# PYCBC_USE_OPENSSL=OFF is how upstream builds its own wheels: the C++ core
135+
# statically links the vendored BoringSSL instead of the image's OpenSSL.
136+
# CMAKE_POLICY_VERSION_MINIMUM covers the vendored GSL's cmake_minimum_required.
137+
CIBW_ENVIRONMENT: >-
138+
PYCBC_USE_OPENSSL=OFF
139+
PYCBC_CMAKE_PARALLEL_THREADS=$(nproc)
140+
CMAKE_POLICY_VERSION_MINIMUM=3.5
141+
PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/
142+
CIBW_TEST_REQUIRES: pytest
143+
# Upstream's own suite needs a live Couchbase Server, which has no riscv64
144+
# build, so this drives the C++ core directly instead: a bootstrap against an
145+
# unroutable address has to surface as a Couchbase error, not a crash.
146+
CIBW_TEST_COMMAND: >-
147+
python -c "import importlib.metadata as m; f=[str(p) for p in m.files('couchbase')]; assert any(s.endswith('licenses/LICENSE') for s in f), f; import couchbase; from couchbase.logic.pycbc_core import _core; assert _core.__file__.endswith('.so'), _core.__file__; md = couchbase.get_metadata(); assert md['version'], md; assert 'BoringSSL' in md['openssl_runtime'], md; print(md['version'], md['openssl_runtime'])" &&
148+
python -c "import pytest; from datetime import timedelta; from couchbase.auth import PasswordAuthenticator; from couchbase.cluster import Cluster; from couchbase.exceptions import CouchbaseException; from couchbase.options import ClusterOptions, ClusterTimeoutOptions; opts = ClusterOptions(PasswordAuthenticator('u', 'p'), timeout_options=ClusterTimeoutOptions(bootstrap_timeout=timedelta(seconds=15), resolve_timeout=timedelta(seconds=5))); pytest.raises(CouchbaseException, lambda: Cluster.connect('couchbase://192.0.2.1', opts).ping()); print('bootstrap failure surfaced as CouchbaseException')"
149+
150+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
151+
with:
152+
name: couchbase-${{ env.COUCHBASE_VERSION }}-${{ matrix.python }}-manylinux_riscv64
153+
path: wheelhouse/*.whl
154+
if-no-files-found: error
155+
156+
publish:
157+
name: Publish couchbase ${{ matrix.version }}
158+
needs: [setup, build_wheels]
159+
if: needs.setup.outputs.versions != '[]'
160+
strategy:
161+
fail-fast: false
162+
matrix:
163+
version: ${{ fromJSON(needs.setup.outputs.versions) }}
164+
permissions:
165+
contents: write
166+
pull-requests: write
167+
uses: $/.github/workflows/_publish-wheel.yml
168+
secrets:
169+
app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }}
170+
with:
171+
artifact-pattern: couchbase-${{ matrix.version }}-*-manylinux_riscv64

‎docs/packages/couchbase.yaml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package-name: couchbase
2+
source-code: https://github.com/couchbase/couchbase-python-client
3+
license: Apache-2.0
4+
versions:
5+
- version: 4.6.3
6+
patched: true
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Mon, 21 Sep 2026 19:40:00 +0000
4+
Subject: [PATCH] Detect riscv64 as a correct-double-operations target
5+
6+
taocpp/json vendors Google's double-conversion, whose architecture list decides
7+
whether the target evaluates doubles at exactly 64 bits (x86's 80-bit x87 stack
8+
is the reason the list exists). The list ends in an #error, so an architecture
9+
it does not name fails the build outright:
10+
11+
deps/couchbase-cxx-cache/json/4c7c/json/include/tao/json/external/double.hpp:78:2:
12+
error: #error Target architecture was not detected as supported by Double-Conversion.
13+
14+
riscv64's F/D extensions operate on true IEEE-754 binary32/binary64 with no
15+
extended-precision stack, so it belongs in the first branch. taocpp/json fixed
16+
this on main in 91a480ff36259ed077545a64c04696062916bcbe; the couchbase-cxx-client
17+
CPM cache pins 1.0.0-beta.14, which predates it, and no release carries the fix
18+
yet.
19+
20+
Upstream-Status: Backport [https://github.com/taocpp/json/commit/91a480ff36259ed077545a64c04696062916bcbe]
21+
---
22+
.../json/4c7c/json/include/tao/json/external/double.hpp | 3 ++-
23+
1 file changed, 2 insertions(+), 1 deletion(-)
24+
25+
diff --git a/deps/couchbase-cxx-cache/json/4c7c/json/include/tao/json/external/double.hpp b/deps/couchbase-cxx-cache/json/4c7c/json/include/tao/json/external/double.hpp
26+
--- a/deps/couchbase-cxx-cache/json/4c7c/json/include/tao/json/external/double.hpp
27+
+++ b/deps/couchbase-cxx-cache/json/4c7c/json/include/tao/json/external/double.hpp
28+
@@ -63,7 +63,8 @@
29+
defined(__SH4__) || defined(__alpha__) || \
30+
defined(_MIPS_ARCH_MIPS32R2) || \
31+
defined(__AARCH64EL__) || defined(__aarch64__) || \
32+
- defined(__EMSCRIPTEN__)
33+
+ defined(__EMSCRIPTEN__) || \
34+
+ (defined(__riscv) && __riscv_xlen == 64)
35+
#define TAO_JSON_DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
36+
#elif defined(__mc68000__)
37+
#undef TAO_JSON_DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Ludovic Henry <git@ludovic.dev>
3+
Date: Mon, 21 Sep 2026 20:10:00 +0000
4+
Subject: [PATCH] Do not make cast-align fatal on strict-alignment targets
5+
6+
GCC only emits -Wcast-align on targets it considers strict-alignment, so the
7+
C++ core's casts from byte buffers to protocol header layouts are silent on
8+
x86_64 and aarch64 and fatal on riscv64:
9+
10+
core/io/mcbp_session.cxx:141:26: error: cast from 'const std::byte*' to
11+
'const mcbp_header_layout*' increases required alignment of target type
12+
[-Werror=cast-align]
13+
14+
-Wcast-align is a performance diagnostic, not a correctness one, and the
15+
casts it flags here are the protocol decoding the core is built around. Demote
16+
it the same way the GCC block below already demotes the four warnings asio
17+
trips, so every other warning stays fatal.
18+
19+
Upstream-Status: To upstream [not yet submitted; this port may only touch riseproject-dev/python-wheels]
20+
---
21+
deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake | 4 +++-
22+
1 file changed, 3 insertions(+), 1 deletion(-)
23+
24+
diff --git a/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake b/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake
25+
--- a/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake
26+
+++ b/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake
27+
@@ -55,7 +55,9 @@
28+
-Wno-compound-token-split-by-macro)
29+
30+
if(WARNINGS_AS_ERRORS)
31+
- set(COMMON_WARNINGS ${COMMON_WARNINGS} -Werror)
32+
+ # -Wcast-align is only emitted on strict-alignment targets such as riscv64,
33+
+ # where it flags the byte-buffer-to-header casts the protocol code is built on.
34+
+ set(COMMON_WARNINGS ${COMMON_WARNINGS} -Werror -Wno-error=cast-align)
35+
set(MSVC_WARNINGS ${MSVC_WARNINGS} /WX)
36+
endif()
37+

0 commit comments

Comments
 (0)