summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2026-10-29 10:49:04 +0000
committerCoprDistGit <infra@openeuler.org>2026-10-29 10:49:04 +0000
commitab2246e2f27b3d4ab71e8bae1e25babb405f8f9c (patch)
tree06b912b4c73d481dad1964b82abc8c2b511bbe94
parentd22b5471e6f096f6c0d5af2626f6201b42c8850f (diff)
automatic import of ollama
-rw-r--r--ollama.spec28
1 files changed, 21 insertions, 7 deletions
diff --git a/ollama.spec b/ollama.spec
index 9467ae4..2a34750 100644
--- a/ollama.spec
+++ b/ollama.spec
@@ -4,7 +4,7 @@
Name: ollama
Version: 0.40.13
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: Lightweight framework for running large language models locally
License: MIT
@@ -40,13 +40,20 @@ tar xf %{SOURCE1}
# 且 vendor/modules.txt 中多个依赖(gin-contrib/cors、gin-gonic/gin 等 16 个模块)
# 声明 go >= 1.25/1.26。GOTOOLCHAIN=local 下 go 工具链会逐模块校验
# vendor/modules.txt 的 go 版本要求(-mod=vendor 不豁免该校验),running go
-# 1.24.2 < 1.25 → 构建 ollama-go 失败:
-# go: github.com/gin-contrib/cors in vendor/modules.txt requires go >= 1.26.0
-# (running go 1.24.2; GOTOOLCHAIN=local)
-# 修复:1) 主模块 go.mod 降级 go 1.26.10 -> go 1.21(通过 go 1.24.2 版本检查);
+# 1.24.2 < 1.25 → 版本校验失败。
+#
+# 此外,ollama 源码及 vendored 依赖(golang.org/x/sys、klauspost/compress、
+# go-playground/validator、quic-go 等)大量使用 range-over-integer(go 1.22+)
+# 和 range-over-func iter.Seq2(go 1.23+)语法。go.mod 的 go 指令同时决定
+# 编译器的 -lang 语言版本:若降级到 go 1.21,则 -lang=go1.21 不支持这些语法,
+# 导致 66+ 处 "cannot range over N: requires go1.22/go1.23 or later" 编译错误。
+#
+# 修复:1) 主模块 go.mod 降级 go 1.26.10 -> go 1.24(通过 go 1.24.2 版本检查,
+# 且 -lang=go1.24 启用 range-over-int 与 range-over-func 语法支持);
# 2) vendor/modules.txt 中所有 go >= 1.25 的逐模块声明降级为 go 1.21
-# (go 1.24.x 声明保留,1.24.2 >= 1.24.x 通过校验)。
-sed -i 's/^go 1\.26\.10$/go 1.21/' go.mod
+# (仅影响版本校验,不影响编译器 -lang;go 1.24.x 声明保留,
+# 1.24.2 >= 1.24.x 通过校验)。
+sed -i 's/^go 1\.26\.10$/go 1.24/' go.mod
sed -i -E 's/## explicit; go 1\.2[5-9](\.[0-9]+)?/## explicit; go 1.21/' vendor/modules.txt
# 解压 llama.cpp 源码到 llama_cpp/ 子目录
@@ -93,6 +100,13 @@ DESTDIR=%{buildroot} cmake --install build
%{_libdir}/ollama/
%changelog
+* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 0.40.13-4
+- Fix Go compilation: go.mod go directive downgraded to go 1.24 (not 1.21)
+ because ollama source and vendored deps use range-over-integer (go 1.22+)
+ and range-over-func iter.Seq2 (go 1.23+) syntax. go 1.21 sets -lang=go1.21
+ which rejects these features (66+ "cannot range over" errors). go 1.24
+ passes the 1.24.2 version check and enables the required language features.
+
* Thu Oct 29 2026 AI Importer <ai-importer@openeuler.org> - 0.40.13-3
- Fix go vendor/modules.txt per-module go version check: downgrade all
go >= 1.25 declarations to go 1.21 so the chroot go toolchain (1.24.2,