Fix pl recipes

This commit is contained in:
Aoran Zeng 2025-08-10 20:45:56 +08:00
parent fec96b812b
commit 5c44b140e4
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
15 changed files with 28 additions and 23 deletions

View File

@ -65,6 +65,11 @@
#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"

View File

@ -170,6 +170,7 @@ TargetRegisterInfo_t;
/* 以下宏仅能放在 prelude() 中使用 */
#define use_this(t) Target_t *this = &t##_target;
#define use_this_source(t) use_this(t); Source_t source = chsrc_yield_source_and_confirm (this, option);
#define def_sources_begin() SourceProvider_t upstream = UpstreamProvider; Source_t sources[] = {
#define def_sources_end() }; \

View File

@ -38,7 +38,7 @@ pl_clojure_prelude ()
void
pl_clojure_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_clojure);
use_this_source(pl_clojure);
if (chsrc_in_local_mode())
{

View File

@ -4,16 +4,16 @@
static MirrorSite_t GoProxyCN =
{
IS_DedicatedMirrorSite,
"goproxy.cn", "Goproxy.cn", "Goproxy.cn (七牛云)", "https://goproxy.cn/",
"https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", // 30 MB
ACCURATE
{NotSkip, NA, NA, "https://goproxy.cn/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", ACCURATE} // 30 MB
},
GoProxyIO =
{
IS_DedicatedMirrorSite,
"goproxy.io", "GOPROXY.IO", "GOPROXY.IO", "https://goproxy.io/",
"https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", // 30 MB
ACCURATE
{NotSkip, NA, NA, "https://goproxy.io/github.com/aws/aws-sdk-go/@v/v1.45.2.zip", ACCURATE} // 30 MB
};
def_target(pl_go);
@ -84,7 +84,7 @@ pl_go_setsrc (char *option)
{
pl_go_check_cmd ();
chsrc_yield_source_and_confirm (pl_go);
use_this_source(pl_go);
char *cmd = "go env -w GO111MODULE=on";
chsrc_run (cmd, RunOpt_Default);

View File

@ -41,7 +41,7 @@ pl_haskell_prelude ()
void
pl_haskell_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_haskell);
use_this_source(pl_haskell);
char *content = xy_str_gsub (RAWSTR_pl_haskell_cabal_config, "@url@", source.url);

View File

@ -80,7 +80,7 @@ pl_java_setsrc (char *option)
bool maven_exist, gradle_exist;
pl_java_check_cmd (&maven_exist, &gradle_exist);
chsrc_yield_source_and_confirm (pl_java);
use_this_source(pl_java);
if (maven_exist)
{

View File

@ -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_nodejs_binary_target);
Source_t source = chsrc_yield_source_and_confirm (&pl_js_nodejs_binary_target, option);
char *w = xy_strjoin (3, "export NVM_NODEJS_ORG_MIRROR=", source.url, "\n");

View File

@ -56,7 +56,7 @@ pl_julia_getsrc (char *option)
void
pl_julia_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_julia);
use_this_source(pl_julia);
char *w = xy_strjoin (3, "ENV[\"JULIA_PKG_SERVER\"] = \"", source.url, "\"");

View File

@ -4,9 +4,9 @@
static MirrorSite_t Api7 =
{
IS_DedicatedMirrorSite,
"api7", "api7.ai", "深圳支流科技有限公司", "https://www.apiseven.com/",
NULL, // no measure URL
ROUGH
{SKIP, ToFill, ToFill, NULL, ROUGH}
};
def_target(pl_lua);
@ -30,8 +30,6 @@ pl_lua_prelude ()
chef_forbid_english(this);
chef_allow_user_define(this);
chef_set_note ("目前只有一个源", NULL);
def_sources_begin()
{&upstream, NULL, DelegateToUpstream},
{&Api7, "https://luarocks.cn", DelegateToMirror}
@ -52,7 +50,8 @@ pl_lua_getsrc (char *option)
void
pl_lua_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_lua);
use_this(pl_lua);
Source_t source = chsrc_yield_source_and_confirm (this, option);
char *config = xy_strjoin (3, "rocks_servers = {\n"
" \"", source.url, "\"\n"

View File

@ -53,7 +53,7 @@ pl_ocaml_setsrc (char *option)
{
pl_ocaml_check_cmd ();
chsrc_yield_source_and_confirm (pl_ocaml);
use_this_source(pl_ocaml);
char *cmd = xy_strjoin (3, "opam repo set-url default ",
source.url,

View File

@ -19,7 +19,7 @@ pl_php_prelude ()
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 0);
chef_allow_local_mode (this, Can, NULL, NULL);
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_forbid_english(this);
chef_allow_user_define(this);
@ -57,7 +57,8 @@ pl_php_setsrc (char *option)
{
pl_php_check_cmd ();
chsrc_yield_source_and_confirm (pl_php);
use_this(pl_php);
Source_t source = chsrc_yield_source_and_confirm (this, option);
char *where = " -g ";
if (chsrc_in_local_mode())

View File

@ -59,7 +59,7 @@ pl_perl_getsrc (char *option)
void
pl_perl_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_perl);
use_this_source(pl_perl);
char *cmd = xy_strjoin (3,
"perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('urllist', 'unshift', '", source.url, "'); CPAN::HandleConfig->commit()\"");

View File

@ -72,8 +72,7 @@ pl_ruby_setsrc (char *option)
{
chsrc_ensure_program ("gem");
use_this(pl_ruby);
Source_t source = chsrc_yield_source_and_confirm (this, option);
use_this_source(pl_ruby);
char *cmd = NULL;

View File

@ -70,7 +70,7 @@ pl_rust_cargo_getsrc (char *option)
void
pl_rust_cargo_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_rust_cargo);
use_this_source(pl_rust_cargo);
char *content = RAWSTR_pl_rust_cargo_config;

View File

@ -60,7 +60,7 @@ pl_rust_rustup_getsrc (char *option)
void
pl_rust_rustup_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_rust_rustup);
use_this_source(pl_rust_rustup);
#ifdef XY_On_Windows