diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 7586798..2bf97cf 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -49,9 +49,8 @@ #include "recipe/lang/rawstr4c.h" #include "recipe/lang/Ruby/Ruby.c" - #include "recipe/lang/Python/common.h" - #include "recipe/lang/Python/pip.c" + #include "recipe/lang/Python/pip.c" #include "recipe/lang/Python/Poetry.c" #include "recipe/lang/Python/PDM.c" #include "recipe/lang/Python/Rye.c" @@ -66,86 +65,9 @@ #include "recipe/lang/JavaScript/Bun.c" #include "recipe/lang/JavaScript/nvm.c" -#include "recipe/lang/Perl.c" -#include "recipe/lang/PHP.c" -#include "recipe/lang/Lua.c" -#include "recipe/lang/Go.c" -#include "recipe/lang/Java.c" - -#include "recipe/lang/Rust/common.h" - #include "recipe/lang/Rust/rustup.c" - #include "recipe/lang/Rust/Cargo.c" - -#include "recipe/lang/Dart/common.h" -#include "recipe/lang/Dart/Pub.c" -#include "recipe/lang/Dart/Flutter.c" - -#include "recipe/lang/Haskell.c" -#include "recipe/lang/OCaml.c" -#include "recipe/lang/R.c" -#include "recipe/lang/Julia.c" -#include "recipe/lang/NuGet.c" -#include "recipe/lang/Clojure.c" -#include "recipe/os/rawstr4c.h" - -#include "recipe/os/APT/common.h" -// Debian-based -#include "recipe/os/APT/Debian.c" -#include "recipe/os/APT/Ubuntu.c" -#include "recipe/os/APT/Kali-Linux.c" -#include "recipe/os/APT/Raspberry-Pi-OS.c" -// Ubuntu-based -#include "recipe/os/APT/Linux-Mint.c" -#include "recipe/os/APT/Trisquel.c" -#include "recipe/os/APT/Linux-Lite.c" -// Debian-based and Ubuntu-based -#include "recipe/os/APT/Armbian.c" -// Independent -#include "recipe/os/APT/ROS.c" -#include "recipe/os/APT/Termux.c" -#include "recipe/os/APT/openKylin.c" -#include "recipe/os/APT/deepin.c" - -#include "recipe/os/YUM/common.h" -#include "recipe/os/YUM/Fedora-Linux.c" -#include "recipe/os/YUM/AlmaLinux.c" -#include "recipe/os/YUM/Rocky-Linux.c" -#include "recipe/os/YUM/openEuler.c" -#include "recipe/os/YUM/Anolis-OS.c" - -#include "recipe/os/pacman/Arch-Linux.c" -#include "recipe/os/pacman/Manjaro-Linux.c" -#include "recipe/os/pacman/MSYS2.c" - -#include "recipe/os/openSUSE.c" -#include "recipe/os/Alpine-Linux.c" -#include "recipe/os/Gentoo-Linux.c" -#include "recipe/os/Void-Linux.c" -#include "recipe/os/Solus.c" -#include "recipe/os/OpenWrt.c" - -#include "recipe/os/BSD/FreeBSD.c" -#include "recipe/os/BSD/NetBSD.c" -#include "recipe/os/BSD/OpenBSD.c" - - - -#include "recipe/ware/TeX-Live.c" -#include "recipe/ware/Emacs.c" -#include "recipe/ware/WinGet.c" -#include "recipe/ware/Homebrew/Homebrew.c" -#include "recipe/ware/CocoaPods.c" -#include "recipe/ware/Nix.c" -#include "recipe/ware/Guix.c" -#include "recipe/ware/Flathub.c" -#include "recipe/ware/Docker-Hub/Docker-Hub.c" -#include "recipe/ware/Anaconda/Anaconda.c" - -#include "recipe/menu.c" - #include "rawstr4c.h" diff --git a/src/framework/chef.c b/src/framework/chef.c index 7358357..c3269fd 100644 --- a/src/framework/chef.c +++ b/src/framework/chef.c @@ -54,6 +54,7 @@ chef_allow_local_mode (Target_t *target, Capability_t cap, const char *explain_z target->cap_local_explain = xy_strdup (CHINESE ? explain_zh : explain_en); } +void chef_forbid_local_mode (Target_t *target) { if (!target) diff --git a/src/framework/core.c b/src/framework/core.c index a79ad7c..bfef052 100644 --- a/src/framework/core.c +++ b/src/framework/core.c @@ -1094,20 +1094,21 @@ chsrc_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accu static void chsrc_set_sources_speed_measure_url_with_func ( Target_t *target, - SpeedUrlConstructor_t func, + char *(*func)(const char *url, const char *user_data), char *user_data) { - Source_t *sources = &target->sources; - + Source_t *sources = target->sources; + int n = target->sources_n; for (int i=0; iprovider->type; if (src->url) { /* 为空时才修改 或者里面是脏数据 */ if (NULL==src->speed_measure_url || !chef_is_url (src->speed_measure_url)) { - src->speed_measure_url = func (src->url, postfix); + src->speed_measure_url = func (src->url, user_data); } } } @@ -1121,7 +1122,6 @@ chsrc_set_sources_speed_measure_url_with_func ( static void chsrc_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix) { - xy_2strjoin (src->url, postfix); chsrc_set_sources_speed_measure_url_with_func (target, xy_2strjoin, postfix); } diff --git a/src/recipe/lang/JavaScript/JavaScript.c b/src/recipe/lang/JavaScript/JavaScript.c index 9d3f747..9fd6dbf 100644 --- a/src/recipe/lang/JavaScript/JavaScript.c +++ b/src/recipe/lang/JavaScript/JavaScript.c @@ -69,7 +69,9 @@ pl_js_group_setsrc (char *option) pl_js_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist); chsrc_set_target_group_mode (); - chsrc_yield_source_and_confirm (pl_js_group); + + use_this(pl_js_group); + Source_t source = chsrc_yield_source_and_confirm (this, option); if (npm_exist) { diff --git a/src/recipe/lang/JavaScript/common.h b/src/recipe/lang/JavaScript/common.h index 8df4181..460d8f0 100644 --- a/src/recipe/lang/JavaScript/common.h +++ b/src/recipe/lang/JavaScript/common.h @@ -27,7 +27,7 @@ pl_js_group_prelude (void) chef_set_contributors (this,0); chef_allow_local_mode (this, PartiallyCan, - "支持 npm, yarn v2, pnpm, 不支持 yarn v1" + "支持 npm, yarn v2, pnpm, 不支持 yarn v1", "Support npm, yarn v2, pnpm, not yarn v1"); chef_allow_english(this); chef_allow_user_define(this); diff --git a/src/recipe/lang/JavaScript/nvm.c b/src/recipe/lang/JavaScript/nvm.c index 134337b..cc268cd 100644 --- a/src/recipe/lang/JavaScript/nvm.c +++ b/src/recipe/lang/JavaScript/nvm.c @@ -48,7 +48,7 @@ pl_js_nvm_getsrc (char *option) void pl_js_nvm_setsrc (char *option) { - Source_t source = chsrc_yield_source_and_confirm (&pl_js_binary_release); + Source_t source = chsrc_yield_source_and_confirm (&pl_js_nodejs_binary_target); char *w = xy_strjoin (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n"); diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index af8a759..6a4b439 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -57,7 +57,9 @@ pl_python_group_setsrc (char *option) pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist); chsrc_set_target_group_mode (); - chsrc_yield_source_and_confirm (pl_python_group); + + use_this(pl_python_group); + Source_t source = chsrc_yield_source_and_confirm (this, option); // 交给后面检查命令的存在性 diff --git a/src/recipe/lang/Python/Rye.c b/src/recipe/lang/Python/Rye.c index 6ae4098..d2ca24d 100644 --- a/src/recipe/lang/Python/Rye.c +++ b/src/recipe/lang/Python/Rye.c @@ -1,5 +1,7 @@ /** ------------------------------------------------------------ * SPDX-License-Identifier: GPL-3.0-or-later + * ------------------------------------------------------------- + * 由于Rye已经有后继uv了,所以我们不把该管理器纳入Python group中 * ------------------------------------------------------------*/ def_target(pl_python_rye); @@ -23,9 +25,6 @@ pl_python_rye_prelude (void) chef_allow_english(this); chef_allow_user_define(this); - chef_set_note ("由于Rye已经有后继uv了,所以我们不把该管理器纳入Python group中", - "Since Rye has successor uv, we don't include this manager in Python group"); - // 使用 pl_python_group 的源 this->sources = pl_python_group_target.sources; this->sources_n = pl_python_group_target.sources_n; diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 97659d3..e84da1c 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -11,7 +11,7 @@ def_target(pl_python_group); * 下面有几个镜像站微调了这个路径,我们只要确认能找到 packages 目录就好 */ static char * -pl_python_speed_url_constructor (char *url, char *user_data) +pl_python_speed_url_constructor (const char *url, const char *user_data) { char *str = xy_str_delete_suffix (url, "/simple"); str = xy_2strjoin (str, "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"); @@ -49,7 +49,7 @@ pl_python_group_prelude (void) /* 不要添加Zju,浙大的PyPI服务在校外访问会自动转向Tuna */ {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple",FeedByPrelude}, {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple",FeedByPrelude}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple",FeedByPrelude, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple",FeedByPrelude}, {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple", FeedByPrelude}, {&Ali, "https://mirrors.aliyun.com/pypi/simple/", FeedByPrelude}, {&Nju, "https://mirror.nju.edu.cn/pypi/web/simple",FeedByPrelude}, diff --git a/src/recipe/lang/Ruby/Ruby.c b/src/recipe/lang/Ruby/Ruby.c index d855861..e089814 100644 --- a/src/recipe/lang/Ruby/Ruby.c +++ b/src/recipe/lang/Ruby/Ruby.c @@ -6,8 +6,7 @@ static MirrorSite_t RubyChina = { IS_DedicatedMirrorSite, "rubychina", "RubyChina", "Ruby China 社区", "https://gems.ruby-china.com/", - "https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem", // 9.9 MB - ACCURATE + {NotSkip, NA, NA, "https://gems.ruby-china.com/rubygems/gems/nokogiri-1.15.0-java.gem", ACCURATE} // 9.9 MB }; def_target(pl_ruby); @@ -27,7 +26,7 @@ pl_ruby_prelude (void) chef_set_sous_chefs (this, 0); chef_set_contributors (this, 0); - chef_allow_local_mode (this, PartiallyCan, "Support `bundler`. No support for `gem`", "Support `bundler`. No support for `gem`"); + chef_allow_local_mode (this, PartiallyCan, "支持 bundler. 不支持 gem", "Support bundler. Not support gem"); chef_allow_english(this); chef_allow_user_define(this);