Skip to content

Commit c830c50

Browse files
committed
使用 repoURLsmURL
1 parent 1213439 commit c830c50

File tree

19 files changed

+42
-43
lines changed

19 files changed

+42
-43
lines changed

doc/10-如何编写recipe.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@
5757
- **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL
5858
- **测速链接**: 用来测速的URL,与 "换源链接" 不同,可分为 **精准测速****模糊测速**
5959

60-
1. 在代码中,测速链接一般使用 `smurl` (即 `speed measure URL`) 来指代
61-
2. 在代码中,换源链接一般使用 `repourl` (即 `repository URL`) 来指代
60+
1. 在代码中,测速链接一般使用 `smURL` (即 `speed measure URL`)`speed_measure_url` 来指代
61+
2. 在代码中,换源链接一般使用 `repoURL` (即 `repository URL`) 或直接用 `url` 来指代
6262

63-
为什么不用 `regurl`,因为使用术语 `repository` 的 target 远多于使用术语 `registry` 的。
63+
- 为什么不用 `regurl`,因为使用术语 `repository` 的 target 远多于使用术语 `registry` 的。
64+
- 为什么莫名其妙使用了大小写混合的API? 因为 `smurl``repourl` 的可读性太差
6465

6566
- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
6667

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def_sources_end()
2828
//
2929

3030
// 调整上述某一个镜像站的所提供源的 "换源链接"
31-
chef_set_url (this, &UpstreamProvider, "新的换源链接");
31+
chef_set_repoURL (this, &UpstreamProvider, "新的换源链接");
3232
```
3333
3434
<br>
@@ -59,14 +59,14 @@ def_sources_end()
5959
//
6060
6161
// 调整/设置上述某一个镜像站的所提供源的 "精准测速链接"
62-
chef_set_smurl (this, &UpstreamProvider, "新的测速链接")
62+
chef_set_smURL (this, &UpstreamProvider, "新的测速链接")
6363
// 把所有上述源的 "测速链接" 设置为 "换源链接" + postfix
64-
chef_set_all_smurl_with_postfix (this, "/dir/BigFile.tar.gz");
64+
chef_set_all_smURL_with_postfix (this, "/dir/BigFile.tar.gz");
6565
// 基于 "换源链接" 做更自定义的操作
66-
chef_set_all_smurl_with_func (this, func, data);
66+
chef_set_all_smURL_with_func (this, func, data);
6767
6868
// 调整某一个镜像站(Provider)的 "测速链接"
69-
chef_set_provider_smurl (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");
69+
chef_set_provider_smURL (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");
7070
// 调整某一个镜像站(Provider)的 "测速精度"
7171
chef_set_provider_sm_accuracy (&UpstreamProvider, ROUGH);
7272
```

src/framework/chef.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ chef_register_contributor (char *id, char *name, char *email, char *display_name
9595
* @note 这个修改的是全局 Provider 里的信息。往往用来设置 UpstreamProvider
9696
*/
9797
void
98-
chef_set_provider_smurl (SourceProvider_t *provider, char *url)
98+
chef_set_provider_smURL (SourceProvider_t *provider, char *url)
9999
{
100100
provider->psmi.skip = NotSkip;
101101
provider->psmi.url = xy_strdup (url);
@@ -117,12 +117,12 @@ chef_set_provider_sm_accuracy (SourceProvider_t *provider, bool accuracy)
117117

118118

119119
/**
120-
* @brief 修改 或 补充 某个镜像站的换源链接
120+
* @brief 修改 或 补充 某个镜像站的换源链接,即修改 Source_t.url
121121
*
122122
* @example 见 os_ubuntu_resetsrc() 中对非 x86_64 架构源地址的修改
123123
*/
124124
void
125-
chef_set_url (Target_t *target, SourceProvider_t *provider, char *url)
125+
chef_set_repoURL (Target_t *target, SourceProvider_t *provider, char *url)
126126
{
127127
xy_cant_be_null (target);
128128
xy_cant_be_null (provider);
@@ -143,12 +143,10 @@ chef_set_url (Target_t *target, SourceProvider_t *provider, char *url)
143143
}
144144

145145
/**
146-
* 设置 或 修改 某个镜像站的 *精准*测速链接
147-
*
148-
* sm = speed measure
146+
* @breif 设置 或 修改 某个镜像站的 *精准*测速链接,即修改 Source_t.speed_measure_url
149147
*/
150148
void
151-
chef_set_smurl (Target_t *target, SourceProvider_t *provider, char *url)
149+
chef_set_smURL (Target_t *target, SourceProvider_t *provider, char *url)
152150
{
153151
xy_cant_be_null (target);
154152
xy_cant_be_null (provider);
@@ -173,7 +171,7 @@ chef_set_smurl (Target_t *target, SourceProvider_t *provider, char *url)
173171
* @brief 提供一个函数,这个函数基于 "换源链接" 和用户提供的数据来构造和填充精准测速链接
174172
*/
175173
void
176-
chef_set_all_smurl_with_func (
174+
chef_set_all_smURL_with_func (
177175
Target_t *target,
178176
char *(*func)(const char *url, const char *user_data),
179177
char *user_data)
@@ -203,9 +201,9 @@ chef_set_all_smurl_with_func (
203201
* @brief 给 "换源链接" 增加一个后缀来构造和填充专用测速链接
204202
*/
205203
void
206-
chef_set_all_smurl_with_postfix (Target_t *target, char *postfix)
204+
chef_set_all_smURL_with_postfix (Target_t *target, char *postfix)
207205
{
208-
chef_set_all_smurl_with_func (target, xy_2strcat, postfix);
206+
chef_set_all_smURL_with_func (target, xy_2strcat, postfix);
209207
}
210208

211209

src/framework/struct.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ typedef struct Source_t
7777
SourceProvider_t *provider;
7878
MirrorSite_t *mirror;
7979
};
80-
/* 用于换源的 URL */
80+
/* 用于换源的 URL,也称 repoURL */
8181
char *url;
8282

83-
/* 对该 source 的专用测速链接,这就是精准测速 */
83+
/* 对该 source 的专用测速链接,这就是精准测速,也称 smURL */
8484
char *speed_measure_url;
8585
}
8686
Source_t;
@@ -181,9 +181,9 @@ Target_t;
181181
* def_sources_end()
182182
*
183183
* 若是出于代码美观考虑,上述第三列可以写 FeedByPrelude,然后下面调用函数来填充:
184-
* chef_set_smurl()
185-
* chef_set_all_smurl_with_postfix()
186-
* chef_set_all_smurl_with_func()
184+
* chef_set_smURL()
185+
* chef_set_all_smURL_with_postfix()
186+
* chef_set_all_smURL_with_func()
187187
*/
188188
#define def_sources_begin() Source_t sources[] = {
189189
#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_all_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_all_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_all_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_all_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_all_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_all_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_all_smURL_with_func (this, pl_python_speed_url_constructor, NULL);
7474
}
7575

7676
void

0 commit comments

Comments
 (0)