Skip to content

Commit 0180558

Browse files
committed
修改API为 chef_set_rest_smURL_
1 parent d766a6f commit 0180558

File tree

16 files changed

+28
-27
lines changed

16 files changed

+28
-27
lines changed

doc/11-如何设置换源链接与测速链接.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,15 @@ def_sources_end()
5959
//
6060
6161
// 调整/设置上述某一个镜像站的所提供源的 "精准测速链接"
62-
chef_set_smURL (this, &UpstreamProvider, "新的测速链接")
63-
// 把所有上述源的 "测速链接" 设置为 "换源链接" + postfix
64-
chef_set_all_smURL_with_postfix (this, "/dir/BigFile.tar.gz");
62+
chef_set_smURL (this, &UpstreamProvider, "新的测速链接");
63+
// 设置上述某一个镜像站的所提供源的 "精准测速链接" 设置为 "换源链接" + postfix
64+
chef_set_smURL_with_postfix (this, &UpstreamProvider, "/dir/BigFile.tar.gz");
6565
// 基于 "换源链接" 做更自定义的操作
66-
chef_set_all_smURL_with_func (this, func, data);
66+
chef_set_smURL_with_func (this, &UpstreamProvider, func, data);
67+
68+
// 把所有上述源中还未设置 "精准测速链接" 的源进行设置
69+
chef_set_rest_smURL_with_postfix (this, "/dir/BigFile.tar.gz");
70+
chef_set_rest_smURL_with_func (this, func, data);
6771
6872
// 调整某一个镜像站(Provider)的 "测速链接"
6973
chef_set_provider_smURL (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");

src/framework/chef.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ chef_set_smURL (Target_t *target, SourceProvider_t *provider, char *url)
209209

210210

211211
/**
212-
* @brief 提供一个函数,这个函数基于 "换源链接" 和用户提供的数据来构造和填充精准测速链接
212+
* @brief 针对每一个剩下的还未设置专用测速链接的源,对其 "换源链接" 使用函数 `func` 来生成专用测速链接
213213
*/
214214
void
215-
chef_set_all_smURL_with_func (
215+
chef_set_rest_smURL_with_func (
216216
Target_t *target,
217217
char *(*func)(const char *url, const char *user_data),
218218
char *user_data)
@@ -239,12 +239,12 @@ chef_set_all_smURL_with_func (
239239

240240

241241
/**
242-
* @brief "换源链接" 增加一个后缀来构造和填充专用测速链接
242+
* @brief 针对每一个剩下的还未设置专用测速链接的源,对其 "换源链接" 增加一个后缀来生成专用测速链接
243243
*/
244244
void
245-
chef_set_all_smURL_with_postfix (Target_t *target, char *postfix)
245+
chef_set_rest_smURL_with_postfix (Target_t *target, char *postfix)
246246
{
247-
chef_set_all_smURL_with_func (target, xy_2strcat, postfix);
247+
chef_set_rest_smURL_with_func (target, xy_2strcat, postfix);
248248
}
249249

250250

src/framework/struct.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,7 @@ Target_t;
180180
* {&某镜像站2, "换源URL", NULL }, // 若精准测速链接为空,则为模糊测速,默认使用该镜像站的整体测速链接
181181
* def_sources_end()
182182
*
183-
* 若是出于代码美观考虑,上述第三列可以写 FeedByPrelude,然后下面调用函数来填充:
184-
* chef_set_smURL()
185-
* chef_set_all_smURL_with_postfix()
186-
* chef_set_all_smURL_with_func()
183+
* 出于代码美观考虑,上述第三列可以写 FeedByPrelude,然后下面使用文档 ./doc/11-如何设置换源链接与测速链接.md 中的函数来填充
187184
*/
188185
#define def_sources_begin() Source_t sources[] = {
189186
#define def_sources_end() }; \

src/recipe/lang/Dart/Flutter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pl_dart_flutter_prelude (void)
2929
{&Nju, "https://mirror.nju.edu.cn/flutter", FeedByPrelude}
3030
def_sources_end()
3131

32-
chef_set_all_smURL_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz");
32+
chef_set_rest_smURL_with_postfix (this, "/flutter_infra_release/releases/stable/linux/flutter_linux_v1.0.0-stable.tar.xz");
3333
}
3434

3535

src/recipe/lang/Dart/Pub.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pl_dart_prelude (void)
2929
{&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude}
3030
def_sources_end()
3131

32-
chef_set_all_smURL_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
32+
chef_set_rest_smURL_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
3333
}
3434

3535

src/recipe/lang/Java.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pl_java_prelude ()
3636
def_sources_end()
3737

3838
// 220MB
39-
chef_set_all_smURL_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar");
39+
chef_set_rest_smURL_with_postfix (this, "com/tencentcloudapi/tencentcloud-sdk-java/3.1.1033/tencentcloud-sdk-java-3.1.1033-javadoc.jar");
4040
}
4141

4242

src/recipe/lang/JavaScript/common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pl_js_group_prelude (void)
3939
def_sources_end()
4040

4141
// 29MB 大小
42-
chef_set_all_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
42+
chef_set_rest_smURL_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
4343
}
4444

4545

@@ -73,5 +73,5 @@ pl_js_nodejs_binary_prelude (void)
7373
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude}
7474
def_sources_end()
7575

76-
chef_set_all_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
76+
chef_set_rest_smURL_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
7777
}

src/recipe/lang/Perl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pl_perl_prelude ()
3939
{&Ali, "https://mirrors.aliyun.com/CPAN/", FeedByPrelude}
4040
def_sources_end()
4141

42-
chef_set_all_smURL_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz");
42+
chef_set_rest_smURL_with_postfix (this, "authors/id/D/DB/DBAURAIN/Bio-MUST-Apps-FortyTwo-0.213470.tar.gz");
4343
}
4444

4545

src/recipe/lang/Python/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pl_python_group_prelude (void)
7070
// {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL}
7171
def_sources_end()
7272

73-
chef_set_all_smURL_with_func (this, pl_python_speed_url_constructor, NULL);
73+
chef_set_rest_smURL_with_func (this, pl_python_speed_url_constructor, NULL);
7474
}
7575

7676
void

src/recipe/lang/Rust/rustup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pl_rust_rustup_prelude (void)
3838
def_sources_end()
3939

4040
// 20MB大小
41-
chef_set_all_smURL_with_postfix (this, "/dist/2025-06-26/cargo-1.88.0-x86_64-unknown-illumos.tar.gz");
41+
chef_set_rest_smURL_with_postfix (this, "/dist/2025-06-26/cargo-1.88.0-x86_64-unknown-illumos.tar.gz");
4242
}
4343

4444

0 commit comments

Comments
 (0)