From 014c34ece14b12fb9094bc16189cd38606d22dea Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 30 Aug 2023 22:27:08 +0800 Subject: [PATCH] Add rust, java, nuget, php sources --- README.md | 10 ++++----- chsrc.c | 28 ++++++++++++++--------- chsrc.h | 67 ++++++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 81 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 66d1033..26e3c08 100644 --- a/README.md +++ b/README.md @@ -27,14 +27,14 @@ chsrc pip # 或 chsrc python chsrc npm # 或 chsrc nodejs chsrc cpan # 或 chsrc perl -chsrc cran # 或 chsrc r -chsrc julia - chsrc go chsrc cargo # 或 chsrc rust 或 chsrc crate -chsrc maven -chsrc gradle +chsrc maven # 或 chsrc java 或 chsrc gradle chsrc dotnet +chsrc composer # 或 chsrc php + +chsrc cran # 或 chsrc r +chsrc julia # 操作系统 chsrc ubuntu diff --git a/chsrc.c b/chsrc.c index d26338d..0ff549f 100644 --- a/chsrc.c +++ b/chsrc.c @@ -160,34 +160,40 @@ os_ubuntu_chsrc (char* option) } + #define chsrcfunc(func) (const char const*)func static const char const -*pl_ruby[] = {"gem", "ruby", "rb", NULL, chsrcfunc(pl_ruby_chsrc) }, -*pl_python[] = {"pip", "python", "py", "pypi", NULL, chsrcfunc(pl_python_chsrc)}, +*pl_ruby[] = {"gem", "ruby", "rb", NULL, chsrcfunc(pl_ruby_chsrc) }, +*pl_python[] = {"pip", "python", "py", "pypi", NULL, chsrcfunc(pl_python_chsrc)}, *pl_nodejs[] = {"npm", "node", "nodejs", "js", NULL}, *pl_perl[] = {"perl", "cpan", NULL}, -*pl_php[] = {"php", "composer", NULL}, -*pl_cran[] = {"r", "cran", NULL}, + *pl_rust[] = {"rust", "cargo", "crate", "crates", NULL}, *pl_go[] = {"go", "golang", "goproxy", NULL}, *pl_dotnet[] = {"nuget","net", "dotnet", ".net", NULL}, -*pl_maven[] = {"maven", NULL}, -*pl_gradle[] = {"gradel",NULL}, +*pl_java[] = {"maven", NULL}, +*pl_php[] = {"php", "composer", NULL}, + +*pl_cran[] = {"r", "cran", NULL}, *pl_julia[] = {"julia", NULL}, -*os_ubuntu[] = {"ubuntu", NULL, chsrcfunc(os_ubuntu_chsrc)}, -// Java暂时需要直接指定包管理器 -// pl_java **pl_packagers[] = { - pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php, pl_cran, - pl_rust, pl_go, pl_dotnet, pl_maven, pl_gradle, pl_julia + pl_ruby, pl_python, pl_nodejs, pl_perl, + pl_rust, pl_go, pl_dotnet, pl_java, pl_php, + pl_cran, pl_julia }, + + +*os_ubuntu[] = {"ubuntu", NULL, chsrcfunc(os_ubuntu_chsrc)}, + **os_packagers[] = { os_ubuntu }; #undef chsrcfunc + + static const char const* usage[] = { "chsrc: Change Source " Chsrc_Version " by RubyMetric\n", diff --git a/chsrc.h b/chsrc.h index 6eaa97e..b1c68c6 100644 --- a/chsrc.h +++ b/chsrc.h @@ -33,7 +33,8 @@ mirror_info Ustc = {"USTC", "中国科学技术大学开源镜像站"}, // 速度暂时处于10位以后,但是可用的源 - Nju = {"NJU", "南京大学开源镜像站"}; + Nju = {"NJU", "南京大学开源镜像站"}, + Cqu = {"CQU", "重庆大学开源软件镜像站"}; // 大型公司 @@ -49,8 +50,8 @@ mirror_info mirror_info RubyChina = {"RubyChina", "Ruby China 社区"}, GoProxyCN = {"Goproxy.cn", "七牛云 Goproxy.cn"}, - GoProxyIO = {"GOPROXY.IO", "GOPROXY.IO"}; - + GoProxyIO = {"GOPROXY.IO", "GOPROXY.IO"}, + NugetOrg = {"NuGet Org", "https://www.nuget.org/"}; typedef struct { @@ -126,7 +127,7 @@ pl_perl_sources[] = { {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/"}, {&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/"}, {&Bjtu, "https://mirror.bjtu.edu.cn/cpan/"}, - {&Lzuoss "https://mirror.lzu.edu.cn/CPAN/"} + {&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/"} }, @@ -144,7 +145,6 @@ pl_r_sources[] = { }, - /** * 2023-08-30 更新 * @@ -160,13 +160,11 @@ pl_julia_sources[] = { }, - - /** * 2023-08-30 更新 * * TODO: 1. 速度未经测试,请Go用户协助 - * 2. 缺少教育网或开源社区软件源 + * 2. 缺少教育网软件源 */ pl_go_sources[] = { {&Ali, "https://mirrors.aliyun.com/goproxy/"}, @@ -175,6 +173,59 @@ pl_go_sources[] = { }, +/** + * 2023-08-30 更新 + * + * TODO: 1. 速度未经测试,请Rust用户协助 + * 2. 缺少商业公司或开源社区软件源 + */ +pl_rust_sources[] = { + {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/"}, + {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/crates.io-index/"}, + {&Ustc, "https://mirrors.ustc.edu.cn/crates.io-index/"}, + {&Cqu, "https://mirrors.cqu.edu.cn/crates.io-index/"} +}, + + +/** + * 2023-08-30 更新 + * + * TODO: 1. 速度未经测试,请Java用户协助 + * 2. 缺少教育网或开源社区软件源 + * 3. 当前仅有一个源 + */ +pl_java_sources[] = { + {&Ali, "https://maven.aliyun.com/repository/public/"} +}, + + +/** + * 2023-08-30 更新 + * + * 暂时未实现该换源功能 + * + * TODO: 1. 速度未经测试,请Java用户协助 + * 2. 缺少教育网或开源社区软件源 + * 3. 当前仅有一个源 + */ +pl_nuget_sources[] = { + {&NugetOrg, "https://www.nuget.org/api/v2/"} +}, + + + +/** + * 2023-08-30 更新 + * + * TODO: 1. 速度未经测试,请PHP用户协助 + * 2. 缺少教育网或开源社区软件源 + * 3. 当前仅有一个源 + */ +pl_php_sources[] = { + {&Ali, "https://mirrors.aliyun.com/composer/"} +}; +