summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--opencode.spec80
-rw-r--r--sources5
3 files changed, 52 insertions, 36 deletions
diff --git a/.gitignore b/.gitignore
index 907855a..438155a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
/models-api.json.xz
/opencode-1.19.5.tar.gz
+/bun-linux-x64-1.4.4.tgz
+/node-v24.18.0-linux-x64.tar.xz
+/opencode-node_modules.tar.xz
diff --git a/opencode.spec b/opencode.spec
index c5fbe38..78b1972 100644
--- a/opencode.spec
+++ b/opencode.spec
@@ -5,10 +5,11 @@
# build. The EUR upload endpoint rejects SRPMs of a few MB, so the reference
# spec fetched the upstream archive in %prep from a reachable GitHub proxy.
# This COPR build ships the archive in the SRPM instead (Source0) and %prep
-# prefers it, so the build does not depend on a proxy being reachable. Node.js
-# and Bun come from Huawei Cloud mirrors and the npm dependency tree from the
-# Huawei npm mirror. The models.dev snapshot is small enough to ship compressed
-# in the SRPM (Source1), keeping the build off the models.dev network API.
+# prefers it, so the build does not depend on a proxy being reachable. The
+# build chroot has no network access at all, so Node.js (Source2), Bun
+# (Source3) and the resolved npm dependency tree (Source4) are shipped in the
+# SRPM as well. The models.dev snapshot is small enough to ship compressed in
+# the SRPM (Source1), keeping the build off the models.dev network API.
#
# The upstream source is pruned to the CLI + embedded Web UI workspace closure
# (console/stats/desktop/docs/web/storybook/slack/identity/containers/cli/
@@ -33,7 +34,7 @@
Name: opencode
Version: 1.19.5
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: The open source coding agent
License: MIT
@@ -41,6 +42,13 @@ URL: https://github.com/anomalyco/opencode
# Source0 carries the upstream tarball (opencode-1.19.5/ top-level dir).
Source0: opencode-1.19.5.tar.gz
Source1: models-api.json.xz
+# The COPR project this package is built in has no network access inside the
+# build chroot (enable_net=False), so every input is shipped in the SRPM:
+# Source2 = Node.js 24.18.0 x86_64, Source3 = Bun 1.4.4 x86_64 npm package,
+# Source4 = the node_modules tree for the pruned workspace closure.
+Source2: node-v%{node_version}-linux-x64.tar.xz
+Source3: bun-linux-x64-%{bun_version}.tgz
+Source4: opencode-node_modules.tar.xz
# The build downloads x86_64 Node.js/Bun binaries and produces a linux-x64
# Bun single-file executable; only x86_64 builds are supported.
@@ -166,43 +174,30 @@ cd opencode-1.19.5
export HOME="%{_builddir}/%{name}-%{version}/.home"
mkdir -p "$HOME"
-# Node.js 24.18.0 (the chroot only ships 20.x; upstream needs >= 22).
-curl --fail --location --retry 3 --connect-timeout 30 \
- --output node.tar.xz \
- "https://mirrors.huaweicloud.com/nodejs/v%{node_version}/node-v%{node_version}-linux-x64.tar.xz"
-echo '%{node_sha256} node.tar.xz' | sha256sum -c -
+# Nothing is downloaded here: the COPR project has no network access in the
+# build chroot, so Node.js, Bun and the npm dependency tree are all shipped in
+# the SRPM (Source2/Source3/Source4).
+echo '%{node_sha256} %{SOURCE2}' | sha256sum -c -
mkdir -p "$HOME/node"
-tar -xJf node.tar.xz -C "$HOME/node" --strip-components=1
+tar -xJf %{SOURCE2} -C "$HOME/node" --strip-components=1
export PATH="$HOME/node/bin:$PATH"
node --version
npm --version
-# Bun 1.4.4 from the npm platform package
-curl --fail --location --retry 3 --connect-timeout 30 \
- --output bun.tgz \
- "https://mirrors.huaweicloud.com/repository/npm/@oven/bun-linux-x64/-/bun-linux-x64-%{bun_version}.tgz"
-echo '%{bun_sha256} bun.tgz' | sha256sum -c -
+echo '%{bun_sha256} %{SOURCE3}' | sha256sum -c -
mkdir -p "$HOME/bun"
-tar -xzf bun.tgz -C "$HOME/bun" --strip-components=1
+tar -xzf %{SOURCE3} -C "$HOME/bun" --strip-components=1
export PATH="$HOME/bun/bin:$PATH"
bun --version
-export npm_config_registry="https://mirrors.huaweicloud.com/repository/npm/"
-export NPM_CONFIG_REGISTRY="$npm_config_registry"
-export BUN_CONFIG_REGISTRY="$npm_config_registry"
-# Dependency install scripts (e.g. tree-sitter-powershell) run node-gyp, which
-# downloads the Node headers. nodejs.org is unreachable from the builders (the
-# reference 24.03 LTS SP4 build failed there), so point node-gyp at the mirror.
-export npm_config_disturl="https://mirrors.huaweicloud.com/nodejs"
-export NPM_CONFIG_DISTURL="$npm_config_disturl"
-export npm_config_prefix="$HOME/npm-global"
-export NPM_CONFIG_PREFIX="$npm_config_prefix"
-mkdir -p "$npm_config_prefix"
-export PATH="$npm_config_prefix/bin:$PATH"
-npm install -g node-gyp
-node-gyp --version
-
-export BUN_INSTALL_CACHE_DIR="$HOME/bun-cache"
+# Vendored npm dependency tree (Source4) replaces `bun install`.
+tar -xJf %{SOURCE4} -C .
+test -d node_modules/.bun
+
+# The embedded Web UI is built with vite, which does not fit in Node's default
+# 1 GB heap for this module graph.
+export NODE_OPTIONS="--max-old-space-size=4096"
+
export BUN_CONFIG_DISABLE_ANALYTICS=1
export MODELS_DEV_API_JSON="$PWD/models-api.json"
export OPENCODE_VERSION="%{version}"
@@ -210,10 +205,15 @@ export OPENCODE_CHANNEL="prod"
export USE_HARD_LINKS=false
export HUSKY=0
-bun install
+# node-pty's spawn-helper needs the executable bit; the vendored tree already
+# has it, this keeps the step harmless/idempotent.
bun run --cwd packages/core fix-node-pty || :
cd packages/opencode
-bun run script/build.ts --single
+# --skip-install keeps the build offline: the dependency tree is already in
+# place (Source4) and the flag also suppresses the extra cross-platform
+# `bun install --os="*"` calls the script issues, which we do not need for a
+# single linux-x64 target.
+bun run script/build.ts --single --skip-install
%install
cd opencode-1.19.5
@@ -228,6 +228,16 @@ install -Dpm 0644 LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE
%{_bindir}/opencode
%changelog
+* Fri Oct 30 2026 user_76c6f026 <user_76c6f026@eur.openeuler.cn> - 1.19.5-3
+- Build fully offline: the COPR project used for this import has network
+ access disabled (enable_net=False), which is what made the %build downloads
+ fail with "Could not resolve host" (builds 114056 and 114057)
+- Ship Node.js 24.18.0 (Source2), Bun 1.4.4 (Source3) and the resolved
+ node_modules tree (Source4) inside the SRPM instead of downloading them
+- Replace `bun install` with the vendored tree and build with
+ `--skip-install` so no registry access is attempted
+- Raise Node's heap for the embedded Web UI build (NODE_OPTIONS)
+
* Fri Oct 30 2026 user_76c6f026 <user_76c6f026@eur.openeuler.cn> - 1.19.5-2
- Route node-gyp header downloads to the Huawei Cloud Node.js mirror
(npm_config_disturl) so dependency install scripts do not fail on the
diff --git a/sources b/sources
index b2789b8..7b855a9 100644
--- a/sources
+++ b/sources
@@ -1,2 +1,5 @@
+6856d42e2008c97cc698518e18156d77 bun-linux-x64-1.4.4.tgz
20383605b7dde93ddf4c8ec41648f090 models-api.json.xz
-cc68e2eb0a06cf007b07a9e3172970c0 opencode-1.19.5.tar.gz
+1c611b02dae6d3f3bcb1f3e64bd9f3bf node-v24.18.0-linux-x64.tar.xz
+49fb3cd0d185ad2d35175fb015a2e7ac opencode-1.19.5.tar.gz
+0450fdc54a9779293e975307380b38e1 opencode-node_modules.tar.xz