summaryrefslogtreecommitdiff
path: root/opencode.spec
blob: f0c9386fdc119235a40b75a6980870ef35a57b05 (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
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
# opencode 1.19.5 for openEuler 24.03 LTS SP4 (x86_64).
#
# 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 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

# Upstream release asset recorded for traceability/reproducibility.
%global src_sha256 588310a336fa3b9df36b3f0225b26f679d453efaad0cf3d66c3651ef3ec1647a

Name:           opencode
Version:        1.19.5
Release:        3%{?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 LICENSE at the same tag, renamed so it does not collide with a
# generic "LICENSE" entry in SOURCES.
Source1:        opencode-LICENSE

ExclusiveArch:  x86_64
# 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 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
# 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
# Prebuilt upstream artifact (bun --compile output): nothing to compile.

%install
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
%license %{_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
  Node/Bun/npm mirrors; switch ghostty-web to the published 0.3.0 package