Split texlive out

This commit is contained in:
Aoran Zeng 2024-08-16 04:31:48 +08:00
parent 019b0b060b
commit 9d7a121947
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
4 changed files with 87 additions and 86 deletions

View File

@ -151,29 +151,8 @@ pl_dotnet_sources[] = {
{&Huawei, "https://mirrors.huaweicloud.com/repository/nuget/v3"}
};
/**
* @time 2023-09-10
*/
static SourceInfo
wr_tex_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet"}
};
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)
def_sources_n(pl_clojure);
def_sources_n(pl_dotnet);
def_sources_n(wr_tex);

View File

@ -112,70 +112,7 @@ pl_clojure_setsrc (char *option)
#include "recipe/os/BSD/OpenBSD.c"
void
wr_tex_check_cmd (bool *tlmgr_exist, bool *mpm_exist)
{
*tlmgr_exist = chsrc_check_program ("tlmgr");
*mpm_exist = chsrc_check_program ("mpm");
if (!*tlmgr_exist && !*mpm_exist)
{
chsrc_error ("未找到 tlmgr 或 mpm 命令,请检查是否存在(其一)");
exit(1);
}
}
void
wr_tex_getsrc (char *option)
{
bool tlmgr_exist, mpm_exist;
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
if (tlmgr_exist)
{
chsrc_run("tlmgr option repository", RunOpt_Default);
}
if (mpm_exist)
{
chsrc_run("mpm --get-repository", RunOpt_Default);
}
}
/**
* https://help.mirrors.cernet.edu.cn/CTAN/
*/
void
wr_tex_setsrc (char *option)
{
bool tlmgr_exist, mpm_exist;
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
SourceInfo source;
chsrc_yield_source (wr_tex);
chsrc_confirm_source (&source);
char *cmd = NULL;
if (tlmgr_exist)
{
cmd = xy_2strjoin ("tlmgr option repository ", source.url);
chsrc_run (cmd, RunOpt_Default);
}
if (mpm_exist)
{
char *miktex_url = xy_2strjoin (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/");
cmd = xy_2strjoin ("mpm --set-repository=", miktex_url);
chsrc_run (cmd, RunOpt_Default);
}
chsrc_say_lastly (&source, ChsrcTypeUntested);
}
#include "recipe/ware/TeX-Live.c"
#include "recipe/ware/emacs.c"
#include "recipe/ware/WinGet.c"
#include "recipe/ware/Homebrew.c"

View File

@ -91,7 +91,6 @@ static const char
os_freebsd, os_netbsd, os_openbsd,
};
def_target(wr_tex);
static const char
*wr_winget [] = {"winget", NULL, t(&wr_winget_target)},

View File

@ -0,0 +1,86 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-10>
* Last Modified : <2024-08-15>
* ------------------------------------------------------------*/
/**
* @time 2023-09-10
*/
static SourceInfo
wr_tex_sources[] = {
{&Upstream, NULL},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/tlnet"},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/tlnet"},
{&Bfsu, "https://mirrors.bfsu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Lzuoss, "https://mirror.lzu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Jlu, "https://mirrors.jlu.edu.cn/CTAN/systems/texlive/tlnet"},
{&Sustech, "https://mirrors.sustech.edu.cn/CTAN/systems/texlive/tlnet"}
};
def_sources_n(wr_tex);
void
wr_tex_check_cmd (bool *tlmgr_exist, bool *mpm_exist)
{
*tlmgr_exist = chsrc_check_program ("tlmgr");
*mpm_exist = chsrc_check_program ("mpm");
if (!*tlmgr_exist && !*mpm_exist)
{
chsrc_error ("未找到 tlmgr 或 mpm 命令,请检查是否存在(其一)");
exit(1);
}
}
void
wr_tex_getsrc (char *option)
{
bool tlmgr_exist, mpm_exist;
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
if (tlmgr_exist)
{
chsrc_run("tlmgr option repository", RunOpt_Default);
}
if (mpm_exist)
{
chsrc_run("mpm --get-repository", RunOpt_Default);
}
}
/**
* https://help.mirrors.cernet.edu.cn/CTAN/
*/
void
wr_tex_setsrc (char *option)
{
bool tlmgr_exist, mpm_exist;
wr_tex_check_cmd (&tlmgr_exist, &mpm_exist);
SourceInfo source;
chsrc_yield_source (wr_tex);
chsrc_confirm_source (&source);
char *cmd = NULL;
if (tlmgr_exist)
{
cmd = xy_2strjoin ("tlmgr option repository ", source.url);
chsrc_run (cmd, RunOpt_Default);
}
if (mpm_exist)
{
char *miktex_url = xy_2strjoin (xy_str_delete_suffix (source.url, "texlive/tlnet"), "win32/miktex/tm/packages/");
cmd = xy_2strjoin ("mpm --set-repository=", miktex_url);
chsrc_run (cmd, RunOpt_Default);
}
chsrc_say_lastly (&source, ChsrcTypeUntested);
}
def_target(wr_tex);