From fd0907bf4b01e0f5a757b2ed3a0dd07dac18fae5 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Sun, 10 Aug 2025 09:18:19 +0800 Subject: [PATCH] Update ware recipes using framework v2 --- src/framework/struct.h | 2 - src/recipe/ware/Anaconda/Anaconda.c | 88 ++++++++++++------------ src/recipe/ware/CocoaPods.c | 70 ++++++++++--------- src/recipe/ware/Docker-Hub/Docker-Hub.c | 78 +++++++++------------ src/recipe/ware/Emacs.c | 79 ++++++++++----------- src/recipe/ware/Flathub.c | 5 -- src/recipe/ware/Guix.c | 66 +++++++++--------- src/recipe/ware/Homebrew/Homebrew.c | 82 +++++++++------------- src/recipe/ware/Nix.c | 77 ++++++++++----------- src/recipe/ware/TeX-Live.c | 91 ++++++++++++------------- src/recipe/ware/WinGet.c | 5 +- 11 files changed, 306 insertions(+), 337 deletions(-) diff --git a/src/framework/struct.h b/src/framework/struct.h index 2d55721..23e8947 100644 --- a/src/framework/struct.h +++ b/src/framework/struct.h @@ -142,8 +142,6 @@ typedef struct Target_t void (*setfn) (char *option); void (*resetfn) (char *option); - Feature_t (*featfn) (char *option); - Source_t sources; size_t sources_n; diff --git a/src/recipe/ware/Anaconda/Anaconda.c b/src/recipe/ware/Anaconda/Anaconda.c index 48bbc17..50c687c 100644 --- a/src/recipe/ware/Anaconda/Anaconda.c +++ b/src/recipe/ware/Anaconda/Anaconda.c @@ -1,35 +1,51 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Yangmoooo - * | yongxiang <1926885268@qq.com> - * | - * Created On : <2023-09-10> - * Last Modified : <2025-07-14> * ------------------------------------------------------------*/ - #include "rawstr4c.h" +#include "rawstr4c.h" -/** - * @update 2025-07-14 - * @note 这些链接将会在setsrc函数中补充完整 - */ -static Source_t wr_anaconda_sources[] = +def_target(wr_anaconda); + +void +wr_anaconda_prelude () { - {&UpstreamProvider, "https://repo.anaconda.com", NULL}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn", NULL}, - {&Bjtu, "https://mirror.bjtu.edu.cn", NULL}, - {&Nju, "https://mirror.nju.edu.cn", NULL}, - {&Bfsu, "https://mirrors.bfsu.edu.cn", NULL}, - {&Zju, "https://mirrors.zju.edu.cn", NULL}, - {&Pku, "https://mirrors.pku.edu.cn", NULL}, - {&NJTech, "https://mirrors.njtech.edu.cn", NULL}, - {&Ustc, "https://mirrors.ustc.edu.cn", NULL}, - {&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn", NULL}, - {&Lzuoss, "https://mirror.lzu.edu.cn", NULL} -}; -def_sources_n(wr_anaconda); + use_this(wr_anaconda); + + chef_set_created_on (this, "2023-09-10"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-14"); + + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 2, + "Yangmoooo", "yangmoooo@outlook.com", + "yongxiang", "1926885268@qq.com"); + + chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = false; + this.note = "无法自定义源, 因为这些链接将会在setsrc函数中补充完整"; + + def_upstream("https://repo.anaconda.com"); + def_sources_begin() + {&upstream, "https://repo.anaconda.com", DelegateToUpstream}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn", DelegateToMirror}, + {&Bjtu, "https://mirror.bjtu.edu.cn", DelegateToMirror}, + {&Nju, "https://mirror.nju.edu.cn", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn", DelegateToMirror}, + {&Zju, "https://mirrors.zju.edu.cn", DelegateToMirror}, + {&Pku, "https://mirrors.pku.edu.cn", DelegateToMirror}, + {&NJTech, "https://mirrors.njtech.edu.cn", DelegateToMirror}, + {&Ustc, "https://mirrors.ustc.edu.cn", DelegateToMirror}, + {&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn", DelegateToMirror}, + {&Lzuoss, "https://mirror.lzu.edu.cn", DelegateToMirror} + def_sources_end() +} void @@ -45,7 +61,8 @@ wr_anaconda_getsrc (char *option) void wr_anaconda_setsrc (char *option) { - chsrc_yield_source_and_confirm (wr_anaconda); + use_this(wr_anaconda); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *w = xy_str_gsub (RAWSTR_wr_anaconda_condarc, "@1@", source.url); @@ -77,20 +94,3 @@ wr_anaconda_setsrc (char *option) chsrc_determine_chgtype (ChgType_SemiAuto); chsrc_conclude (&source); } - - -Feature_t -wr_anaconda_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = true; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = false; - - return f; -} - -def_target_gsf (wr_anaconda); diff --git a/src/recipe/ware/CocoaPods.c b/src/recipe/ware/CocoaPods.c index e57a7f3..e4c6370 100644 --- a/src/recipe/ware/CocoaPods.c +++ b/src/recipe/ware/CocoaPods.c @@ -1,24 +1,42 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Nil Null - * Created On : <2024-06-08> - * Last Modified : <2025-07-13> * ------------------------------------------------------------*/ -/** - * @update 2025-07-13 - */ -static Source_t wr_cocoapods_sources[] = +def_target(wr_cocoapods); + +void +wr_cocoapods_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git", NULL}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/git/CocoaPods/Specs.git", NULL}, - {&Nju, "https://mirror.nju.edu.cn/git/CocoaPods/Specs.git", NULL}, - {&Nyist, "https://mirror.nyist.edu.cn/git/CocoaPods/Specs.git", NULL} -}; -def_sources_n(wr_cocoapods); + use_this(wr_cocoapods); + + chef_set_created_on (this, "2024-06-08"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-13"); + + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + // chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = true; + this.note = NULL; + + def_upstream("https://github.com/CocoaPods/Specs.git"); + def_sources_begin() + {&upstream, "https://github.com/CocoaPods/Specs.git", DelegateToUpstream}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/git/CocoaPods/Specs.git", DelegateToMirror}, + {&Nju, "https://mirror.nju.edu.cn/git/CocoaPods/Specs.git", DelegateToMirror}, + {&Nyist, "https://mirror.nyist.edu.cn/git/CocoaPods/Specs.git", DelegateToMirror} + def_sources_end() +} /** @@ -27,7 +45,8 @@ def_sources_n(wr_cocoapods); void wr_cocoapods_setsrc (char *option) { - chsrc_yield_source_and_confirm (wr_cocoapods); + use_this(wr_cocoapods); + Source_t source = chsrc_yield_source_and_confirm (this, option); chsrc_note2 ("请手动执行以下命令:"); p("cd ~/.cocoapods/repos"); @@ -43,20 +62,3 @@ wr_cocoapods_setsrc (char *option) chsrc_determine_chgtype (ChgType_Manual); chsrc_conclude (&source); } - - -Feature_t -wr_cocoapods_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = false; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = true; - - return f; -} - -def_target_sf (wr_cocoapods); diff --git a/src/recipe/ware/Docker-Hub/Docker-Hub.c b/src/recipe/ware/Docker-Hub/Docker-Hub.c index 9011683..f57181f 100644 --- a/src/recipe/ware/Docker-Hub/Docker-Hub.c +++ b/src/recipe/ware/Docker-Hub/Docker-Hub.c @@ -1,13 +1,5 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : happy game - * | Aoran Zeng - * Contributors : Nil Null - * | - * Created On : <2024-06-08> - * Major Revision : 2 - * Last Modified : <2025-07-14> * ------------------------------------------------------------*/ #include "rawstr4c.h" @@ -27,22 +19,41 @@ Fit2Cloud = {SKIP, ToFill, ToFill, NULL, ROUGH} }; -/** - * @update 2025-07-14 - * - * @consult https://gist.github.com/y0ngb1n/7e8f16af3242c7815e7ca2f0833d3ea6 - */ -static Source_t wr_dockerhub_sources[] = +def_target(wr_dockerhub); + +void +wr_dockerhub_prelude () { - {&UpstreamProvider, NULL, NULL}, - // {&Ustc, "https://docker.mirrors.ustc.edu.cn/", NULL}, + use_this(wr_dockerhub); - // https://github.com/DaoCloud/public-image-mirror - {&DaoCloud, "https://docker.m.daocloud.io", NULL}, - {&Fit2Cloud, "https://docker.1panel.live", NULL} -}; + chef_set_created_on (this, "2024-06-08"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-14"); -def_sources_n(wr_dockerhub); + chef_set_authors (this, 2, + "happy game", "happygame1024@gmail.com", + "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = true; + this.note = NULL; + + def_upstream("https://hub.docker.com/"); + def_sources_begin() + {&upstream, "https://hub.docker.com/", DelegateToUpstream}, + {&DaoCloud, "https://docker.m.daocloud.io", DelegateToMirror}, + {&Fit2Cloud, "https://docker.1panel.live", DelegateToMirror} + def_sources_end() +} #define WR_DockerHub_ConfigFile "/etc/docker/daemon.json" @@ -69,7 +80,8 @@ void wr_dockerhub_setsrc (char *option) { chsrc_ensure_root (); - chsrc_yield_source_and_confirm (wr_dockerhub); + use_this(wr_dockerhub); + Source_t source = chsrc_yield_source_and_confirm (this, option); if (xy_on_linux || xy_on_bsd) { @@ -138,25 +150,3 @@ wr_dockerhub_setsrc (char *option) chsrc_determine_chgtype (ChgType_SemiAuto); chsrc_conclude (&source); } - - -Feature_t -wr_dockerhub_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = true; - f.can_reset = false; - - f.cap_locally = CanNot; - f.cap_locally_explain = NULL; - f.can_english = false; - - f.can_user_define = true; - - f.note = NULL; - return f; -} - - -def_target_gsf(wr_dockerhub); diff --git a/src/recipe/ware/Emacs.c b/src/recipe/ware/Emacs.c index 8f59ab9..15722d6 100644 --- a/src/recipe/ware/Emacs.c +++ b/src/recipe/ware/Emacs.c @@ -1,10 +1,5 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Nil Null - * Created On : <2023-10-10> - * Last Modified : <2025-07-13> * ------------------------------------------------------------*/ static MirrorSite_t EmacsChina = @@ -14,49 +9,55 @@ static MirrorSite_t EmacsChina = {SKIP, ToFill, ToFill, NULL, ROUGH} }; -/** - * @update 2025-07-13 - * @note Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档 - */ -Source_t wr_emacs_sources[] = +def_target(wr_emacs); + +void +wr_emacs_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&MirrorZ, "https://help.mirrors.cernet.edu.cn/elpa/", NULL}, - {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/docs/emacs-elpa", NULL}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/elpa/", NULL}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/help/elpa/", NULL}, - {&Ustc, "https://mirrors.ustc.edu.cn/help/elpa.html", NULL}, - {&Zju, "https://mirrors.zju.edu.cn/docs/elpa/", NULL}, - {&EmacsChina, "https://elpamirror.emacs-china.org/", NULL} -}; -def_sources_n(wr_emacs); + use_this(wr_emacs); + + chef_set_created_on (this, "2023-10-10"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-13"); + + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + // chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = false; + this.note = "Emacs用户往往只需要一次性换源,只会极少次调用 chsrc,我们只给用户提供文档"; + + def_upstream("https://elpa.gnu.org/"); + def_sources_begin() + {&upstream, "https://elpa.gnu.org/", DelegateToUpstream}, + {&MirrorZ, "https://help.mirrors.cernet.edu.cn/elpa/", DelegateToMirror}, + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/docs/emacs-elpa", DelegateToMirror}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/help/elpa/", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/help/elpa/", DelegateToMirror}, + {&Ustc, "https://mirrors.ustc.edu.cn/help/elpa.html", DelegateToMirror}, + {&Zju, "https://mirrors.zju.edu.cn/docs/elpa/", DelegateToMirror}, + {&EmacsChina, "https://elpamirror.emacs-china.org/", DelegateToMirror} + def_sources_end() +} void wr_emacs_setsrc (char *option) { - chsrc_yield_source_and_confirm (wr_emacs); + use_this(wr_emacs); + Source_t source = chsrc_yield_source_and_confirm (this, option); - chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:"); + chsrc_note2 ("Emacs换源涉及Elisp, 需要手动查阅并换源:"); p (source.url); chsrc_determine_chgtype (ChgType_Manual); chsrc_conclude (&source); } - - -Feature_t -wr_emacs_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = false; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = false; - - return f; -} - -def_target_sf(wr_emacs); diff --git a/src/recipe/ware/Flathub.c b/src/recipe/ware/Flathub.c index e728557..6644e02 100644 --- a/src/recipe/ware/Flathub.c +++ b/src/recipe/ware/Flathub.c @@ -19,7 +19,6 @@ wr_flathub_prelude () chef_set_contributors (this, 1, "Jialin Lyu", "jialinlvcn@aliyun.com"); - chef_has_getfn(); chef_has_setfn(); chef_has_resetsrc(); @@ -29,11 +28,7 @@ wr_flathub_prelude () this.can_user_define = true; this.note = "对Flathub目标进行测速的文件非常小,测速效果严重失真,若你知道可供测速的URL,欢迎参与贡献: chsrc issue"; - - - def_upstream("https://flathub.org/repo"); - def_sources_begin() {&upstream, "https://flathub.org/repo", DelegateToUpstream}, {&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/flathub", DelegateToMirror}, diff --git a/src/recipe/ware/Guix.c b/src/recipe/ware/Guix.c index b06773c..edf92b1 100644 --- a/src/recipe/ware/Guix.c +++ b/src/recipe/ware/Guix.c @@ -1,23 +1,39 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Nil Null - * Created On : <2023-09-11> - * Last Modified : <2025-07-13> * ------------------------------------------------------------*/ -/** - * @update 2025-07-13 - * - * @note 目前只有一个源, guixcn 的源不知道是否可用 - */ -static Source_t wr_guix_sources[] = +def_target(wr_guix); + +void +wr_guix_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/git/guix.git", DelegateToMirror} -}; -def_sources_n(wr_guix); + use_this(wr_guix); + + chef_set_created_on (this, "2023-09-11"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-13"); + + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + // chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = false; + this.note = "目前只有一个源, guixcn 的源不知道是否可用"; + + def_upstream("https://git.savannah.gnu.org/git/guix.git"); + def_sources_begin() + {&upstream, "https://git.savannah.gnu.org/git/guix.git", DelegateToUpstream}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/git/guix.git", DelegateToMirror} + def_sources_end() +} /** @@ -26,7 +42,8 @@ def_sources_n(wr_guix); void wr_guix_setsrc (char *option) { - chsrc_yield_source_and_confirm (wr_guix); + use_this(wr_guix); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *file = xy_strjoin (3, "(list (channel\n" " (inherit (car %default-channels))\n" @@ -38,20 +55,3 @@ wr_guix_setsrc (char *option) chsrc_determine_chgtype (ChgType_Manual); chsrc_conclude (&source); } - - -Feature_t -wr_guix_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = false; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = false; - - return f; -} - -def_target_sf(wr_guix); diff --git a/src/recipe/ware/Homebrew/Homebrew.c b/src/recipe/ware/Homebrew/Homebrew.c index 0b7dfc2..9023a9c 100644 --- a/src/recipe/ware/Homebrew/Homebrew.c +++ b/src/recipe/ware/Homebrew/Homebrew.c @@ -1,36 +1,44 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Word2VecT - * Created On : <2023-09-10> - * Major Revision : 3 - * Last Modified : <2025-07-14> * ------------------------------------------------------------*/ #include "rawstr4c.h" -/** - * @update 2025-07-13 - * - * @note 这些链接将会在setsrc函数中补充完整 - */ -static Source_t wr_homebrew_sources[] = +def_target(wr_homebrew); + +void +wr_homebrew_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/", DelegateToMirror}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/", DelegateToMirror}, - {&Nju, "https://mirror.nju.edu.cn/", DelegateToMirror}, - {&Nyist, "https://mirror.nyist.edu.cn/", DelegateToMirror}, + use_this(wr_homebrew); - /* 注释原因: 这两者和其他镜像站URL补全结果不一样(2025-07-13) */ - // {&Zju, "https://mirrors.zju.edu.cn/", DelegateToMirror}, - // {&Cqu, "https://mirrors.cqu.edu.cn/", DelegateToMirror}, + chef_set_created_on (this, "2023-09-10"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-13"); - /* 注释原因: 该源已不存在(2025-07-13) */ - // {&Sustech, "https://mirrors.sustech.edu.cn/", DelegateToMirror} -}; -def_sources_n(wr_homebrew); + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Word2VecT", "tangzinan@bupt.edu.cn"); + + chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = true; + this.can_user_define = false; + this.note = "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件"; + + def_upstream("https://github.com/Homebrew/brew.git"); + def_sources_begin() + {&upstream, "https://github.com/Homebrew/brew.git", DelegateToUpstream}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/", DelegateToMirror}, + {&Nju, "https://mirror.nju.edu.cn/", DelegateToMirror}, + {&Nyist, "https://mirror.nyist.edu.cn/", DelegateToMirror} + def_sources_end() +} void @@ -50,7 +58,8 @@ wr_homebrew_getsrc (char *option) void wr_homebrew_setsrc (char *option) { - chsrc_yield_source_and_confirm (wr_homebrew); + use_this(wr_homebrew); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *w = xy_str_gsub (RAWSTR_wr_homebrew_config_in_bash, "@1@", source.url); @@ -77,26 +86,3 @@ wr_homebrew_setsrc (char *option) chsrc_conclude (&source); chsrc_alert2 ("请重启终端使Homebrew环境变量生效"); } - - -Feature_t -wr_homebrew_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = true; - f.can_reset = false; - - f.cap_locally = CanNot; - f.cap_locally_explain = NULL; - f.can_english = true; - - /* 该换源方案中,URL存在拼凑,因此不能让用户手动使用某URL来换源 */ - f.can_user_define = false; - - f.note = "该换源通过写入环境变量实现,若多次换源,请手动清理profile文件"; - return f; -} - - -def_target_gsf(wr_homebrew); diff --git a/src/recipe/ware/Nix.c b/src/recipe/ware/Nix.c index 9d113cf..9c6527d 100644 --- a/src/recipe/ware/Nix.c +++ b/src/recipe/ware/Nix.c @@ -1,29 +1,45 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later - * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Nil Null - * Created On : <2023-09-26> - * Last Modified : <2025-07-13> * ------------------------------------------------------------*/ -/** - * @update 2025-07-13 - * - * @note 链接将会在setsrc函数中补充完整 - */ -static Source_t wr_nix_sources[] = +def_target(wr_nix); + +void +wr_nix_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&MirrorZ, "https://mirrors.cernet.edu.cn/nix-channels/", NULL}, - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/", NULL}, - {&Nju, "https://mirror.nju.edu.cn/nix-channels/", NULL}, - {&Ustc, "https://mirrors.ustc.edu.cn/nix-channels/", NULL}, - {&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/nix-channels/", NULL}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/nix-channels/", NULL}, - {&Iscas, "https://mirror.iscas.ac.cn/nix-channels/", NULL} -}; -def_sources_n(wr_nix); + use_this(wr_nix); + + chef_set_created_on (this, "2023-09-26"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-13"); + + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Nil Null", "nil@null.org"); + + // chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = false; + this.note = "不可自动换源,因为链接将会在setsrc函数中补充完整"; + + def_upstream("https://channels.nixos.org/"); + def_sources_begin() + {&upstream, "https://channels.nixos.org/", DelegateToUpstream}, + {&MirrorZ, "https://mirrors.cernet.edu.cn/nix-channels/", DelegateToMirror}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nix-channels/", DelegateToMirror}, + {&Nju, "https://mirror.nju.edu.cn/nix-channels/", DelegateToMirror}, + {&Ustc, "https://mirrors.ustc.edu.cn/nix-channels/", DelegateToMirror}, + {&Sjtug_Siyuan, "https://mirror.sjtu.edu.cn/nix-channels/", DelegateToMirror}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/nix-channels/", DelegateToMirror}, + {&Iscas, "https://mirror.iscas.ac.cn/nix-channels/", DelegateToMirror} + def_sources_end() +} void @@ -42,7 +58,8 @@ wr_nix_setsrc (char *option) { wr_nix_check_cmd (); - chsrc_yield_source_and_confirm (wr_nix); + use_this(wr_nix); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-unstable nixpkgs"); chsrc_run (cmd, RunOpt_Default); @@ -63,19 +80,3 @@ wr_nix_setsrc (char *option) chsrc_determine_chgtype (ChgType_SemiAuto); chsrc_conclude (&source); } - -Feature_t -wr_nix_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = false; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = false; - - return f; -} - -def_target_sf (wr_nix); diff --git a/src/recipe/ware/TeX-Live.c b/src/recipe/ware/TeX-Live.c index 1c2d2f0..0bac57b 100644 --- a/src/recipe/ware/TeX-Live.c +++ b/src/recipe/ware/TeX-Live.c @@ -1,44 +1,55 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- - * File Authors : Aoran Zeng - * Contributors : Mikachu2333 - * Created On : <2023-09-10> - * Last Modified : <2025-07-28> - * * MiKTeX 和 TeX Live 都是流行的 LaTeX 发行版,但它们是不同的实现 * ------------------------------------------------------------*/ -/** - * @update 2025-07-28 - */ -static Source_t wr_tex_sources[] = +def_target(wr_tex); + +void +wr_tex_prelude () { - {&UpstreamProvider, NULL, NULL}, - {&MirrorZ, "https://mirrors.cernet.edu.cn/CTAN/systems/texlive/tlnet", NULL}, + use_this(wr_tex); - {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet", - "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + chef_set_created_on (this, "2023-09-10"); + chef_set_last_updated (this, "2025-08-09"); + chef_set_sources_last_updated (this, "2025-07-28"); - {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet", - "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); + chef_set_chef (this, NULL, NULL); + chef_set_sous_chefs (this, 0); + chef_set_contributors (this, 1, + "Mikachu2333", "mikachu.23333@zohomail.com"); - {&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet", - "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + chef_has_getfn(); + chef_has_setfn(); + // chef_has_resetsrc(); + this.cap_locally = CanNot; + this.cap_locally_explain = NULL; + this.can_english = false; + this.can_user_define = true; + this.note = NULL; - {&Bjtu, "https://mirror.bjtu.edu.cn/ctan/systems/texlive/tlnet", - "https://mirror.bjtu.edu.cn/ctan/systems/texlive/tlnet/archive/fandol.tar.xz"}, - - {&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet", - "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, - - {&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet", - "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, - - {&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet", - "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"} -}; -def_sources_n(wr_tex); + def_upstream("https://ctan.org/tex-archive/systems/texlive/tlnet"); + def_sources_begin() + {&upstream, "https://ctan.org/tex-archive/systems/texlive/tlnet", DelegateToUpstream}, + {&MirrorZ, "https://mirrors.cernet.edu.cn/CTAN/systems/texlive/tlnet", DelegateToMirror}, + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet", + "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet", + "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet", + "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Bjtu, "https://mirror.bjtu.edu.cn/ctan/systems/texlive/tlnet", + "https://mirror.bjtu.edu.cn/ctan/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet", + "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet", + "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"}, + {&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet", + "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet/archive/fandol.tar.xz"} + def_sources_end() +} void @@ -79,7 +90,8 @@ wr_tex_setsrc (char *option) bool tlmgr_exist, mpm_exist; wr_tex_check_cmd (&tlmgr_exist, &mpm_exist); - chsrc_yield_source_and_confirm (wr_tex); + use_this(wr_tex); + Source_t source = chsrc_yield_source_and_confirm (this, option); char *cmd = NULL; @@ -99,20 +111,3 @@ wr_tex_setsrc (char *option) chsrc_determine_chgtype (ChgType_Untested); chsrc_conclude (&source); } - - -Feature_t -wr_tex_feat (char *option) -{ - Feature_t f = {0}; - - f.can_get = true; - f.can_reset = false; - - f.can_english = false; - f.can_user_define = true; - - return f; -} - -def_target_gsf(wr_tex); diff --git a/src/recipe/ware/WinGet.c b/src/recipe/ware/WinGet.c index d815894..590cb56 100644 --- a/src/recipe/ware/WinGet.c +++ b/src/recipe/ware/WinGet.c @@ -18,12 +18,13 @@ wr_winget_prelude () chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); + chef_has_getfn(); + chef_has_setfn(); + chef_has_resetsrc(); this.can_english = false; this.can_user_define = true; - def_upstream("https://github.com/microsoft/winget-cli/"); - def_sources_begin() {&upstream, "https://cdn.winget.microsoft.com/cache", NULL}, {&MirrorZ, "https://mirrors.cernet.edu.cn/winget-source", NULL},