From 1a921abb20ce8b8b2bc1a7be0a1c1e14ea4e81ca Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Mon, 10 Aug 2026 14:55:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(gmp):=20=E5=8A=A0=20CN=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit compat.gmp 此前只有 ftp.gnu.org 一个源,CN 用户拉这 3.3MB 的 tarball 只能 走国际线路。现在 url 写成 GLOBAL/CN 表:GLOBAL 仍是 ftp.gnu.org 的权威 release,CN 指向 gitcode 上的 mcpp-res/gmp。 两边是同一份字节。上游下载后 sha256 = e56fd59d...ab24c,与描述符里原本 就写着的值一致;上传到 gitcode 的 6.3.0 release 后再从公开 url 下回来, 3332377 字节、sha256 相同。所以表里那一个 sha256 同时认证两条臂,不需要 按源各写一份。 描述符是 tools/gmp/generate_descriptor.py 生成的,模板一起改了 —— `generate_descriptor.py check` 报 in sync,重新生成是空 diff。 tests/check_mirror_urls.lua 与 mcpp xpkg parse 本地均通过。 --- pkgs/c/compat.gmp.lua | 21 +++++++++++++++------ tools/gmp/generate_descriptor.py | 21 +++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/pkgs/c/compat.gmp.lua b/pkgs/c/compat.gmp.lua index 47ee987..0367c33 100644 --- a/pkgs/c/compat.gmp.lua +++ b/pkgs/c/compat.gmp.lua @@ -89,25 +89,34 @@ package = { -- carried `xim:make@latest` on linux and nothing on macOS, which is the -- kind of per-platform asymmetry that only shows up as a red job. -- - -- No CN mirror table yet: mirroring needs an `mcpp-res` upload of the - -- identical bytes, which is a maintainer action. lint accepts the plain - -- string form and CN users fall back to ftp.gnu.org until then. + -- CN mirrors the identical bytes from `mcpp-res/gmp` -- the gitcode + -- release asset is a byte-for-byte copy of the ftp.gnu.org tarball, so + -- the single sha256 below authenticates either arm of the table. xpm = { linux = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, }, macosx = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, }, windows = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, }, diff --git a/tools/gmp/generate_descriptor.py b/tools/gmp/generate_descriptor.py index 75d0f32..0de6d64 100644 --- a/tools/gmp/generate_descriptor.py +++ b/tools/gmp/generate_descriptor.py @@ -658,25 +658,34 @@ def lua_string(s): -- carried `xim:make@latest` on linux and nothing on macOS, which is the -- kind of per-platform asymmetry that only shows up as a red job. -- - -- No CN mirror table yet: mirroring needs an `mcpp-res` upload of the - -- identical bytes, which is a maintainer action. lint accepts the plain - -- string form and CN users fall back to ftp.gnu.org until then. + -- CN mirrors the identical bytes from `mcpp-res/gmp` -- the gitcode + -- release asset is a byte-for-byte copy of the ftp.gnu.org tarball, so + -- the single sha256 below authenticates either arm of the table. xpm = { linux = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, }, macosx = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, }, windows = { ["6.3.0"] = { - url = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + url = { + GLOBAL = "https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.gz", + CN = "https://gitcode.com/mcpp-res/gmp/releases/download/6.3.0/gmp-6.3.0.tar.gz", + }, sha256 = "e56fd59d76810932a0555aa15a14b61c16bed66110d3c75cc2ac49ddaa9ab24c", }, },