# 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 ~79 MB npm platform package is fetched and checksum-verified during # %prep with networking enabled for this build. The binary inside the npm # package is byte-identical to the GitHub release asset for v1.19.5. The # resulting RPM installs the official upstream binary; it needs only glibc. # 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 # Huawei Cloud npm mirror is reachable from the EUR builders; the upstream # GitHub release host is not. %global upstream_url https://mirrors.huaweicloud.com/repository/npm/opencode-linux-x64/-/opencode-linux-x64-%{version}.tgz %global upstream_sha256 2d7cfc303decc6cbbcdb22ff1be258b03ce2b5eae57583545afc8f12c01dd5e0 Name: opencode Version: 1.19.5 Release: 1%{?dist} Summary: The open source coding agent License: MIT URL: https://github.com/anomalyco/opencode # Source0 is a zero-byte placeholder in the SRPM; %prep downloads the real # package from the mirror and verifies it against upstream_sha256 above. Source0: opencode-linux-x64.tgz Source1: https://raw.githubusercontent.com/anomalyco/opencode/v%{version}/LICENSE 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 official self-contained Linux x86_64 executable published by upstream. It requires only glibc at runtime; Node.js and Bun are not needed. %prep curl --fail --location --retry 3 --output opencode-linux-x64.tgz %{upstream_url} echo '%{upstream_sha256} opencode-linux-x64.tgz' | sha256sum -c - mkdir -p %{name}-%{version} tar -xzf opencode-linux-x64.tgz -C %{name}-%{version} cp -p %{SOURCE1} %{name}-%{version}/LICENSE %build # Pre-compiled upstream binary; nothing to compile. %install install -Dpm 0755 %{name}-%{version}/package/bin/opencode %{buildroot}%{_bindir}/opencode install -Dpm 0644 %{name}-%{version}/LICENSE %{buildroot}%{_licensedir}/%{name}/LICENSE %check %{buildroot}%{_bindir}/opencode --version | grep -qx '%{version}' %files %license %{_licensedir}/%{name}/LICENSE %{_bindir}/opencode %changelog * Thu Oct 29 2026 user_76c6f026 - 1.19.5-1 - Package opencode 1.19.5 for openEuler 24.03 LTS SP4 x86_64