Split perl out

This commit is contained in:
Aoran Zeng 2024-08-09 02:52:42 +08:00
parent f1557f6e01
commit 182bed75d6
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 98 additions and 90 deletions

View File

@ -34,50 +34,52 @@ typedef struct {
* https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
*/
MirrorSite
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
Tuna = {"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
"https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"},
Tuna = {"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
"https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"},
Sjtug_Zhiyuan = {"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
"https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan},
Sjtug_Zhiyuan = {"sjtu", "SJTUG-zhiyuan", "上海交通大学致远镜像站", "https://mirrors.sjtug.sjtu.edu.cn/",
"https://mirrors.sjtug.sjtu.edu.cn/ctan" Big_File_ctan},
Zju = {"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
"https://mirrors.zju.edu.cn/debian" Big_File_debian},
Zju = {"zju", "ZJU", "浙江大学开源软件镜像站", "https://mirrors.zju.edu.cn/",
"https://mirrors.zju.edu.cn/debian" Big_File_debian},
Lzuoss = {"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
"https://mirror.lzu.edu.cn/CTAN" Big_File_ctan},
Lzuoss = {"lzu", "LZUOSS", "兰州大学开源社区镜像站", "https://mirror.lzu.edu.cn/",
"https://mirror.lzu.edu.cn/CTAN" Big_File_ctan},
Jlu = {"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
"https://mirrors.jlu.edu.cn/_static/speedtest.bin"},
Jlu = {"jlu", "JLU", "吉林大学开源镜像站", "https://mirrors.jlu.edu.cn/",
"https://mirrors.jlu.edu.cn/_static/speedtest.bin"},
Bfsu = {"bfsu", "BFSU", "北京外国语大学开源软件镜像站","https://mirrors.bfsu.edu.cn/",
"https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"},
Bfsu = {"bfsu", "BFSU", "北京外国语大学开源软件镜像站","https://mirrors.bfsu.edu.cn/",
"https://mirrors.bfsu.edu.cn/speedtest/1000mb.bin"},
Pku = {"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
"https://mirrors.pku.edu.cn/debian" Big_File_debian},
Pku = {"pku", "PKU", "北京大学开源镜像站", "https://mirrors.pku.edu.cn/",
"https://mirrors.pku.edu.cn/debian" Big_File_debian},
Bjtu = {"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
"https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux},
Bjtu = {"bjtu", "BJTU", "北京交通大学自由与开源软件镜像站", "https://mirror.bjtu.edu.cn/",
"https://mirror.bjtu.edu.cn/archlinux" Big_File_archlinux},
Sustech = {"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
"https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"},
Sustech = {"sustech", "SUSTech", "南方科技大学开源软件镜像站", "https://mirrors.sustech.edu.cn/",
"https://mirrors.sustech.edu.cn/site/speedtest/1000mb.bin"},
Ustc = {"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
"https://mirrors.ustc.edu.cn/CTAN" Big_File_ctan},
Ustc = {"ustc", "USTC", "中国科学技术大学开源镜像站", "https://mirrors.ustc.edu.cn/",
"https://mirrors.ustc.edu.cn/CTAN" Big_File_ctan},
Hust = {"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
"https://mirrors.hust.edu.cn/debian" Big_File_debian},
Hust = {"hust", "HUST", "华中科技大学开源镜像站", "https://mirrors.hust.edu.cn/",
"https://mirrors.hust.edu.cn/debian" Big_File_debian},
// 速度暂时处于10位以后但是目前可用的源
Nju = {"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
"https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux};
Nju = {"nju", "NJU", "南京大学开源镜像站", "https://mirrors.nju.edu.cn/",
"https://mirrors.nju.edu.cn/archlinux" Big_File_archlinux};
// @ccmywish: [2023-09-05] 我只使用了不到5次重庆大学镜像站就把我的ip封杀了对用户来说封杀策略过严暂时不可靠暂时不用
//
// Cqu = {"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
// "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"};
/**
* @note by:ccmywish {
* [2023-09-05] 使5ip封杀了
* }
*/
// Cqu = {"cqu", "CQU", "重庆大学开源软件镜像站", "https://mirrors.cqu.edu.cn/",
// "https://mirrors.cqu.edu.cn/speedtest/1000mb.bin"};
@ -105,12 +107,9 @@ MirrorSite
Sohu = {"sohu", "SOHU", "搜狐开源镜像站", "https://mirrors.sohu.com/",
"https://mirrors.sohu.com/deepin-cd" Big_File_deepin};
// 开源社区
MirrorSite
NugetOrg = {"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/", NULL};
NugetOrg = {"nuget.org", "NuGet Org", "Nuget Organization", "https://www.nuget.org/", NULL};
MirrorSite
Upstream = {"upstream", "Upstream", "上游默认源", NULL, NULL};
@ -128,22 +127,6 @@ typedef struct {
static SourceInfo
/**
* @time 2024-05-24
* @ref https://help.mirrors.cernet.edu.cn/CPAN/
*/
pl_perl_sources[] = {
{&Upstream, NULL},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/"},
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/"},
{&Hust, "https://mirrors.hust.edu.cn/CPAN/"},
{&Ali, "https://mirrors.aliyun.com/CPAN/"},
{&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/"}
},
/**
* @time 2024-04-18
* @note
@ -787,7 +770,7 @@ wr_tex_sources[] = {
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
def_sources_n(pl_perl); def_sources_n(pl_php);
def_sources_n(pl_php);
def_sources_n(pl_rust);
def_sources_n(pl_java); def_sources_n(pl_clojure);
def_sources_n(pl_dotnet); def_sources_n(pl_dart); def_sources_n(pl_haskell);

View File

@ -25,44 +25,7 @@
#include "recipe/lang/ruby.c"
#include "recipe/lang/python.c"
#include "recipe/lang/nodejs.c"
void
pl_perl_check_cmd ()
{
chsrc_ensure_program ("perl");
}
void
pl_perl_getsrc (char *option)
{
pl_perl_check_cmd ();
// @ccmywish: 注意prettyprint 仅仅是一个内部实现,可能不稳定,如果需要更稳定的,
// 可以使用 CPAN::Shell->o('conf', 'urllist');
// 另外上述两种方法无论哪种都要首先load()
char *cmd = "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->prettyprint('urllist')\" ";
chsrc_run (cmd, RunOpt_Default);
}
/**
* Perl换源https://help.mirrors.cernet.edu.cn/CPAN/
*/
void
pl_perl_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (pl_perl);
chsrc_confirm_source (&source);
char *cmd = xy_strjoin (3,
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
chsrc_run (cmd, RunOpt_Default);
chsrc_note2 ("请您使用 perl -v 以及 cpan -v若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
puts ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
#include "recipe/lang/perl.c"
void
@ -1969,7 +1932,7 @@ wr_anaconda_setsrc (char *option)
/************************************** Begin Target Matrix ****************************************/
def_target(pl_perl); def_target(pl_php);
def_target(pl_php);
def_target(pl_rust); def_target(pl_java); def_target(pl_dart); def_target(pl_ocaml);
def_target(pl_r); def_target(pl_julia);
def_target_noget (pl_clojure);

62
src/recipe/lang/perl.c Normal file
View File

@ -0,0 +1,62 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* Contributors : Aoran Zeng <ccmywish@qq.com>
* Created on : <2023-09-06>
* Last modified : <2024-08-09>
* ------------------------------------------------------------*/
/**
* @time 2024-05-24
* @ref https://help.mirrors.cernet.edu.cn/CPAN/
*/
static SourceInfo
pl_perl_sources[] = {
{&Upstream, NULL},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CPAN/"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CPAN/"},
{&Bjtu, "https://mirror.bjtu.edu.cn/cpan/"},
{&Hust, "https://mirrors.hust.edu.cn/CPAN/"},
{&Ali, "https://mirrors.aliyun.com/CPAN/"},
{&Lzuoss, "https://mirror.lzu.edu.cn/CPAN/"}
};
def_sources_n(pl_perl);
void
pl_perl_check_cmd ()
{
chsrc_ensure_program ("perl");
}
void
pl_perl_getsrc (char *option)
{
pl_perl_check_cmd ();
// @ccmywish: 注意prettyprint 仅仅是一个内部实现,可能不稳定,如果需要更稳定的,
// 可以使用 CPAN::Shell->o('conf', 'urllist');
// 另外上述两种方法无论哪种都要首先load()
char *cmd = "perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->prettyprint('urllist')\" ";
chsrc_run (cmd, RunOpt_Default);
}
/**
* Perl换源https://help.mirrors.cernet.edu.cn/CPAN/
*/
void
pl_perl_setsrc (char *option)
{
SourceInfo source;
chsrc_yield_source (pl_perl);
chsrc_confirm_source (&source);
char *cmd = xy_strjoin (3,
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");
chsrc_run (cmd, RunOpt_Default);
chsrc_note2 ("请您使用 perl -v 以及 cpan -v若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
puts ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
}
def_target(pl_perl);