mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 17:44:00 +08:00
Add basic support for Haskell
This commit is contained in:
parent
7bf8aab236
commit
e8ae5d4e27
55
chsrc.c
55
chsrc.c
|
@ -818,6 +818,56 @@ pl_dart_setsrc (char* option)
|
|||
|
||||
|
||||
|
||||
void
|
||||
pl_haskell_setsrc(char* option)
|
||||
{
|
||||
int index = 0;
|
||||
if (NULL!=option) {
|
||||
index = lets_find_mirror(pl_haskell, option);
|
||||
} else {
|
||||
index = lets_test_speed(pl_haskell);
|
||||
}
|
||||
|
||||
source_info source = pl_haskell_sources[index];
|
||||
chsrc_say_selection (&source);
|
||||
|
||||
char* file = xy_strjoin(3, "repository mirror\n"
|
||||
" url: ", source.url,
|
||||
"\n secure: True");
|
||||
|
||||
char* config = NULL;
|
||||
if (xy_on_windows) {
|
||||
config = xy_2strjoin(xy_os_home, "\\AppData\\Roaming\\cabal\\config");
|
||||
} else {
|
||||
config = xy_2strjoin(xy_os_home, "/.cabal/config");
|
||||
}
|
||||
|
||||
xy_info(xy_strjoin(3,"chsrc: 请向 ", config, " 中手动添加:"));
|
||||
puts(file); puts("");
|
||||
|
||||
config = xy_2strjoin(xy_os_home, "/.stack/config.yaml");
|
||||
file = xy_strjoin(3, "package-indices:\n"
|
||||
" - download-prefix: ", source.url,
|
||||
"\n hackage-security:\n"
|
||||
" keyids:\n"
|
||||
" - 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d\n"
|
||||
" - 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42\n"
|
||||
" - 280b10153a522681163658cb49f632cde3f38d768b736ddbc901d99a1a772833\n"
|
||||
" - 2a96b1889dc221c17296fcc2bb34b908ca9734376f0f361660200935916ef201\n"
|
||||
" - 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3\n"
|
||||
" - 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921\n"
|
||||
" - 772e9f4c7db33d251d5c6e357199c819e569d130857dc225549b40845ff0890d\n"
|
||||
" - aa315286e6ad281ad61182235533c41e806e5a787e0b6d1e7eef3f09d137d2e9\n"
|
||||
" - fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0\n"
|
||||
" key-threshold: 3\n"
|
||||
" ignore-expiry: no");
|
||||
xy_info(xy_strjoin(3,"chsrc: 请向 ", config, " 中手动添加:"));
|
||||
puts(file);
|
||||
chsrc_say_thanks (&source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
pl_r_getsrc (char* option)
|
||||
{
|
||||
|
@ -1577,7 +1627,8 @@ def_target_info(pl_julia);
|
|||
|
||||
target_info
|
||||
pl_clojure_target = {pl_clojure_setsrc, NULL, pl_clojure_sources, pl_clojure_sources_n},
|
||||
pl_dotnet_target = {pl_dotnet_setsrc, NULL, pl_dotnet_sources, pl_dotnet_sources_n};
|
||||
pl_dotnet_target = {pl_dotnet_setsrc, NULL, pl_dotnet_sources, pl_dotnet_sources_n},
|
||||
pl_haskell_target = {pl_haskell_setsrc, NULL, pl_haskell_sources, pl_haskell_sources_n};
|
||||
|
||||
|
||||
#define targetinfo(t) (const char*)t
|
||||
|
@ -1593,12 +1644,14 @@ static const char
|
|||
*pl_clojure[] ={"clojure","clojars","leiningen", "lein", NULL, targetinfo(&pl_clojure_target)},
|
||||
*pl_dart [] = {"dart", "pub", NULL, targetinfo(&pl_dart_target)},
|
||||
*pl_dotnet[] = {"nuget", "net", ".net", "dotnet", NULL, targetinfo(&pl_dotnet_target)},
|
||||
*pl_haskell[] ={"haskell", "cabal", "stack", "hackage", NULL, targetinfo(&pl_haskell_target)},
|
||||
*pl_r [] = {"r", "cran", NULL, targetinfo(&pl_r_target)},
|
||||
*pl_julia [] = {"julia", NULL, targetinfo(&pl_julia_target)},
|
||||
**pl_packagers[] =
|
||||
{
|
||||
pl_ruby, pl_python, pl_nodejs, pl_perl, pl_php,
|
||||
pl_rust, pl_go, /*pl_dotnet,*/ pl_java, pl_clojure, pl_dart,
|
||||
pl_haskell,
|
||||
pl_r, pl_julia
|
||||
};
|
||||
|
||||
|
|
19
chsrc.h
19
chsrc.h
|
@ -127,7 +127,9 @@ typedef struct {
|
|||
/**
|
||||
* 源信息
|
||||
*
|
||||
* @note 我们要求每个源至少有一个教育网镜像,至少有一个商业公司或开源社区维护的镜像
|
||||
* @note 我们要求每个源最好情况下
|
||||
* 1. 至少有一个教育网镜像
|
||||
* 2. 至少有一个商业公司或开源社区维护的镜像
|
||||
*/
|
||||
|
||||
|
||||
|
@ -280,6 +282,19 @@ pl_dart_sources[] = {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 2023-09-10 更新
|
||||
*/
|
||||
pl_haskell_sources[] = {
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/hackage"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/hackage"},
|
||||
{&Nju, "https://mirror.nju.edu.cn/hackage"},
|
||||
{&Ustc, "https://mirrors.ustc.edu.cn/hackage"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 2023-09-04 更新
|
||||
*
|
||||
|
@ -587,7 +602,7 @@ chsrc_say_thanks (source_info* source)
|
|||
def_target_sources_n(pl_ruby); def_target_sources_n(pl_python); def_target_sources_n(pl_nodejs);
|
||||
def_target_sources_n(pl_perl); def_target_sources_n(pl_php); def_target_sources_n(pl_go);
|
||||
def_target_sources_n(pl_rust); def_target_sources_n(pl_java); def_target_sources_n(pl_clojure);
|
||||
def_target_sources_n(pl_dotnet); def_target_sources_n(pl_dart);
|
||||
def_target_sources_n(pl_dotnet); def_target_sources_n(pl_dart); def_target_sources_n(pl_haskell);
|
||||
def_target_sources_n(pl_r); def_target_sources_n(pl_julia);
|
||||
|
||||
def_target_sources_n(os_ubuntu); def_target_sources_n(os_debian); def_target_sources_n(os_fedora);
|
||||
|
|
Loading…
Reference in New Issue
Block a user