diff options
| author | CoprDistGit <infra@openeuler.org> | 2026-10-29 14:56:16 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2026-10-29 14:56:16 +0000 |
| commit | 99a13b4ab10a26f7129fdaadf280687086e9c9d7 (patch) | |
| tree | 00b1a4b1c25fd04871760287e02baa53c09c349d /opencode.spec | |
| parent | 33fcf13c51860b0bf07f22e7aedd79e4f318e513 (diff) | |
automatic import of opencodeopeneuler25.09
Diffstat (limited to 'opencode.spec')
| -rw-r--r-- | opencode.spec | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/opencode.spec b/opencode.spec index ba620f3..c6b2be6 100644 --- a/opencode.spec +++ b/opencode.spec @@ -3,11 +3,13 @@ # Adapted from the openEuler EUR reference SRPM (user_76c6f026/openEuler_summit, # opencode-1.19.5-2, built for openEuler 24.03 LTS SP4), rebuilt for 25.09. # -# The EUR upload endpoint rejects SRPMs of a few MB, so this SRPM is kept tiny: -# the upstream source archive is fetched in %prep from a reachable GitHub proxy, -# Node.js and Bun come from Huawei Cloud mirrors, and the npm dependency tree -# is resolved from the Huawei npm mirror. The models.dev snapshot is small -# enough to ship compressed in the SRPM (Source1). +# The EUR upload endpoint rejects SRPMs of a few MB, so the reference spec +# fetched the upstream archive in %prep from a reachable GitHub proxy. This +# COPR build ships the archive in the SRPM instead (Source0) and %prep prefers +# it, so the build no longer depends on a proxy being reachable. Node.js and +# Bun still come from Huawei Cloud mirrors and the npm dependency tree from the +# Huawei npm mirror. The models.dev snapshot is small enough to ship compressed +# in the SRPM (Source1). # # The upstream source is pruned to the CLI + embedded Web UI workspace closure # (console/stats/desktop/docs/web/storybook/slack/identity/containers/cli/ @@ -34,7 +36,7 @@ Summary: The open source coding agent License: MIT URL: https://github.com/anomalyco/opencode -# Source0 is a zero-byte placeholder; %prep fetches the real archive. +# Source0 carries the upstream tarball (opencode-1.19.5/ top-level dir). Source0: opencode-1.19.5.tar.gz Source1: models-api.json.xz @@ -73,21 +75,34 @@ Node.js and Bun are not needed after installation. %prep cd %{_builddir} +# The upstream archive ships inside the SRPM as Source0, so %prep needs no +# network access. A network fetch of the ~100 MB source from a GitHub proxy +# stalled here and burned the whole build wall clock (build 114042), so the +# in-SRPM archive is used first; the proxies remain only as a fallback for +# the zero-byte placeholder case. src_ok=0 -for url in \ - "%{src_proxy}" \ - "https://gh.llkk.cc/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz" \ - "https://gh-proxy.com/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz"; do - echo "Fetching source from ${url}" - if curl --fail --location --retry 2 --connect-timeout 30 --max-time 900 \ - --output src.tar.gz "${url}"; then - if tar -tzf src.tar.gz 2>/dev/null | grep -q '^opencode-1.19.5/'; then - src_ok=1 - break +if [ -s "%{SOURCE0}" ] && \ + tar -tzf "%{SOURCE0}" 2>/dev/null | grep -q '^opencode-1.19.5/'; then + echo "Using source archive shipped in the SRPM: %{SOURCE0}" + cp -f "%{SOURCE0}" src.tar.gz + src_ok=1 +fi +if [ "${src_ok}" != "1" ]; then + for url in \ + "%{src_proxy}" \ + "https://gh.llkk.cc/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz" \ + "https://gh-proxy.com/https://github.com/anomalyco/opencode/archive/refs/tags/v1.19.5.tar.gz"; do + echo "Fetching source from ${url}" + if curl --fail --location --retry 2 --connect-timeout 30 --max-time 900 \ + --output src.tar.gz "${url}"; then + if tar -tzf src.tar.gz 2>/dev/null | grep -q '^opencode-1.19.5/'; then + src_ok=1 + break + fi fi - fi - rm -f src.tar.gz -done + rm -f src.tar.gz + done +fi if [ "${src_ok}" != "1" ]; then echo "ERROR: no source mirror was reachable" >&2 exit 1 @@ -95,6 +110,11 @@ fi tar -xzf src.tar.gz cd opencode-1.19.5 +# The in-SRPM archive is re-packed from the upstream git clone, so it carries +# the .git directory (the GitHub tag archive does not). Drop it so the build +# tree is byte-identical to the previous (network-fetched) layout. +rm -rf .git + # Keep only the CLI + embedded-Web-UI workspace closure. rm -rf packages/console packages/stats packages/enterprise packages/desktop \ packages/docs packages/web packages/storybook packages/slack \ |
