From c2273b8c4269850b58f4a2c67a942fea7a78ac94 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 2 Oct 2024 19:31:19 +0800 Subject: [PATCH] Add sources for `rustup` [GitHub #87] --- src/recipe/lang/Rust/rustup.c | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 src/recipe/lang/Rust/rustup.c diff --git a/src/recipe/lang/Rust/rustup.c b/src/recipe/lang/Rust/rustup.c new file mode 100644 index 0000000..a7c40bb --- /dev/null +++ b/src/recipe/lang/Rust/rustup.c @@ -0,0 +1,79 @@ +/** ------------------------------------------------------------ + * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * File Authors : Aoran Zeng + * Contributors : Nil Null + * Created On : <2024-10-02> + * Last Modified : <2024-10-02> + * ------------------------------------------------------------*/ + +/** + * @update 2024-10-02 + */ +static SourceInfo +pl_rust_rustup_sources[] = { + {&Upstream, NULL}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/rustup"}, + {&Ustc, "https://mirrors.ustc.edu.cn/rust-static"}, + {&Sjtug, "https://mirror.sjtu.edu.cn/rust-static"}, + {&Zju, "https://mirrors.zju.edu.cn/rustup"}, + {&Iscas, "https://mirror.iscas.ac.cn/rustup"} +}; +def_sources_n(pl_rust_rustup); + + +/** + * chsrc get rustup + */ +void +pl_rust_rustup_getsrc (char *option) +{ +} + + +/** + * @consult https://mirrors.tuna.tsinghua.edu.cn/help/rustup/ + * + * chsrc set rustup + */ +void +pl_rust_rustup_setsrc (char *option) +{ + chsrc_yield_source_and_confirm (pl_rust_rustup); + + chsrc_conclude (&source, setsrc_type); +} + + +/** + * chsrc reset rustup + */ +void +pl_rust_rustup_resetsrc (char *option) +{ + // pl_rust_rustup_setsrc (SetsrcType_Reset); +} + + +/** + * chsrc ls rustup + */ +FeatInfo +pl_rust_rustup_feat (char *option) +{ + FeatInfo fi = {0}; + + fi.can_get = true; + fi.can_reset = false; + + fi.stcan_locally = CanSemi; + fi.locally = "具体说明是否支持项目级换源..."; + fi.can_english = false; + fi.can_user_define = false; + + fi.note = "备注说明..."; + return fi; +} + + +def_target_gsrf(pl_rust_rustup);