Repository navigation
feat(recipe): 支持 omarchyopr 换源 - #388
Conversation
|
Hi @yayoinoyume ❤️ 感谢你的贡献!我们将在最少半小时,最多5天内阅读此 PR 并回复你 |
|
无论如何,感谢您百忙之中抽空查看我的PR,非常感谢您! |
bc979ba to
d45cefb
Compare
|
已按意见完成修改,并修复一处幂等缺陷 感谢 @ccmywish 的耐心评审!我已根据 issue #387 的意见重写了本 PR。 1. 移除
|
| 命令 | 结果 |
|---|---|
chsrc set omarchy tuna |
chsrc: 暂不支持的换源菜品。使用 chsrc list dishes 查看所有支持的菜品(EXIT=2) |
chsrc get omarchy |
同上(EXIT=2) |
chsrc ls omarchy |
同上(EXIT=2) |
→ omarchy dish 已正确移除,走标准 not_found 提示,与任意未注册菜品行为一致。
B 组:omarchyopr 只读指令
| 命令 | 结果 |
|---|---|
chsrc ls |
菜品列表含 omarchyopr;全文检索无 omarchy(EXIT=0) |
chsrc ls omarchyopr |
展示 upstream 官方源 + 完整备注 + Get/Reset/UserDefine 功能(EXIT=0) |
chsrc get omarchyopr |
输出 [omarchy] 段 Server = https://pkgs.omarchy.org/stable/$arch(EXIT=0) |
chsrc list dishes |
已注册 omarchyopr,无 omarchy(EXIT=0) |
C 组:写操作
| 命令 | 结果 |
|---|---|
chsrc set omarchyopr <自定义URL> |
用户自定义 URL 可正常换源(EXIT=0) |
chsrc set omarchyopr https://pkgs.omarchy.org/edge/$arch |
sed 正常写入 edge,pacman -Syy 通过 |
chsrc set omarchyopr https://pkgs.omarchy.org/stable/(前缀URL) |
正确执行 sed 写入 |
chsrc set omarchyopr <与当前相同URL> |
幂等跳过,pacman.conf 保持不变 |
chsrc reset omarchyopr |
恢复官方 stable;edge→stable 警告正常触发;提示"已重置为上游默认源" |
重复 chsrc reset omarchyopr |
幂等正常,状态不变 |
附加核验
| 项 | 结果 |
|---|---|
pacman -Syy |
成功同步 core / extra / multilib / omarchy 四个仓库 |
| OPR 仓库包数 | 217 个包可查 |
| 架构检查 | 仅 x86_64,非 x86_64 报错退出 |
| edge 通道警告 | 检测到 edge 时换源前弹出警告 |
d45cefb to
5f0a159
Compare
|
|
||
| /* 上游默认源基于 stable 通道,edge 通道用户换源后将切换到 stable */ | ||
| bool is_edge = xy_run_get_status ("grep -q '^Server = https://pkgs.omarchy.org/edge/' " OS_Pacman_Omarchy_Conf) == 0; | ||
| if (is_edge && !xy_streql (source.mirror->code, "user")) |
There was a problem hiding this comment.
这里可直接用 source_is_userdefine()
There was a problem hiding this comment.
感谢你的仔细 review!
已修改 os_omarchy_setsrc():
// 原:if (is_edge && !xy_streql (source.mirror->code, "user"))
// 改:if (is_edge && !source_is_userdefine (&source))测试验证结果:用户自定义 URL 场景下 source_is_userdefine 能正确识别,不会误触发 edge→stable 警告;reset(非自定义)场景下 edge 警告正常。
| char *exists_cmd = xy_strcat (3, "grep -qxF 'Server = ", source.url, "' " OS_Pacman_Omarchy_Conf); | ||
| if (xy_run_get_status (exists_cmd) == 0) | ||
| { | ||
| chsrc_debug ("recipe", "所选 Server 行已存在,跳过 pacman.conf 修改"); |
There was a problem hiding this comment.
已在 os_omarchy_setsrc() 末尾(chsrc_conclude 之后)增加 chsrc_note2():
本菜品仅更换 OPR 源;Arch Linux 主仓库请另行 chsrc set arch。
测试验证结果:chsrc set omarchy <自定义URL> 与 chsrc reset omarchy 执行后会输出该提示。chsrc set omarchy (无参数) 执行时不会输出,因为目前只有单源,在 framework 的 chsrc_yield_source() 阶段就提前报错退出了。
There was a problem hiding this comment.
已在 src/recipe/menu.c 文件头的 Contributors 中追加 @yayoinoyume。
| * `chsrc set arch` 来更换;本 dish 只负责 [omarchy] 段 (OPR)。 | ||
| * ------------------------------------------------------------*/ | ||
|
|
||
| def_dish(os_omarchyopr, "omarchyopr"); |
There was a problem hiding this comment.
我建议直接叫 omarchy 吧,不用把后面的 opr 带上。你的看法呢?
There was a problem hiding this comment.
考虑到本 dish 会在提示中引导用户另外执行 chsrc set arch 更换 Arch 主源,改名 omarchy 确实更合理,感谢您的建议。
测试验证结果:chsrc ls 显示 omarchy,旧名 omarchyopr 已走标准"暂不支持"提示。
如果还有不到位之处,我会继续改进。
5f0a159 to
1a04e83
Compare
- omarchy dish: 更换 pacman.conf 的 [omarchy] 段 (OPR) 源,仅提供官方上游 stable 源 - 提供 chsrc reset omarchy 恢复官方 OPR 源 - edge 通道用户换源前警告将切换到 stable - 用 source_is_userdefine() 判断用户自定义源 - setsrc 末尾用 chsrc_note2() 提示可另换 Arch 主源 - Omarchy 官方仅发布 x86_64,其他架构报错退出 - Arch 主仓库源与 arch 完全一致,提示用户额外使用 chsrc set arch
1a04e83 to
89ff5b2
Compare
os_arch源列表,写入mirrorlist并保留官方 stable 兜底。pacman.conf的[omarchy]段源,支持 omarchycn 镜像(自动导入并本地签名其 registry key)。问题描述
背景:Omarchy 是基于 Arch Linux 的发行版(DHH 出品),近一年增长较快,国内用户换源目前只能手动编辑配置文件。其软件源由两部分组成:
/etc/pacman.d/mirrorlist配置,为 core/extra/multilib 提供标准 archlinux 仓库;/etc/pacman.conf的[omarchy]段(分 stable/edge 通道)。本 PR 为 chsrc 新增两个 dish:
omarchy(换 Arch 镜像源)与omarchyopr(换 OPR 仓库源),并已在 x86_64 Omarchy 上完成测试验证。关联 对
Omarchy(基于 Arch Linux 的发行版)的支持 #387方案与实现
新增
src/recipe/os/pacman/Omarchy.c,登记于menu.c,贡献者信息登记于chsrc-main.c。omarchy dish(换 Arch 镜像源)
os_arch的源列表(chef_use_other_dish_sources()),不单独维护一份镜像清单;mirrorlist中已累积的生效 Server 行再写入,避免重复执行时可能产生的重复条目;omarchy-refresh-pacman会用默认模板覆盖配置,被还原后需重新执行。chsrc set arch的关系说明:这部分的源列表是相同的,感谢维护 arch 换源方式的前辈们;omarchyopr dish(换 OPR 仓库源)
https://pkgs.omarchy.org/stable/$arch。https://git.zacharyzhang.com/api/packages/ZacharyZhang-NY/arch/omarchy/x86_64,每 6 小时同步上游 stable 通道,db/包由其 registry key 重新签名,具体可以查看 pacman-repo.md ,已作为@consult写入代码。omarchy.db(.sig),这是因为官方源无 db.sig,镜像有,残留旧 sig 会导致-Syy验签失败。https://pkgs.omarchy.org/edge/$arch)执行换源会被静默切换到 stable(上游与可用镜像均基于 stable),已在换源前检测并警告(参照 Debian recipe 中 CDROM 源检测的处理范式),警告后继续执行。实测验证(x86_64 Omarchy)
set omarchy <镜像>真实执行set omarchyopr omarchycn真实执行pacman -Si omarchy从镜像正常获取