From 2a8bddbb29eded2c897cb5942958d24442d5e3c4 Mon Sep 17 00:00:00 2001 From: YAYOI27 <111715843+yayoinoyume@users.noreply.github.com> Date: Sun, 6 Sep 2026 15:50:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(recipe):=20arch=20=E6=8D=A2=E6=BA=90?= =?UTF-8?q?=E5=B9=82=E7=AD=89(=E4=BB=85=20x86)=EF=BC=8C=E6=B8=85=E6=8E=89?= =?UTF-8?q?=E7=B4=AF=E7=A7=AF=20Server=20=E8=A1=8C=E5=B9=B6=E8=A1=A5?= =?UTF-8?q?=E5=AE=98=E6=96=B9=E5=85=9C=E5=BA=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - x86_64 换源前先清空 /etc/pacman.d/mirrorlist 中所有生效 Server 行(含多次换源累积的旧行) - 再写入「新源 + 官方源兜底」,保证每次换源后文件状态确定 - 幂等仅作用于 x86_64;ARM 分支保持原有行为(不清理、仅 prepend),不触及 ARM - 仅作用于 mirrorlist,不影响 pacman.conf 中的 archlinuxcn - 修正官方源地址:上游写的 repo.archlinux.org 域名不存在(DNS 无法解析,官方 mirrorlist 无此项),修正为 Arch 官方推荐的 geo.mirror.pkgbuild.com(自动按地理位置选最近镜像) - 按 doc/50 更新 recipe 时间戳(2026-09-06)、登记贡献者 @yayoinoyume(sauciers 2→3) --- src/chsrc-main.c | 1 + src/recipe/os/pacman/Arch-Linux.c | 24 ++++++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 2d15f61d..15a25ed3 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -91,6 +91,7 @@ chsrc_register_chefs_and_sauciers () chef_register_contributor ("@NewbieXvwu", "Mingzhe Jiang", "newbiexvwu@gmail.com", NULL); chef_register_contributor ("@daocoder", "daocoder", "daocoder@foxmail.com", NULL); chef_register_contributor ("@JIAFALSEDREAM", "假发", "jiafa@hello-happy.world", NULL); + chef_register_contributor ("@yayoinoyume", "YAYOI27", "yayoi27@yayoi.uk", NULL); /** * AI贡献者: diff --git a/src/recipe/os/pacman/Arch-Linux.c b/src/recipe/os/pacman/Arch-Linux.c index ec08e2c3..e81713f2 100644 --- a/src/recipe/os/pacman/Arch-Linux.c +++ b/src/recipe/os/pacman/Arch-Linux.c @@ -7,16 +7,19 @@ def_dish(os_arch, "arch/archlinux"); #define OS_Pacman_MirrorList "/etc/pacman.d/mirrorlist" #define OS_Pacman_ArchLinuxCN_MirrorList "/etc/pacman.conf" +/* Arch 官方源(geo 自动选最近镜像),换源后作兜底 */ +#define OS_Arch_Upstream "https://geo.mirror.pkgbuild.com" + void os_arch_prepare () { - chef_prep_this_dish (os_arch, gs); + chef_prep_this_dish (os_arch, gsr); chef_set_recipe_created_on (this, "2023-09-05"); - chef_set_recipe_last_updated (this, "2025-10-30"); + chef_set_recipe_last_updated (this, "2026-09-06"); chef_set_chefs (this, 2, "@ccmywish", "@G_I_Y"); - chef_set_sauciers (this, 2, "@happy-game", "@Young-Lord"); + chef_set_sauciers (this, 3, "@happy-game", "@Young-Lord", "@yayoinoyume"); chef_set_os_scope (this); chef_deny_english(this); @@ -30,7 +33,7 @@ os_arch_prepare () * @note 不要给后面加 / ,因为ARM情况下,还要额外加一个 arm 后缀 */ def_sources_begin() - {&UpstreamProvider, "https://repo.archlinux.org", DelegateToUpstream}, + {&UpstreamProvider, "https://geo.mirror.pkgbuild.com", DelegateToUpstream}, {&Ali, "https://mirrors.aliyun.com/archlinux", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/archlinux", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/archlinux", DelegateToMirror}, @@ -77,6 +80,12 @@ os_arch_setsrc (char *option) { is_x86 = true; to_write = xy_strcat (3, "Server = ", source.url, "/$repo/os/$arch\n"); + /* 新源后补官方兜底(目标即官方时不重复) */ + if (!xy_streql (source.url, OS_Arch_Upstream)) + to_write = xy_strcat (2, to_write, "Server = " OS_Arch_Upstream "/$repo/os/$arch\n"); + + /* 换源前先清掉已累积的 Server 行再写入,保证幂等(仅 x86) */ + chsrc_run ("sed -i '/^Server = /d' " OS_Pacman_MirrorList, RunOpt_Default); } else { @@ -101,6 +110,13 @@ os_arch_setsrc (char *option) } +/* reset = 恢复官方源,走同一 setsrc(框架会令 source 落到官方源) */ +void +os_arch_resetsrc (char *option) +{ + os_arch_setsrc (option); +} + /** ------------------------------------------------------------ * archlinuxcn dish