Skip to content

Commit a254312

Browse files
aryabjenaaryabjena
andauthored
RHAIENG-1475: enablement(s390x): changes for codeserver (opendatahub-io#2575)
* s390x changes for codeserver * Update get_code_server_rpm.sh Fix conditional syntax for architecture guard. The missing space before "$ARCH" turns the token into ||"$ARCH", so bash complains with “conditional binary operator expected” and exits before any build logic runs. as suggested by code coderabbitai * Update devel_env_setup.sh changed to do proper && chain for dnf * add files via lfs --------- Co-authored-by: aryabjena <aryabjena2001+work@ibm.com>
1 parent 9cf8eb6 commit a254312

File tree

5 files changed

+90
-11
lines changed

5 files changed

+90
-11
lines changed

codeserver/ubi9-python-3.12/Dockerfile.cpu

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ COPY ${CODESERVER_SOURCE_CODE}/devel_env_setup.sh ./
5757
# the final stage with the necessary permissions to consume from cache
5858
RUN --mount=type=cache,target=/root/.cache/uv \
5959
pip install --no-cache-dir uv && \
60-
# the devel script is ppc64le specific - sets up build-time dependencies
60+
# the devel script is ppc64le and s390x specific - sets up build-time dependencies
6161
source ./devel_env_setup.sh && \
6262
# This may have to download and compile some dependencies, and as we don't lock requirements from `build-system.requires`,
6363
# we often don't know the correct hashes and `--require-hashes` would therefore fail on non amd64, where building is common.
@@ -90,7 +90,7 @@ RUN dnf -y upgrade --refresh --nobest --skip-broken --nodocs --noplugins --setop
9090
# upgrade first to avoid fixable vulnerabilities end
9191

9292
# Install useful OS packages
93-
RUN dnf install -y perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/yum
93+
RUN dnf install -y tar perl mesa-libGL skopeo && dnf clean all && rm -rf /var/cache/dnf
9494

9595
# (ARCH-ppc64le): since wheels are compiled from source, we need shared libs available at runtime
9696
RUN --mount=type=cache,from=whl-cache,source=/root/OpenBLAS,target=/OpenBlas,rw \
@@ -139,9 +139,9 @@ USER 0
139139
WORKDIR /opt/app-root/bin
140140

141141
# Install useful OS packages
142-
RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/yum
142+
RUN dnf install -y jq git-lfs libsndfile && dnf clean all && rm -rf /var/cache/dnf
143143

144-
# wait for rpm-base stage (rpm builds for ppc64le)
144+
# wait for rpm-base stage (rpm builds for ppc64le and s390x)
145145
COPY --from=rpm-base /tmp/control /dev/null
146146

147147
# Install code-server
@@ -253,7 +253,7 @@ COPY --from=whl-cache /tmp/control /dev/null
253253
RUN --mount=type=cache,target=/root/.cache/uv \
254254
--mount=type=cache,from=whl-cache,source=/wheelsdir/,target=/wheelsdir/,rw \
255255
bash -c ' \
256-
if [[ $(uname -m) == "ppc64le" ]]; then \
256+
if [[ $(uname -m) == "ppc64le" ]] || [[ $(uname -m) == "s390x" ]]; then \
257257
uv pip install /wheelsdir/*.whl; \
258258
fi '
259259
# install packages as USER 0 (this will allow us to consume uv cache)

codeserver/ubi9-python-3.12/devel_env_setup.sh

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,35 @@ build_pyarrow() {
6363
rm -rf ${TEMP_BUILD_DIR}
6464
}
6565

66+
# Additional dev tools only for s390x \
67+
if [[ $(uname -m) == "s390x" ]]; then \
68+
69+
dnf install -y perl mesa-libGL skopeo libxcrypt-compat python3.12-devel pkgconf-pkg-config gcc gcc-gfortran gcc-c++ ninja-build make openssl-devel python3-devel pybind11-devel autoconf automake libtool cmake openblas-devel libjpeg-devel zlib-devel libtiff-devel freetype-devel lcms2-devel libwebp-devel git tar wget && \
70+
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \
71+
dnf install -y cmake gcc gcc-toolset-13 fribidi-devel lcms2-devel openjpeg2-devel libraqm-devel libimagequant-devel tcl-devel tk-devel && \
72+
dnf clean all && rm -rf /var/cache/dnf;
73+
74+
# install rust
75+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
76+
77+
source /opt/rh/gcc-toolset-13/enable
78+
source "$HOME/.cargo/env"
79+
80+
export MAX_JOBS=${MAX_JOBS:-$(nproc)}
81+
82+
if [[ $(uname -m) == "s390x" ]]; then
83+
echo "Checking OpenBLAS pkg-config..."
84+
pkg-config --exists openblas || echo "Warning: openblas.pc not found"
85+
fi
86+
87+
export CMAKE_ARGS="-DPython3_EXECUTABLE=python -DCMAKE_PREFIX_PATH=/usr/local"
88+
89+
PYARROW_VERSION=$(grep -A1 '"pyarrow"' pylock.toml | grep -Eo '\b[0-9\.]+\b')
90+
build_pyarrow ${PYARROW_VERSION}
91+
uv pip install ${WHEEL_DIR}/*.whl
92+
fi
93+
94+
6695
if [[ $(uname -m) == "ppc64le" ]]; then
6796
# install development packages
6897
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
@@ -101,7 +130,8 @@ if [[ $(uname -m) == "ppc64le" ]]; then
101130
build_pillow ${PILLOW_VERSION}
102131

103132
uv pip install ${WHEEL_DIR}/*.whl
104-
else
105-
# only for mounting on non-ppc64le
106-
mkdir -p /root/OpenBLAS/
133+
fi
134+
if [[ $(uname -m) != "ppc64le" ]]; then
135+
# only for mounting on other ppc64le
136+
mkdir -p /root/OpenBLAS/
107137
fi

codeserver/ubi9-python-3.12/get_code_server_rpm.sh

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UNAME_TO_GOARCH["s390x"]="s390x"
1717

1818
ARCH="${UNAME_TO_GOARCH[$(uname -m)]}"
1919

20-
if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ||"$ARCH" == "ppc64le" ]]; then
20+
if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" || "$ARCH" == "ppc64le" || "$ARCH" == "s390x" ]]; then
2121

2222
export MAX_JOBS=${MAX_JOBS:-$(nproc)}
2323
export NODE_VERSION=${NODE_VERSION:-22.18.0}
@@ -62,12 +62,57 @@ if [[ "$ARCH" == "amd64" || "$ARCH" == "arm64" ||"$ARCH" == "ppc64le" ]]; then
6262
# build codeserver
6363
git clone --depth 1 --branch "${CODESERVER_VERSION}" --recurse-submodules --shallow-submodules https://github.com/coder/code-server.git
6464
cd code-server
65+
66+
#patch taken from vscodium s390x IBM : https://github.com/VSCodium/vscodium/blob/master/patches/linux/reh/s390x/arch-4-s390x-package.json.patch
67+
if [[ "$ARCH" == "s390x" ]]; then
68+
cat > s390x.patch <<EOL
69+
diff --git a/lib/vscode/package-lock.json b/lib/vscode/package-lock.json
70+
index 0d0272a92b2..73e8feb92dd 100644
71+
--- a/lib/vscode/package-lock.json
72+
+++ b/lib/vscode/package-lock.json
73+
@@ -18236,10 +18236,11 @@
74+
}
75+
},
76+
"node_modules/web-tree-sitter": {
77+
- "version": "0.20.8",
78+
- "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.20.8.tgz",
79+
- "integrity": "sha512-weOVgZ3aAARgdnb220GqYuh7+rZU0Ka9k9yfKtGAzEYMa6GgiCzW9JjQRJyCJakvibQW+dfjJdihjInKuuCAUQ==",
80+
- "dev": true
81+
+ "version": "0.23.0",
82+
+ "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.23.0.tgz",
83+
+ "integrity": "sha512-p1T+ju2H30fpVX2q5yr+Wv/NfdMMWMjQp9Q+4eEPrHAJpPFh9DPfI2Yr9L1f5SA5KPE+g1cNUqPbpihxUDzmVw==",
84+
+ "dev": true,
85+
+ "license": "MIT"
86+
},
87+
"node_modules/webidl-conversions": {
88+
"version": "3.0.1",
89+
diff --git a/lib/vscode/package.json b/lib/vscode/package.json
90+
index a4c7a2a3a35..d7f816248af 100644
91+
--- a/lib/vscode/package.json
92+
+++ b/lib/vscode/package.json
93+
@@ -227,6 +227,9 @@
94+
"node-gyp-build": "4.8.1",
95+
"kerberos@2.1.1": {
96+
"node-addon-api": "7.1.0"
97+
+ },
98+
+ "@vscode/l10n-dev@0.0.35": {
99+
+ "web-tree-sitter": "0.23.0"
100+
}
101+
},
102+
"repository": {
103+
EOL
104+
105+
git apply s390x.patch
106+
fi
107+
65108
source ${NVM_DIR}/nvm.sh
66109
while IFS= read -r src_patch; do echo "patches/$src_patch"; patch -p1 < "patches/$src_patch"; done < patches/series
67110
nvm use ${NODE_VERSION}
111+
npm cache clean --force
68112
npm install
69113
npm run build
70114
VERSION=${CODESERVER_VERSION/v/} npm run build:vscode
115+
export KEEP_MODULES=1
71116
npm run release
72117
npm run release:standalone
73118

codeserver/ubi9-python-3.12/pylock.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,7 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/8f/8e/9ad090d3553c280
889889
[[packages]]
890890
name = "ml-dtypes"
891891
version = "0.5.3"
892+
marker = "platform_machine != 's390x'"
892893
sdist = { url = "https://files.pythonhosted.org/packages/78/a7/aad060393123cfb383956dca68402aff3db1e1caffd5764887ed5153f41b/ml_dtypes-0.5.3.tar.gz", upload-time = 2025-07-29T18:39:19Z, size = 692316, hashes = { sha256 = "95ce33057ba4d05df50b1f3cfefab22e351868a843b3b15a46c65836283670c9" } }
893894
wheels = [
894895
{ url = "https://files.pythonhosted.org/packages/ac/bb/1f32124ab6d3a279ea39202fe098aea95b2d81ef0ce1d48612b6bf715e82/ml_dtypes-0.5.3-cp310-cp310-macosx_10_9_universal2.whl", upload-time = 2025-07-29T18:38:17Z, size = 667409, hashes = { sha256 = "0a1d68a7cb53e3f640b2b6a34d12c0542da3dd935e560fdf463c0c77f339fc20" } },
@@ -1205,6 +1206,7 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/be/9c/92789c596b8df83
12051206
[[packages]]
12061207
name = "onnx"
12071208
version = "1.19.0"
1209+
marker = "platform_machine != 's390x'"
12081210
sdist = { url = "https://files.pythonhosted.org/packages/5b/bf/b0a63ee9f3759dcd177b28c6f2cb22f2aecc6d9b3efecaabc298883caa5f/onnx-1.19.0.tar.gz", upload-time = 2025-08-27T02:34:27Z, size = 11949859, hashes = { sha256 = "aa3f70b60f54a29015e41639298ace06adf1dd6b023b9b30f1bca91bb0db9473" } }
12091211
wheels = [
12101212
{ url = "https://files.pythonhosted.org/packages/00/b3/8a6f3b05d18dffdc7c18839bd829587c826c8513f4bdbe21ddf37dacce50/onnx-1.19.0-cp310-cp310-macosx_12_0_universal2.whl", upload-time = 2025-08-27T02:32:47Z, size = 18310869, hashes = { sha256 = "e927d745939d590f164e43c5aec7338c5a75855a15130ee795f492fc3a0fa565" } },
@@ -1523,6 +1525,7 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/8e/37/efad0257dc6e593
15231525
[[packages]]
15241526
name = "py-spy"
15251527
version = "0.4.1"
1528+
marker = "platform_machine != 's390x'"
15261529
sdist = { url = "https://files.pythonhosted.org/packages/19/e2/ff811a367028b87e86714945bb9ecb5c1cc69114a8039a67b3a862cef921/py_spy-0.4.1.tar.gz", upload-time = 2025-07-31T19:33:25Z, size = 244726, hashes = { sha256 = "e53aa53daa2e47c2eef97dd2455b47bb3a7e7f962796a86cc3e7dbde8e6f4db4" } }
15271530
wheels = [
15281531
{ url = "https://files.pythonhosted.org/packages/14/e3/3a32500d845bdd94f6a2b4ed6244982f42ec2bc64602ea8fcfe900678ae7/py_spy-0.4.1-py2.py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", upload-time = 2025-07-31T19:33:13Z, size = 3682508, hashes = { sha256 = "809094208c6256c8f4ccadd31e9a513fe2429253f48e20066879239ba12cd8cc" } },
@@ -2203,6 +2206,7 @@ wheels = [{ url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc
22032206
[[packages]]
22042207
name = "skl2onnx"
22052208
version = "1.19.1"
2209+
marker = "platform_machine != 's390x'"
22062210
sdist = { url = "https://files.pythonhosted.org/packages/e1/59/3f4d82eb96d8a80fd80325fc658d20e772ee6ac1c6f5cc85dd6aaaf7ccff/skl2onnx-1.19.1.tar.gz", upload-time = 2025-05-28T17:37:02Z, size = 948919, hashes = { sha256 = "0c105f2a3b87a624dd218d1fb98fdd19cf1bf6217190d25ce7e15484127d0e5d" } }
22072211
wheels = [{ url = "https://files.pythonhosted.org/packages/57/ec/9a0d709217aa385d87b3eadcf19e2ae32eca097077fa2236312d5fc8f656/skl2onnx-1.19.1-py3-none-any.whl", upload-time = 2025-05-28T17:37:00Z, size = 315511, hashes = { sha256 = "fddf2f49e3ffc355f332e676b43c6fec5e63797627925b279d9f5b2c4d0c81a7" } }]
22082212

codeserver/ubi9-python-3.12/pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies = [
1717
"plotly~=6.3.0",
1818
"scikit-learn~=1.7.2",
1919
"scipy~=1.16.1",
20-
"skl2onnx~=1.19.1",
20+
"skl2onnx~=1.19.1; platform_machine != 's390x'",
2121
"ipykernel~=6.30.1",
2222
"kubeflow-training==1.9.3",
2323
"feast~=0.53.0",
@@ -26,7 +26,7 @@ dependencies = [
2626
"opencensus~=0.11.4",
2727
"smart-open~=7.3.1",
2828
"virtualenv~=20.34.0",
29-
"py-spy~=0.4.1",
29+
"py-spy~=0.4.1; platform_machine != 's390x'",
3030
"prometheus-client~=0.22.1",
3131
]
3232

0 commit comments

Comments
 (0)