mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 20:44:01 +08:00
Add basic support for homebrew
Gitee close #I803P8
This commit is contained in:
parent
cbd429214f
commit
44822d0922
42
chsrc.c
42
chsrc.c
|
@ -1611,6 +1611,44 @@ wr_emacs_setsrc(char* option)
|
|||
|
||||
|
||||
|
||||
void
|
||||
wr_brew_getsrc(char* option)
|
||||
{
|
||||
char* cmd = "echo HOMEBREW_API_DOMAIN=$HOMEBREW_API_DOMAIN;"
|
||||
"echo HOMEBREW_BOTTLE_DOMAIN=$HOMEBREW_BOTTLE_DOMAIN;"
|
||||
"echo HOMEBREW_BREW_GIT_REMOTE=$HOMEBREW_BREW_GIT_REMOTE;"
|
||||
"echo HOMEBREW_CORE_GIT_REMOTE=$HOMEBREW_CORE_GIT_REMOTE;";
|
||||
system(cmd);
|
||||
}
|
||||
|
||||
void
|
||||
wr_brew_setsrc(char* option)
|
||||
{
|
||||
int index = 0;
|
||||
if (NULL!=option) {
|
||||
index = lets_find_mirror(wr_brew, option);
|
||||
} else {
|
||||
index = lets_test_speed(wr_brew);
|
||||
}
|
||||
|
||||
source_info source = wr_brew_sources[index];
|
||||
chsrc_say_selection (&source);
|
||||
|
||||
char* api_domain = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles/api"), "\"");
|
||||
char* bottle_domain = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "homebrew-bottles"), "\"");
|
||||
char* brew_git_remote = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "git/homebrew/brew.git"), "\"");
|
||||
char* core_git_remote = xy_strjoin(3, "export HOMEBREW_API_DOMAIN=\"", xy_2strjoin(source.url, "git/homebrew/homebrew-core.git"), "\"");
|
||||
|
||||
chsrc_runcmd(xy_strjoin(3,"echo ", api_domain, " >> ~/.bashrc >> ~/.zshrc"));
|
||||
chsrc_runcmd(xy_strjoin(3,"echo ", bottle_domain, " >> ~/.bashrc >> ~/.zshrc"));
|
||||
chsrc_runcmd(xy_strjoin(3,"echo ", brew_git_remote, " >> ~/.bashrc >> ~/.zshrc"));
|
||||
chsrc_runcmd(xy_strjoin(3,"echo ", core_git_remote, " >> ~/.bashrc >> ~/.zshrc"));
|
||||
|
||||
chsrc_say_thanks (&source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/************************************** Begin Target Matrix ****************************************/
|
||||
def_target_info(pl_ruby);
|
||||
|
@ -1696,11 +1734,11 @@ static const char
|
|||
|
||||
|
||||
def_target_info(wr_tex);
|
||||
def_target_info(wr_brew);
|
||||
|
||||
target_info
|
||||
wr_anaconda_target = {NULL, NULL, NULL, 0},
|
||||
wr_emacs_target = {wr_emacs_setsrc, NULL, wr_emacs_sources, wr_emacs_sources_n},
|
||||
wr_brew_target = {NULL, NULL, NULL, 0};
|
||||
wr_emacs_target = {wr_emacs_setsrc, NULL, wr_emacs_sources, wr_emacs_sources_n};
|
||||
|
||||
static const char
|
||||
*wr_anaconda[] = {"conda", "anaconda", NULL, targetinfo(&wr_anaconda_target)},
|
||||
|
|
14
chsrc.h
14
chsrc.h
|
@ -546,6 +546,18 @@ wr_emacs_sources[] = {
|
|||
{&Ustc, "https://mirrors.ustc.edu.cn/help/elpa.html"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/docs/elpa/"},
|
||||
{&EmacsChina, "https://elpamirror.emacs-china.org/"}
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 2023-09-10 更新
|
||||
*/
|
||||
wr_brew_sources[] = {
|
||||
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/"},
|
||||
{&Bfsu, "https://mirrors.bfsu.edu.cn/git/homebrew/"},
|
||||
{&Sustech, "https://mirrors.sustech.edu.cn/homebrew/"},
|
||||
{&Zju, "https://mirrors.zju.edu.cn/git/homebrew"}
|
||||
};
|
||||
|
||||
|
||||
|
@ -610,7 +622,7 @@ def_target_sources_n(os_kali); def_target_sources_n(os_openbsd); def_
|
|||
def_target_sources_n(os_arch); def_target_sources_n(os_gentoo); def_target_sources_n(os_netbsd);
|
||||
def_target_sources_n(os_deepin); def_target_sources_n(os_openeuler); def_target_sources_n(os_openkylin);
|
||||
|
||||
def_target_sources_n(wr_tex); def_target_sources_n(wr_emacs);
|
||||
def_target_sources_n(wr_tex); def_target_sources_n(wr_emacs); def_target_sources_n(wr_brew);
|
||||
|
||||
/* Target Info */
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue
Block a user