summaryrefslogtreecommitdiff
path: root/opencode.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-10-29 09:06:57 +0000
committerCoprDistGit <infra@openeuler.org>2026-10-29 09:06:57 +0000
commit8f1929fd686d9751034524de087db2af571251b3 (patch)
tree4305ae798e0ec5afe2e736a61858a4516533c042 /opencode.spec
parent4d9e196d4c220aba7b583c1a7fbc435c15b6afa6 (diff)
automatic import of opencode
Diffstat (limited to 'opencode.spec')
-rw-r--r--opencode.spec75
1 files changed, 36 insertions, 39 deletions
diff --git a/opencode.spec b/opencode.spec
index 83a2771..f8a1601 100644
--- a/opencode.spec
+++ b/opencode.spec
@@ -1,67 +1,64 @@
-# topdir: package (npm 平台包 opencode-linux-x64 解压顶层目录)
-# 打包策略:opencode 上游使用 Bun 的 compile 能力将 TypeScript monorepo 编译为
-# 单一可执行 ELF 二进制。openEuler 官方源不提供 Bun 工具链,无法在构建阶段
-# 从源码编译;上游官方通过 GitHub release 与 npm 平台包发布预编译二进制。
-# 本包直接采用上游官方发布的 Linux x86_64 (glibc) 预编译二进制作为 Source0,
-# 无需 Node.js / Bun 运行时,仅依赖 glibc。
-# monorepo 内部 workspace 包(opencode-ai/plugin、script、sdk)在编译时
-# 已被打进二进制,运行时不作为独立 RPM 依赖。
+# opencode upstream ships a self-contained Linux x86_64 executable built with
+# Bun. The EUR upload endpoint rejects SRPMs larger than its nginx body limit,
+# so the ~80 MB release tarball is fetched and checksum-verified during %prep
+# with networking enabled for this build. The resulting RPM installs the
+# official upstream binary; it needs only glibc at runtime.
-# 预编译二进制保护:Bun compile 产物将其版本号等运行时元数据嵌入 ELF 节中,
-# 任何形式的 strip(含 find-debuginfo 的 --strip-debug / -g)都会移除这些节,
-# 导致 `opencode --version` 退化为 Bun 运行时编译期默认值(1.4.4),
-# %check 的版本校验随之失败。本包直接采用上游预编译产物,无源码可重新编译,
-# 因此必须彻底禁用 debuginfo 提取与 strip,保持二进制原样。
+# Bun embeds runtime/version metadata in ELF sections; stripping it makes
+# `opencode --version` report the Bun runtime version instead of 1.19.5.
%global debug_package %{nil}
%global __strip /bin/true
+%global upstream_url https://github.com/anomalyco/opencode/releases/download/v%{version}/opencode-linux-x64.tar.gz
+%global upstream_sha256 588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a
+
Name: opencode
Version: 1.19.5
-Release: 2%{?dist}
-Summary: AI-powered development tool
+Release: 1%{?dist}
+Summary: The open source coding agent
License: MIT
URL: https://github.com/anomalyco/opencode
-# Source0 为 npm 平台包 opencode-linux-x64,内含上游官方预编译的 Linux x86_64
-# glibc 二进制(Bun compile 产物)。解压顶层目录为 package/。
-Source0: https://registry.npmjs.org/opencode-linux-x64/-/opencode-linux-x64-%{version}.tgz
-# Source1 为 MIT 许可证文本,取自上游 git 仓库对应版本 tag 根目录。
+# Source0 is a zero-byte placeholder in the SRPM; %prep downloads the real
+# tarball from upstream and verifies it against upstream_sha256 above.
+Source0: opencode-linux-x64.tar.gz
Source1: https://raw.githubusercontent.com/anomalyco/opencode/v%{version}/LICENSE
-# 预编译二进制为 x86_64 专属 ELF(glibc 动态链接),仅在该架构提供。
ExclusiveArch: x86_64
+BuildRequires: curl
+BuildRequires: gzip
+BuildRequires: tar
+BuildRequires: coreutils
+BuildRequires: grep
+Requires: glibc
%description
opencode is an AI-powered development tool that runs coding agents in the
-terminal. This package ships the officially pre-compiled Linux x86_64 binary
-produced upstream with Bun's compile. Because the binary is self-contained
-(only requiring glibc), no Node.js or Bun toolchain is needed at build or
-runtime.
+terminal. This package ships the official self-contained Linux x86_64
+executable published by upstream. It requires only glibc at runtime; Node.js
+and Bun are not needed.
%prep
-# npm tarball 解压顶层目录固定为 package/
-%setup -n package -q
-cp -p %{SOURCE1} .
+curl --fail --location --retry 3 --output opencode-linux-x64.tar.gz %{upstream_url}
+echo '%{upstream_sha256} opencode-linux-x64.tar.gz' | sha256sum -c -
+mkdir -p %{name}-%{version}
+tar -xzf opencode-linux-x64.tar.gz -C %{name}-%{version}
+cp -p %{SOURCE1} %{name}-%{version}/LICENSE
%build
-# Pre-compiled binary; nothing to build.
+# Pre-compiled upstream binary; nothing to compile.
%install
-install -Dpm 0755 bin/opencode %{buildroot}%{_bindir}/opencode
+install -Dpm 0755 %{name}-%{version}/opencode %{buildroot}%{_bindir}/opencode
+install -Dpm 0644 %{name}-%{version}/LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE
%check
-# Verify the shipped binary reports the expected version.
-%{buildroot}%{_bindir}/opencode --version | grep -q "^%{version}$"
+%{buildroot}%{_bindir}/opencode --version | grep -qx '%{version}'
%files
-%license LICENSE
+%license %{_licensedir}/%{name}/LICENSE
%{_bindir}/opencode
%changelog
-* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 1.19.5-2
-- Disable debug_package and strip: stripping corrupts the Bun-compiled binary's
- embedded version metadata, causing --version to report a fallback value.
-
-* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 1.19.5-1
-- Initial package for opencode 1.19.5
-- Ship upstream pre-compiled Linux x86_64 binary (Bun compile)
+* Thu Oct 29 2026 user_76c6f026 <user_76c6f026@eur.openeuler.cn> - 1.19.5-1
+- Package opencode 1.19.5 for openEuler 24.03 LTS SP4 x86_64