Open
[EUR] update opencode from build #114029 #17
openeuler-infra-botAdd on 10 days ago
[EUR] update opencode from build #114029 #17
Open
Total: 2 files changed+64-378
| @@ -0,0 +1,21 @@ | |||
| 1 | +MIT License | ||
| 2 | + | ||
| 3 | +Copyright (c) 2025 opencode | ||
| 4 | + | ||
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 6 | +of this software and associated documentation files (the "Software"), to deal | ||
| 7 | +in the Software without restriction, including without limitation the rights | ||
| 8 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 9 | +copies of the Software, and to permit persons to whom the Software is | ||
| 10 | +furnished to do so, subject to the following conditions: | ||
| 11 | + | ||
| 12 | +The above copyright notice and this permission notice shall be included in all | ||
| 13 | +copies or substantial portions of the Software. | ||
| 14 | + | ||
| 15 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 16 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 17 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 18 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 19 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 20 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 21 | +SOFTWARE. | ||
| @@ -1,402 +1,67 @@ | |||
| 1 | +# topdir: package (npm 平台包 opencode-linux-x64 解压顶层目录) | ||
| 2 | +# 打包策略:opencode 上游使用 Bun 的 compile 能力将 TypeScript monorepo 编译为 | ||
| 3 | +# 单一可执行 ELF 二进制。openEuler 官方源不提供 Bun 工具链,无法在构建阶段 | ||
| 4 | +# 从源码编译;上游官方通过 GitHub release 与 npm 平台包发布预编译二进制。 | ||
| 5 | +# 本包直接采用上游官方发布的 Linux x86_64 (glibc) 预编译二进制作为 Source0, | ||
| 6 | +# 无需 Node.js / Bun 运行时,仅依赖 glibc。 | ||
| 7 | +# monorepo 内部 workspace 包(opencode-ai/plugin、script、sdk)在编译时 | ||
| 8 | +# 已被打进二进制,运行时不作为独立 RPM 依赖。 | ||
| 9 | + | ||
| 10 | +# 预编译二进制保护:Bun compile 产物将其版本号等运行时元数据嵌入 ELF 节中, | ||
| 11 | +# 任何形式的 strip(含 find-debuginfo 的 --strip-debug / -g)都会移除这些节, | ||
| 12 | +# 导致 `opencode --version` 退化为 Bun 运行时编译期默认值(1.4.4), | ||
| 13 | +# %check 的版本校验随之失败。本包直接采用上游预编译产物,无源码可重新编译, | ||
| 14 | +# 因此必须彻底禁用 debuginfo 提取与 strip,保持二进制原样。 | ||
| 1 | %global debug_package %{nil} | 15 | %global debug_package %{nil} |
| 2 | %global __strip /bin/true | 16 | %global __strip /bin/true |
| 3 | -%global __provides_exclude_from ^/opt/OpenCode/.*$ | ||
| 4 | -%global __requires_exclude_from ^/opt/OpenCode/.*$ | ||
| 5 | -%global electron_mirror https://mirrors.huaweicloud.com/electron/ | ||
| 6 | -%global electron_builder_binaries_mirror https://mirrors.huaweicloud.com/electron-builder-binaries/ | ||
| 7 | -%global nodejs_version 24.18.0 | ||
| 8 | -%{!?opencode_cache_dir:%global opencode_cache_dir %{_builddir}/%{name}-%{version}/.cache/opencode-rpm} | ||
| 9 | - | ||
| 10 | -# Both architecture variants of the vendored node_modules and of the Node.js | ||
| 11 | -# toolchain are declared as separate Source entries with fixed file names, so a | ||
| 12 | -# single SRPM carries the complete source set for aarch64 and x86_64. Deriving | ||
| 13 | -# those file names from the build target architecture instead would resolve to | ||
| 14 | -# a single variant per spec parse, leave the other one out of the SRPM and make | ||
| 15 | -# that SRPM impossible to rebuild for the second architecture. | ||
| 16 | -%ifarch aarch64 | ||
| 17 | -%global electron_builder_arch arm64 | ||
| 18 | -%global opencode_deps_source %{SOURCE3} | ||
| 19 | -%global opencode_node_source %{SOURCE5} | ||
| 20 | -%endif | ||
| 21 | -%ifarch x86_64 | ||
| 22 | -%global electron_builder_arch x64 | ||
| 23 | -%global opencode_deps_source %{SOURCE2} | ||
| 24 | -%global opencode_node_source %{SOURCE4} | ||
| 25 | -%endif | ||
| 26 | -%global opencode_build_target opencode-linux-%{electron_builder_arch} | ||
| 27 | -%global electron_rpm_arch %{_target_cpu} | ||
| 28 | 17 | ||
| 29 | Name: opencode | 18 | Name: opencode |
| 30 | -Version: 1.17.13 | 19 | +Version: 1.19.5 |
| 31 | -Release: 2 | 20 | +Release: 2%{?dist} |
| 32 | -Summary: The open source coding agent. | 21 | +Summary: AI-powered development tool |
| 33 | 22 | ||
| 34 | License: MIT | 23 | License: MIT |
| 35 | URL: https://github.com/anomalyco/opencode | 24 | URL: https://github.com/anomalyco/opencode |
| 36 | -%global source_archive v%{version}.tar.gz | 25 | +# Source0 为 npm 平台包 opencode-linux-x64,内含上游官方预编译的 Linux x86_64 |
| 37 | -Source0: https://github.com/anomalyco/%{name}/archive/refs/tags/%{source_archive} | 26 | +# glibc 二进制(Bun compile 产物)。解压顶层目录为 package/。 |
| 38 | -# Build-time models.dev snapshot consumed by packages/opencode/script/build.ts. | 27 | +Source0: https://registry.npmjs.org/opencode-linux-x64/-/opencode-linux-x64-%{version}.tgz |
| 39 | -Source1: opencode-models-api.json | 28 | +# Source1 为 MIT 许可证文本,取自上游 git 仓库对应版本 tag 根目录。 |
| 40 | -# Vendored node_modules, one tarball per architecture. | 29 | +Source1: https://raw.githubusercontent.com/anomalyco/opencode/v%{version}/LICENSE |
| 41 | -Source2: opencode-deps-x86_64-%{version}.tar.xz | ||
| 42 | -Source3: opencode-deps-aarch64-%{version}.tar.xz | ||
| 43 | -# Pre-downloaded Node.js LTS, one tarball per architecture. | ||
| 44 | -Source4: https://nodejs.org/dist/v%{nodejs_version}/node-v%{nodejs_version}-linux-x64.tar.xz | ||
| 45 | -Source5: https://nodejs.org/dist/v%{nodejs_version}/node-v%{nodejs_version}-linux-arm64.tar.xz | ||
| 46 | -# Desktop .desktop files and icons extracted from official upstream RPMs. | ||
| 47 | -Source6: opencode-assets-%{version}.tar.gz | ||
| 48 | 30 | ||
| 49 | -ExclusiveArch: aarch64 x86_64 | 31 | +# 预编译二进制为 x86_64 专属 ELF(glibc 动态链接),仅在该架构提供。 |
| 50 | - | 32 | +ExclusiveArch: x86_64 |
| 51 | -BuildRequires: findutils | ||
| 52 | -BuildRequires: git | ||
| 53 | -BuildRequires: gzip | ||
| 54 | -BuildRequires: cpio | ||
| 55 | -BuildRequires: chrpath | ||
| 56 | -BuildRequires: patch | ||
| 57 | -BuildRequires: tar | ||
| 58 | -BuildRequires: unzip | ||
| 59 | -BuildRequires: which | ||
| 60 | -BuildRequires: xz | ||
| 61 | -BuildRequires: zip | ||
| 62 | -Requires: git | ||
| 63 | - | ||
| 64 | -%package desktop | ||
| 65 | -Summary: Electron desktop app for OpenCode with bundled sidecar CLI | ||
| 66 | -License: MIT | ||
| 67 | -Requires: at-spi2-core | ||
| 68 | -Requires: gtk3 | ||
| 69 | -Requires: libXScrnSaver | ||
| 70 | -Requires: libnotify | ||
| 71 | -Requires: nss | ||
| 72 | -Requires: xdg-utils | ||
| 73 | -Requires: (libXtst or libXtst6) | ||
| 74 | -Requires: (libuuid or libuuid1) | ||
| 75 | 33 | ||
| 76 | %description | 34 | %description |
| 77 | -The open source AI coding agent | 35 | +opencode is an AI-powered development tool that runs coding agents in the |
| 78 | - | 36 | +terminal. This package ships the officially pre-compiled Linux x86_64 binary |
| 79 | -%description desktop | 37 | +produced upstream with Bun's compile. Because the binary is self-contained |
| 80 | -The open source AI coding agent | 38 | +(only requiring glibc), no Node.js or Bun toolchain is needed at build or |
| 39 | +runtime. | ||
| 81 | 40 | ||
| 82 | %prep | 41 | %prep |
| 83 | -rm -rf %{name}-%{version} | 42 | +# npm tarball 解压顶层目录固定为 package/ |
| 84 | -mkdir -p %{name}-%{version} | 43 | +%setup -n package -q |
| 85 | -tar -xzf %{_sourcedir}/%{source_archive} --strip-components=1 -C %{name}-%{version} | 44 | +cp -p %{SOURCE1} . |
| 86 | -cd %{name}-%{version} | ||
| 87 | 45 | ||
| 88 | %build | 46 | %build |
| 89 | -cd %{name}-%{version} | 47 | +# Pre-compiled binary; nothing to build. |
| 90 | - | ||
| 91 | -export HOME="%{_builddir}/%{name}-%{version}/.home" | ||
| 92 | -mkdir -p "$HOME" | ||
| 93 | - | ||
| 94 | -# Use pre-downloaded Node.js LTS instead of system nodejs | ||
| 95 | -mkdir -p "%{opencode_cache_dir}/nodejs" | ||
| 96 | -tar -xJf "%{opencode_node_source}" --strip-components=1 -C "%{opencode_cache_dir}/nodejs" | ||
| 97 | -export PATH="%{opencode_cache_dir}/nodejs/bin:$PATH" | ||
| 98 | - | ||
| 99 | -export npm_config_registry="https://mirrors.huaweicloud.com/repository/npm/" | ||
| 100 | -export NPM_CONFIG_REGISTRY="$npm_config_registry" | ||
| 101 | -export npm_config_cache="%{opencode_cache_dir}/npm" | ||
| 102 | -export NPM_CONFIG_CACHE="$npm_config_cache" | ||
| 103 | -export NPM_CONFIG_PREFIX="%{opencode_cache_dir}/npm-global" | ||
| 104 | -export PATH="$NPM_CONFIG_PREFIX/bin:$PATH" | ||
| 105 | -export XDG_CACHE_HOME="%{opencode_cache_dir}/xdg" | ||
| 106 | -mkdir -p "$NPM_CONFIG_PREFIX" "$npm_config_cache" "$XDG_CACHE_HOME" | ||
| 107 | - | ||
| 108 | -export ELECTRON_MIRROR="%{electron_mirror}" | ||
| 109 | -export ELECTRON_BUILDER_BINARIES_MIRROR="%{electron_builder_binaries_mirror}" | ||
| 110 | -export ELECTRON_CACHE="%{opencode_cache_dir}/electron" | ||
| 111 | -export ELECTRON_BUILDER_CACHE="%{opencode_cache_dir}/electron-builder" | ||
| 112 | -mkdir -p "$ELECTRON_CACHE" "$ELECTRON_BUILDER_CACHE" | ||
| 113 | - | ||
| 114 | -npm config set registry "$npm_config_registry" | ||
| 115 | -npm config set cache "$npm_config_cache" | ||
| 116 | -npm config set prefix "$NPM_CONFIG_PREFIX" | ||
| 117 | - | ||
| 118 | -bun_version="$(node -p 'const manager = require("./package.json").packageManager || ""; if (!manager.startsWith("bun@")) { throw new Error("packageManager must be bun@<version>"); } manager.slice(4)')" | ||
| 119 | -echo "Using bun version ${bun_version} from package.json" | ||
| 120 | - | ||
| 121 | -if command -v bun >/dev/null 2>&1 && [ "$(bun --version)" = "$bun_version" ]; then | ||
| 122 | - echo "Reusing cached bun $(bun --version)" | ||
| 123 | -else | ||
| 124 | - npm install -g "bun@${bun_version}" | ||
| 125 | -fi | ||
| 126 | - | ||
| 127 | -if command -v node-gyp >/dev/null 2>&1; then | ||
| 128 | - echo "Reusing cached node-gyp $(node-gyp --version)" | ||
| 129 | -else | ||
| 130 | - npm install -g node-gyp | ||
| 131 | -fi | ||
| 132 | - | ||
| 133 | -bun --version | ||
| 134 | -node-gyp --version | ||
| 135 | - | ||
| 136 | -export BUN_INSTALL_CACHE_DIR="%{opencode_cache_dir}/bun/install/cache" | ||
| 137 | -export BUN_RUNTIME_TRANSPILER_CACHE_PATH="%{opencode_cache_dir}/bun/runtime-cache" | ||
| 138 | -export BUN_CONFIG_DISABLE_ANALYTICS=1 | ||
| 139 | -export MODELS_DEV_API_JSON="%{SOURCE1}" | ||
| 140 | -export OPENCODE_VERSION="%{version}" | ||
| 141 | -export OPENCODE_CHANNEL="prod" | ||
| 142 | -export USE_HARD_LINKS=false | ||
| 143 | -mkdir -p "$BUN_INSTALL_CACHE_DIR" "$(dirname "$BUN_RUNTIME_TRANSPILER_CACHE_PATH")" | ||
| 144 | - | ||
| 145 | -# Extract pre-built node_modules then restore the three symlink | ||
| 146 | -# categories bun only creates for root dependencies. | ||
| 147 | -echo "Extracting pre-bundled node_modules" | ||
| 148 | -tar -xJf "%{opencode_deps_source}" -C . | ||
| 149 | - | ||
| 150 | -# 1. Package symlinks for transitive deps (flat + scoped) | ||
| 151 | -echo "Restoring package symlinks" | ||
| 152 | -ers=0 | ||
| 153 | -for link in node_modules/.bun/node_modules/* node_modules/.bun/node_modules/@*/*; do | ||
| 154 | - [[ -L "$link" ]] || continue | ||
| 155 | - pkg="${link#node_modules/.bun/node_modules/}" | ||
| 156 | - if [[ ! -e "node_modules/$pkg" ]]; then | ||
| 157 | - mkdir -p "$(dirname "node_modules/$pkg")" | ||
| 158 | - case "$pkg" in | ||
| 159 | - */*) ln -sf "../.bun/node_modules/$pkg" "node_modules/$pkg" ;; | ||
| 160 | - *) ln -sf "./.bun/node_modules/$pkg" "node_modules/$pkg" ;; | ||
| 161 | - esac | ||
| 162 | - ers=$((ers + 1)) | ||
| 163 | - fi | ||
| 164 | -done | ||
| 165 | -echo " $ers package symlinks" | ||
| 166 | - | ||
| 167 | -# 2. .bin/ entries for transitive deps with bin scripts | ||
| 168 | -echo "Restoring .bin/ symlinks" | ||
| 169 | -bins=0 | ||
| 170 | -for bindir in node_modules/.bun/*/node_modules/.bin; do | ||
| 171 | - [[ -d "$bindir" ]] || continue | ||
| 172 | - for binfile in "$bindir"/*; do | ||
| 173 | - [[ -L "$binfile" ]] || continue | ||
| 174 | - name="$(basename "$binfile")" | ||
| 175 | - [[ -e "node_modules/.bin/$name" ]] && continue | ||
| 176 | - tgt="$(readlink "$binfile")"; pkg="${tgt#../}"; pkg="${pkg%%/*}" | ||
| 177 | - [[ -e "node_modules/$pkg" ]] || continue | ||
| 178 | - ln -sf "$tgt" "node_modules/.bin/$name" | ||
| 179 | - bins=$((bins + 1)) | ||
| 180 | - done | ||
| 181 | -done | ||
| 182 | -echo " $bins .bin/ symlinks" | ||
| 183 | - | ||
| 184 | -# 3. Workspace symlinks for non-root workspace deps | ||
| 185 | -echo "Restoring workspace symlinks" | ||
| 186 | -wss=0 | ||
| 187 | -for pkgjson in packages/*/package.json packages/*/*/package.json packages/*/*/*/package.json; do | ||
| 188 | - [[ -f "$pkgjson" ]] || continue | ||
| 189 | - name="$(node -p "require('./$pkgjson').name || ''" 2>/dev/null)" | ||
| 190 | - [[ -n "$name" ]] || continue | ||
| 191 | - [[ -e "node_modules/$name" ]] && continue | ||
| 192 | - mkdir -p "node_modules/$(dirname "$name")" | ||
| 193 | - ln -sf "../../$(dirname "$pkgjson")" "node_modules/$name" | ||
| 194 | - wss=$((wss + 1)) | ||
| 195 | -done | ||
| 196 | -echo " $wss workspace symlinks" | ||
| 197 | - | ||
| 198 | -echo "Running postinstall (fix-node-pty)" | ||
| 199 | -bun run --cwd packages/core fix-node-pty 2>/dev/null || : | ||
| 200 | - | ||
| 201 | -pushd packages/opencode | ||
| 202 | -bun run script/build.ts --single --skip-install | ||
| 203 | -popd | ||
| 204 | - | ||
| 205 | -cp -f "packages/opencode/dist/%{opencode_build_target}/bin/opencode" "packages/desktop/resources/opencode-cli" | ||
| 206 | -pushd packages/desktop | ||
| 207 | -bun run build | ||
| 208 | -# Build Electron app without fpm RPM packaging. | ||
| 209 | -# Desktop files and icons come from Source4 (official upstream RPMs). | ||
| 210 | -cat > .electron-builder.override.yml <<'EOF' | ||
| 211 | -npmRebuild: false | ||
| 212 | -EOF | ||
| 213 | -bun x electron-builder --linux dir --config electron-builder.config.ts --config .electron-builder.override.yml --publish never | ||
| 214 | - | ||
| 215 | -desktop_share_cache=".desktop-share" | ||
| 216 | -rm -rf "$desktop_share_cache" | ||
| 217 | -mkdir -p "$desktop_share_cache" | ||
| 218 | -# Extract only the current architecture's desktop files | ||
| 219 | -tar -xzf "%{SOURCE6}" -C "$desktop_share_cache" "%{electron_rpm_arch}/usr" | ||
| 220 | -mv "$desktop_share_cache"/%{electron_rpm_arch}/usr "$desktop_share_cache"/ | ||
| 221 | -rm -rf "$desktop_share_cache"/%{electron_rpm_arch} | ||
| 222 | -find "$desktop_share_cache" -name '._*' -delete | ||
| 223 | -popd | ||
| 224 | 48 | ||
| 225 | %install | 49 | %install |
| 226 | -cd %{name}-%{version} | 50 | +install -Dpm 0755 bin/opencode %{buildroot}%{_bindir}/opencode |
| 227 | - | ||
| 228 | -install -d "%{buildroot}%{_bindir}" | ||
| 229 | -install -Dm755 "packages/opencode/dist/%{opencode_build_target}/bin/opencode" "%{buildroot}%{_bindir}/opencode" | ||
| 230 | -install -d "%{buildroot}%{_licensedir}/%{name}" | ||
| 231 | -install -Dm644 LICENSE "%{buildroot}%{_licensedir}/%{name}/LICENSE" | ||
| 232 | -install -d "%{buildroot}%{_licensedir}/%{name}-desktop" | ||
| 233 | -install -Dm644 LICENSE "%{buildroot}%{_licensedir}/%{name}-desktop/LICENSE" | ||
| 234 | -install -d "%{buildroot}%{_docdir}/%{name}" | ||
| 235 | -install -Dm644 README.md "%{buildroot}%{_docdir}/%{name}/README.md" | ||
| 236 | - | ||
| 237 | -desktop_unpack_dir="" | ||
| 238 | -for candidate in packages/desktop/dist/linux-unpacked packages/desktop/dist/linux-%{electron_builder_arch}-unpacked; do | ||
| 239 | - if [ -d "$candidate" ]; then | ||
| 240 | - desktop_unpack_dir="$candidate" | ||
| 241 | - break | ||
| 242 | - fi | ||
| 243 | -done | ||
| 244 | - | ||
| 245 | -install -d "%{buildroot}/opt/OpenCode" | ||
| 246 | -cp -a "$desktop_unpack_dir/." "%{buildroot}/opt/OpenCode/" | ||
| 247 | - | ||
| 248 | -install -d "%{buildroot}%{_datadir}" | ||
| 249 | -cp -a "packages/desktop/.desktop-share/usr/share/." "%{buildroot}%{_datadir}/" | ||
| 250 | - | ||
| 251 | -desktop_app_root="%{buildroot}/opt/OpenCode" | ||
| 252 | -desktop_launcher_name="" | ||
| 253 | -for candidate in opencode OpenCode @opencode-aidesktop @opencode-aidesktop-electron; do | ||
| 254 | - if [ -x "$desktop_app_root/$candidate" ]; then | ||
| 255 | - desktop_launcher_name="$candidate" | ||
| 256 | - break | ||
| 257 | - fi | ||
| 258 | -done | ||
| 259 | - | ||
| 260 | -if [ -z "$desktop_launcher_name" ]; then | ||
| 261 | - desktop_launcher_path="$(find "$desktop_app_root" -maxdepth 1 -type f -executable ! -name 'chrome-sandbox' ! -name 'chrome_crashpad_handler' ! -name '*.so*' | head -n 1)" | ||
| 262 | - if [ -n "$desktop_launcher_path" ]; then | ||
| 263 | - desktop_launcher_name="$(basename "$desktop_launcher_path")" | ||
| 264 | - fi | ||
| 265 | -fi | ||
| 266 | - | ||
| 267 | -if [ -z "$desktop_launcher_name" ]; then | ||
| 268 | - echo "Could not determine desktop launcher under $desktop_app_root" >&2 | ||
| 269 | - find "$desktop_app_root" -maxdepth 1 -type f >&2 || : | ||
| 270 | - exit 1 | ||
| 271 | -fi | ||
| 272 | - | ||
| 273 | -ln -s "../../opt/OpenCode/${desktop_launcher_name}" "%{buildroot}%{_bindir}/@opencode-aidesktop-electron" | ||
| 274 | -ln -s "../../opt/OpenCode/${desktop_launcher_name}" "%{buildroot}%{_bindir}/opencode-desktop" | ||
| 275 | 51 | ||
| 276 | %check | 52 | %check |
| 277 | -cd %{name}-%{version} | 53 | +# Verify the shipped binary reports the expected version. |
| 278 | - | 54 | +%{buildroot}%{_bindir}/opencode --version | grep -q "^%{version}$" |
| 279 | -./packages/opencode/dist/%{opencode_build_target}/bin/opencode --version | grep -F "%{version}" | ||
| 280 | -desktop_unpack_dir="" | ||
| 281 | -for candidate in ./packages/desktop/dist/linux-unpacked ./packages/desktop/dist/linux-%{electron_builder_arch}-unpacked; do | ||
| 282 | - if [ -d "$candidate" ]; then | ||
| 283 | - desktop_unpack_dir="$candidate" | ||
| 284 | - break | ||
| 285 | - fi | ||
| 286 | -done | ||
| 287 | -test -n "$desktop_unpack_dir" | ||
| 288 | - | ||
| 289 | -desktop_launcher_path="" | ||
| 290 | -for candidate in opencode OpenCode @opencode-aidesktop @opencode-aidesktop-electron; do | ||
| 291 | - if [ -x "$desktop_unpack_dir/$candidate" ]; then | ||
| 292 | - desktop_launcher_path="$desktop_unpack_dir/$candidate" | ||
| 293 | - break | ||
| 294 | - fi | ||
| 295 | -done | ||
| 296 | - | ||
| 297 | -if [ -z "$desktop_launcher_path" ]; then | ||
| 298 | - desktop_launcher_path="$(find "$desktop_unpack_dir" -maxdepth 1 -type f -executable ! -name 'chrome-sandbox' ! -name 'chrome_crashpad_handler' ! -name '*.so*' | head -n 1)" | ||
| 299 | -fi | ||
| 300 | - | ||
| 301 | -test -n "$desktop_launcher_path" | ||
| 302 | -test -x "$desktop_launcher_path" | ||
| 303 | - | ||
| 304 | -%post -n %{name}-desktop | ||
| 305 | -if command -v unshare >/dev/null 2>&1 && [[ -L /proc/self/ns/user ]] && unshare --user true >/dev/null 2>&1; then | ||
| 306 | - chmod 0755 /opt/OpenCode/chrome-sandbox || : | ||
| 307 | -else | ||
| 308 | - chmod 4755 /opt/OpenCode/chrome-sandbox || : | ||
| 309 | -fi | ||
| 310 | - | ||
| 311 | -if command -v update-desktop-database >/dev/null 2>&1; then | ||
| 312 | - update-desktop-database %{_datadir}/applications >/dev/null 2>&1 || : | ||
| 313 | -fi | ||
| 314 | - | ||
| 315 | -if command -v gtk-update-icon-cache >/dev/null 2>&1; then | ||
| 316 | - gtk-update-icon-cache -q %{_datadir}/icons/hicolor >/dev/null 2>&1 || : | ||
| 317 | -fi | ||
| 318 | - | ||
| 319 | -%postun -n %{name}-desktop | ||
| 320 | -if command -v update-desktop-database >/dev/null 2>&1; then | ||
| 321 | - update-desktop-database %{_datadir}/applications >/dev/null 2>&1 || : | ||
| 322 | -fi | ||
| 323 | - | ||
| 324 | -if command -v gtk-update-icon-cache >/dev/null 2>&1; then | ||
| 325 | - gtk-update-icon-cache -q %{_datadir}/icons/hicolor >/dev/null 2>&1 || : | ||
| 326 | -fi | ||
| 327 | 55 | ||
| 328 | %files | 56 | %files |
| 329 | -%license %{_licensedir}/%{name}/LICENSE | 57 | +%license LICENSE |
| 330 | -%doc %{_docdir}/%{name}/README.md | ||
| 331 | %{_bindir}/opencode | 58 | %{_bindir}/opencode |
| 332 | 59 | ||
| 333 | -%files desktop | ||
| 334 | -%license %{_licensedir}/%{name}-desktop/LICENSE | ||
| 335 | -%{_bindir}/@opencode-aidesktop-electron | ||
| 336 | -%{_bindir}/opencode-desktop | ||
| 337 | -/opt/OpenCode | ||
| 338 | -%{_datadir}/applications/*.desktop | ||
| 339 | -%{_datadir}/icons/hicolor/*/apps/* | ||
| 340 | - | ||
| 341 | %changelog | 60 | %changelog |
| 342 | -* Thu Sep 17 2026 hongyu-shi <shywzt@iCloud.com> - 1.17.13-2 | 61 | +* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 1.19.5-2 |
| 343 | -- Ship the aarch64 and x86_64 variants of the vendored node_modules and Node.js | 62 | +- Disable debug_package and strip: stripping corrupts the Bun-compiled binary's |
| 344 | - tarballs as separate Source entries with fixed names so the SRPM contains the | 63 | + embedded version metadata, causing --version to report a fallback value. |
| 345 | - full dual-architecture source set, and select them at build time with %ifarch | ||
| 346 | 64 | ||
| 347 | -* Thu Jul 02 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.17.13-1 | 65 | +* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 1.19.5-1 |
| 348 | -- Sync to upstream v1.17.13 release | 66 | +- Initial package for opencode 1.19.5 |
| 349 | - | 67 | +- Ship upstream pre-compiled Linux x86_64 binary (Bun compile) |
| 350 | -* Wed Jul 01 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.17.12-1 | ||
| 351 | -- Sync to upstream v1.17.12 release | ||
| 352 | - | ||
| 353 | -* Mon Jun 15 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.17.7-1 | ||
| 354 | -- Sync to upstream v1.17.7 release | ||
| 355 | - | ||
| 356 | -* Tue Jun 02 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.15.13-1 | ||
| 357 | -- Sync to upstream v1.15.13 release | ||
| 358 | - | ||
| 359 | -* Fri May 29 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.15.12-1 | ||
| 360 | -- Sync to upstream v1.15.12 release | ||
| 361 | - | ||
| 362 | -* Fri May 29 2026 hongyu-shi <shywzt@iCloud.com> - 1.15.10-2 | ||
| 363 | -- Split opencode and opencode-desktop into a standalone spec | ||
| 364 | - | ||
| 365 | -* Wed May 27 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.15.10-1 | ||
| 366 | -- Sync to upstream v1.15.10 release | ||
| 367 | - | ||
| 368 | -* Wed May 20 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.15.5-1 | ||
| 369 | -- Sync to upstream v1.15.5 release | ||
| 370 | - | ||
| 371 | -* Wed May 13 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.14.48-1 | ||
| 372 | -- Sync to upstream v1.14.48 release | ||
| 373 | - | ||
| 374 | -* Thu May 07 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.14.40-1 | ||
| 375 | -- Sync to upstream v1.14.40 release | ||
| 376 | - | ||
| 377 | -* Mon Apr 20 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.14.18-1 | ||
| 378 | -- Sync to upstream v1.14.18 release | ||
| 379 | - | ||
| 380 | -* Wed Apr 08 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.4.0-1 | ||
| 381 | -- Sync to upstream v1.4.0 release | ||
| 382 | - | ||
| 383 | -* Wed Apr 08 2026 hongyu-shi <shywzt@iCloud.com> - 1.3.17-2 | ||
| 384 | -- Split per-subpackage license metadata and ship the base package license text | ||
| 385 | - | ||
| 386 | -* Tue Apr 07 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.3.17-1 | ||
| 387 | -- Sync to upstream v1.3.17 release | ||
| 388 | - | ||
| 389 | -* Thu Apr 02 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.3.13-1 | ||
| 390 | -- Sync to upstream v1.3.13 release | ||
| 391 | - | ||
| 392 | -* Mon Mar 30 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.3.7-1 | ||
| 393 | -- Sync to upstream v1.3.7 release | ||
| 394 | - | ||
| 395 | -* Wed Mar 25 2026 SIG-Intelligence <intelligence@openeuler.org> - 1.3.2-1 | ||
| 396 | -- Sync to upstream v1.3.2 release | ||
| 397 | - | ||
| 398 | -* Wed Mar 18 2026 hongyu-shi <shywzt@iCloud.com> - 1.2.27-1 | ||
| 399 | -- Add openEuler RPM packaging for OpenCode CLI & Desktop | ||
| 400 | - | ||
| 401 | -* Wed Jan 21 2026 Wangkui <wangkui35@h-partners.com> - 1.1.28-1 | ||
| 402 | -- add opencode | ||