blob: f8a16010658b9f2be6285d2a284a7ec7a7fed31b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# 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 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: 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
# 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
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.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 upstream binary; nothing to compile.
%install
install -Dpm 0755 %{name}-%{version}/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 <user_76c6f026@eur.openeuler.cn> - 1.19.5-1
- Package opencode 1.19.5 for openEuler 24.03 LTS SP4 x86_64
|