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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# opencode 1.19.5 for openEuler 24.03 LTS SP4 (x86_64 + aarch64).
#
# 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.
#
# 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 release tarballs, which embed the CLI, the
# embedded Web UI and the Bun runtime.
#
# Offline build inputs (all 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/releases/download/v1.19.5/opencode-linux-arm64.tar.gz
# sha256 fae5be262d693b7c5e562856cc473e59e741772936db0c0600ac0d5ed5bd088b
# Source2 https://github.com/anomalyco/opencode/raw/v1.19.5/LICENSE
# sha256 625f0f619133f89bbbb2abe37369613dfa1885eba1e50d02170deb62bb42cb6b
#
# Both supported architectures are built from the same SRPM: %ifarch selects the
# matching upstream release artifact (opencode-linux-x64 vs
# opencode-linux-arm64).
%global debug_package %{nil}
%global __strip /bin/true
# Upstream release assets recorded for traceability/reproducibility.
%ifarch x86_64
%global src_sha256 588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a
%endif
%ifarch aarch64
%global src_sha256 fae5be262d693b7c5e562856cc473e59e741772936db0c0600ac0d5ed5bd088b
%endif
Name: opencode
Version: 1.19.5
Release: 2%{?dist}
Summary: The open source coding agent
License: MIT
URL: https://github.com/anomalyco/opencode
# 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-published standalone linux-arm64 archive (same payload for aarch64).
Source1: https://github.com/anomalyco/opencode/releases/download/v1.19.5/opencode-linux-arm64.tar.gz
# Upstream LICENSE at the same tag, renamed so it does not collide with a
# generic "LICENSE" entry in SOURCES.
Source2: opencode-LICENSE
ExclusiveArch: x86_64 aarch64
# Only local archive extraction and the sha256 check are needed: the build
# chroot has no network access and nothing is compiled.
BuildRequires: coreutils
BuildRequires: grep
BuildRequires: gzip
BuildRequires: tar
Requires: glibc
%description
opencode is an AI-powered development tool that runs coding agents in the
terminal. This package ships the upstream-published standalone Linux
executable (x86_64 / aarch64), 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
# Nothing is downloaded here: the build chroot has no network access.
# Verify the shipped archive against the recorded upstream sha256, then unpack.
%ifarch x86_64
echo '%{src_sha256} %{SOURCE0}' | sha256sum -c -
tar -xzf %{SOURCE0}
%endif
%ifarch aarch64
echo '%{src_sha256} %{SOURCE1}' | sha256sum -c -
tar -xzf %{SOURCE1}
%endif
%build
# Prebuilt upstream artifact (bun --compile output): nothing to compile.
%install
install -Dpm 0755 opencode %{buildroot}%{_bindir}/opencode
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_datadir}/licenses/%{name}/LICENSE
%check
# The embedded runtime needs a writable HOME to answer --version.
export HOME=%{_builddir}
%{buildroot}%{_bindir}/opencode --version | grep -qx '%{version}'
%files
%license %{_datadir}/licenses/%{name}/LICENSE
%{_bindir}/opencode
%changelog
* Fri Nov 13 2026 user_4518c38f <user_4518c38f@copr.local> - 1.19.5-2
- Make the build work offline: the COPR project disables network access during
builds (enable_net=false), so the GitHub source fetch, 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 release artifacts, which already
embed the CLI, the Web UI and the Bun runtime (spec-rules-nodejs: TypeScript
monorepo without a prebuilt dist/ tree cannot be compiled offline in the
openEuler chroot); %ifarch selects opencode-linux-x64 / opencode-linux-arm64
- Reference the full immutable upstream release URLs for Source0/Source1, ship
the upstream LICENSE as Source2, and verify the archive against its sha256
- Drop the models.dev snapshot and the curl/git/gcc/nodejs BuildRequires that
were only needed by the removed in-tree build
* Fri Nov 13 2026 user_4518c38f <user_4518c38f@copr.local> - 1.19.5-1
- Build opencode 1.19.5 from source for openEuler 24.03 LTS SP4 (x86_64, aarch64)
- Fetch upstream source at build time (direct codeload + GitHub proxy fallbacks);
use Huawei Cloud Node/Bun/npm mirrors; switch ghostty-web to the published
0.3.0 package; ship the models.dev snapshot in Source1
|