summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-11-09 13:28:44 +0000
committerCoprDistGit <infra@openeuler.org>2026-11-09 13:28:44 +0000
commite61269dcc9818e03e4926cdc9a35b5b18f334643 (patch)
treee066d09d6c0e676d4dc4256d063969f6739e0577
parent88d83e88358b760a7fc361f0eb1b6299139c2386 (diff)
automatic import of opencodeopeneuler24.03_LTS_SP4
-rw-r--r--opencode-LICENSE21
-rw-r--r--opencode.spec204
-rw-r--r--sources3
3 files changed, 75 insertions, 153 deletions
diff --git a/opencode-LICENSE b/opencode-LICENSE
new file mode 100644
index 0000000..6439474
--- /dev/null
+++ b/opencode-LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 opencode
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/opencode.spec b/opencode.spec
index 2fc675a..f0c9386 100644
--- a/opencode.spec
+++ b/opencode.spec
@@ -1,185 +1,74 @@
-# Source build of opencode 1.19.5 for openEuler 24.03 LTS SP4.
+# opencode 1.19.5 for openEuler 24.03 LTS SP4 (x86_64).
#
-# The EUR upload endpoint rejects SRPMs of a few MB, so this SRPM is kept tiny:
-# the upstream source archive is fetched in %prep from a reachable GitHub proxy,
-# Node.js and Bun come from Huawei Cloud mirrors, and the npm dependency tree
-# is resolved from the Huawei npm mirror. The models.dev snapshot is small
-# enough to ship compressed in the SRPM.
+# The COPR project this package is built in runs every build with network
+# access disabled (enable_net=false), so %prep/%build must not download
+# anything: every remote artifact has to be shipped inside the SRPM.
#
-# The upstream source is pruned to the CLI + embedded Web UI workspace closure
-# (console/stats/desktop/docs/web/storybook/slack/identity/containers/cli/
-# sdk-next/function removed). The ghostty-web dependency, which upstream pins
-# to a GitHub commit, is switched to the published 0.3.0 npm package so the
-# build does not need GitHub access.
+# Upstream is a Bun/TypeScript monorepo without a prebuilt dist/ tree, and Bun
+# is not part of the openEuler build toolchain, so an in-chroot compilation
+# would require vendoring the whole npm dependency tree plus the Bun runtime.
+# Per spec-rules-nodejs (TypeScript/monorepo packages must use an upstream
+# artifact that already ships the compiled payload), the package is built from
+# the upstream-published standalone linux-x64 release tarball, which embeds the
+# CLI, the embedded Web UI and the Bun runtime.
+#
+# Offline build inputs (both shipped inside the SRPM):
+# Source0 https://github.com/anomalyco/opencode/releases/download/v1.19.5/opencode-linux-x64.tar.gz
+# sha256 588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a
+# Source1 https://github.com/anomalyco/opencode/raw/v1.19.5/LICENSE
+# sha256 625f0f619133f89bbbb2abe37369613dfa1885eba1e50d02170deb62bb42cb6b
%global debug_package %{nil}
%global __strip /bin/true
-%global node_version 24.18.0
-%global node_sha256 55aa7153f9d88f28d765fcdad5ae6945b5c0f98a36881703817e4c450fa76742
-%global bun_version 1.4.4
-%global bun_sha256 93ca5a2abe45f3bcac6dd55baff8bb06c4ac824b70f89650b54e5c8b80dbef18
-
-%global src_proxy https://ghfast.top/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz
+# Upstream release asset recorded for traceability/reproducibility.
+%global src_sha256 588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a
Name: opencode
Version: 1.19.5
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: The open source coding agent
License: MIT
URL: https://github.com/anomalyco/opencode
-# Source0 is a zero-byte placeholder; %prep fetches the real archive.
-Source0: opencode-1.19.5.tar.gz
-Source1: models-api.json.xz
+# Upstream-published standalone linux-x64 archive (contains the "opencode"
+# executable built by upstream with bun --compile).
+Source0: https://github.com/anomalyco/opencode/releases/download/v1.19.5/opencode-linux-x64.tar.gz
+# Upstream LICENSE at the same tag, renamed so it does not collide with a
+# generic "LICENSE" entry in SOURCES.
+Source1: opencode-LICENSE
ExclusiveArch: x86_64
-BuildRequires: bash
-BuildRequires: ca-certificates
-BuildRequires: chrpath
+# Only local archive extraction and the sha256 check are needed: the build
+# chroot has no network access and nothing is compiled.
BuildRequires: coreutils
-BuildRequires: cpio
-BuildRequires: curl
-BuildRequires: findutils
-BuildRequires: gcc
-BuildRequires: gcc-c++
-BuildRequires: git
-BuildRequires: glibc-devel
BuildRequires: grep
BuildRequires: gzip
-BuildRequires: make
-BuildRequires: patch
-BuildRequires: python3
-BuildRequires: sed
BuildRequires: tar
-BuildRequires: unzip
-BuildRequires: which
-BuildRequires: xz
-BuildRequires: zip
Requires: glibc
%description
opencode is an AI-powered development tool that runs coding agents in the
-terminal. This package is compiled from the upstream TypeScript source using
-Bun, and includes the embedded Web UI. It requires only glibc at runtime;
-Node.js and Bun are not needed after installation.
+terminal. This package ships the upstream-published standalone Linux x86_64
+executable, which already embeds the CLI, the embedded Web UI and the Bun
+runtime. It requires only glibc at runtime; Node.js and Bun are not needed
+after installation.
%prep
-cd %{_builddir}
-src_ok=0
-for url in \
- "%{src_proxy}" \
- "https://gh.llkk.cc/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz" \
- "https://gh-proxy.com/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz"; do
- echo "Fetching source from ${url}"
- if curl --fail --location --retry 2 --connect-timeout 30 --max-time 900 \
- --output src.tar.gz "${url}"; then
- if tar -tzf src.tar.gz 2>/dev/null | head -1 | grep -q '^opencode-1.19.5/'; then
- src_ok=1
- break
- fi
- fi
- rm -f src.tar.gz
-done
-if [ "${src_ok}" != "1" ]; then
- echo "ERROR: no source mirror was reachable" >&2
- exit 1
-fi
-tar -xzf src.tar.gz
-cd opencode-1.19.5
-
-# Keep only the CLI + embedded-Web-UI workspace closure.
-rm -rf packages/console packages/stats packages/enterprise packages/desktop \
- packages/docs packages/web packages/storybook packages/slack \
- packages/identity packages/containers packages/cli packages/sdk-next \
- packages/function
-
-# Tests, docs, and marketing assets are not build inputs.
-rm -rf packages/*/test packages/*/tests packages/*/e2e packages/*/test-browser \
- packages/*/bench packages/*/storybook packages/*/docs packages/*/examples \
- packages/*/example packages/*/__tests__ packages/*/README* \
- packages/*/*/test packages/*/*/tests packages/*/*/e2e \
- packages/*/*/README* sdks github nix infra specs .github README* \
- AGENTS.md CONTRIBUTING.md STATS.md CONTEXT.md perf screenshot-*.png
-
-python3 - <<'PY'
-import json
-import os
-
-path = "package.json"
-data = json.load(open(path))
-data["workspaces"]["packages"] = [
- x for x in data["workspaces"]["packages"]
- if x not in ("packages/console/*", "packages/stats/*", "packages/slack")
- and not (x == "packages/sdk/js" and not os.path.isdir(x))
-]
-json.dump(data, open(path, "w"), indent=2)
-open(path, "a").write("\n")
-
-path = "packages/app/package.json"
-data = json.load(open(path))
-data["dependencies"]["ghostty-web"] = "0.3.0"
-json.dump(data, open(path, "w"), indent=2)
-open(path, "a").write("\n")
-PY
-
-xz -dc %{SOURCE1} > models-api.json
+# Nothing is downloaded here: the build chroot has no network access.
+# Verify the shipped archive against the recorded upstream sha256, then unpack.
+echo '%{src_sha256} %{SOURCE0}' | sha256sum -c -
+tar -xzf %{SOURCE0}
%build
-cd opencode-1.19.5
-export HOME="%{_builddir}/%{name}-%{version}/.home"
-mkdir -p "$HOME"
-
-# Node.js 24.18.0
-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 -
-mkdir -p "$HOME/node"
-tar -xJf node.tar.xz -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 -
-mkdir -p "$HOME/bun"
-tar -xzf bun.tgz -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"
-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"
-export BUN_CONFIG_DISABLE_ANALYTICS=1
-export MODELS_DEV_API_JSON="$PWD/models-api.json"
-export OPENCODE_VERSION="%{version}"
-export OPENCODE_CHANNEL="prod"
-export USE_HARD_LINKS=false
-export HUSKY=0
-
-bun install
-bun run --cwd packages/core fix-node-pty || :
-cd packages/opencode
-bun run script/build.ts --single
+# Prebuilt upstream artifact (bun --compile output): nothing to compile.
%install
-cd opencode-1.19.5
-install -Dpm 0755 packages/opencode/dist/opencode-linux-x64/bin/opencode %{buildroot}%{_bindir}/opencode
-install -Dpm 0644 LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE
+install -Dpm 0755 opencode %{buildroot}%{_bindir}/opencode
+install -Dpm 0644 %{SOURCE1} %{buildroot}%{_licensedir}/%{name}/LICENSE
%check
+export HOME=%{_builddir}
%{buildroot}%{_bindir}/opencode --version | grep -qx '%{version}'
%files
@@ -187,6 +76,19 @@ install -Dpm 0644 LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE
%{_bindir}/opencode
%changelog
+* Mon Nov 09 2026 user_76c6f026 <user_76c6f026@eur.openeuler.cn> - 1.19.5-3
+- Make the build work offline: the COPR project disables network access during
+ builds (enable_net=false), so the GitHub source proxy, the Huawei Cloud
+ Node/Bun mirrors and the npm install step in %prep/%build all failed with
+ "no source mirror was reachable"
+- Package the upstream-published standalone linux-x64 release artifact, which
+ already embeds the CLI, the Web UI and the Bun runtime (spec-rules-nodejs:
+ TypeScript monorepo without a prebuilt dist/ tree cannot be compiled from
+ source in the openEuler chroot)
+- Reference the full immutable upstream release URL for Source0, ship the
+ upstream LICENSE as Source1, and verify Source0 against its recorded sha256
+- Drop the models.dev snapshot that was only consumed by the removed in-tree
+ build
* Thu Oct 29 2026 user_76c6f026 <user_76c6f026@eur.openeuler.cn> - 1.19.5-2
- Build opencode 1.19.5 from source for openEuler 24.03 LTS SP4 x86_64
- Fetch upstream source from a GitHub proxy at build time; use Huawei Cloud
diff --git a/sources b/sources
index 28cf6cc..d65fbba 100644
--- a/sources
+++ b/sources
@@ -1,2 +1 @@
-208cee0297d06b2172933cc3952080b0 models-api.json.xz
-d41d8cd98f00b204e9800998ecf8427e opencode-1.19.5.tar.gz
+480e956b24153ce8a548a3cb6f0ae8c1 opencode-linux-x64.tar.gz