Add set by postfix

This commit is contained in:
Aoran Zeng 2025-08-10 15:43:46 +08:00
parent 341369f347
commit caa90fee32
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
9 changed files with 97 additions and 156 deletions

View File

@ -829,42 +829,6 @@ measure_speed_for_every_source (Source_t sources[], int size, double speed_recor
/**
* @brief
*
* target Source_t speed_url
*
* 使: url speed_url
*
* @note recipe 使 <category>_<target>_sources_prepare()
*/
#define chsrc_sources_prepare_speedurl_with_postfix(target,str) sources_prepare_speedurl_with_postfix(target##_sources, target##_sources_n, str)
static void
sources_prepare_speedurl_with_postfix (Source_t sources[], int n, char *postfix)
{
for (int i=0; i<n; i++)
{
Source_t *src = &sources[i];
ProviderType_t type = src->provider->type;
if (IS_DedicatedMirrorSite==type || IS_UpstreamProvider==type)
{
/* 这两个不用填因为定义这二者的时候如果给了整体测速URL则就是ACCURATE的我们直接会DelegateTo那里 */
continue;
}
if (src->url)
{
/* 为空时才修改 或者里面是脏数据 */
if (NULL==src->speed_measure_url || !chef_is_url (src->speed_measure_url))
src->speed_measure_url = xy_2strjoin (src->url, postfix);
}
}
}
/** /**
* *
*/ */
@ -1124,6 +1088,38 @@ chsrc_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accu
} }
/**
* @brief
*/
static void
chsrc_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix)
{
Source_t *sources = &target->sources;
for (int i=0; i<n; i++)
{
Source_t *src = &sources[i];
ProviderType_t type = src->provider->type;
if (IS_DedicatedMirrorSite==type)
{
/* 这个不用填因为定义它的时候如果给了整体测速URL则就是ACCURATE的我们直接会DelegateTo那里 */
continue;
}
if (src->url)
{
/* 为空时才修改 或者里面是脏数据 */
if (NULL==src->speed_measure_url || !chef_is_url (src->speed_measure_url))
src->speed_measure_url = xy_2strjoin (src->url, postfix);
}
}
}
void void
chsrc_determine_chgtype (ChgType_t type) chsrc_determine_chgtype (ChgType_t type)
{ {

View File

@ -92,9 +92,7 @@ Source_t;
/* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */ /* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */
#define NeedContribute NULL #define NeedContribute NULL
/* 由 _sources_prepare 填充 */ /* 由 _sources_prepare 填充 */
#define FeedBySourcesPrepare NULL #define FeedByPrelude NULL
/* 由 prelude() 修改 */
#define ChangedByPrelude NULL
#define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources) #define def_sources_n(t) const size_t t##_sources_n = xy_arylen(t##_sources)

View File

@ -2,8 +2,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define PL_Dart_Pub_Speed_URL_Postfix "/packages/flutter_vision/versions/1.1.4.tar.gz"
def_target(pl_dart); def_target(pl_dart);
void void
@ -26,24 +24,19 @@ pl_dart_prelude (void)
chef_allow_set(); chef_allow_set();
chef_allow_reset(); chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "Pub 支持项目级换源", "Pub supports project-level source changing"); chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this); chef_allow_english(this);
chef_allow_user_define(this); chef_allow_user_define(this);
def_sources_begin() def_sources_begin()
{&upstream, "https://pub.dev", "https://pub.dev" PL_Dart_Pub_Speed_URL_Postfix}, {&upstream, "https://pub.dev", FeedByPrelude},
{&FlutterCN, "https://pub.flutter-io.cn", {&FlutterCN, "https://pub.flutter-io.cn", FeedByPrelude},
"https://pub.flutter-io.cn" PL_Dart_Pub_Speed_URL_Postfix}, {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub", FeedByPrelude,
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/dart-pub", {&Nju, "https://mirror.nju.edu.cn/dart-pub", FeedByPrelude}
"https://mirror.sjtu.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/dart-pub",
"https://mirrors.tuna.tsinghua.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix},
{&Nju, "https://mirror.nju.edu.cn/dart-pub",
"https://mirror.nju.edu.cn/dart-pub" PL_Dart_Pub_Speed_URL_Postfix}
def_sources_end() def_sources_end()
chsrc_set_sources_speed_measure_url_with_postfix (this, "/packages/flutter_vision/versions/1.1.4.tar.gz");
} }

View File

@ -2,8 +2,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define OS_Debian_Speed_URL_Postfix "/dists/bookworm/main/Contents-all.gz"
def_target(os_debian); def_target(os_debian);
void void
@ -35,45 +33,25 @@ os_debian_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "http://deb.debian.org/debian", DelegateToUpstream}, {&upstream, "http://deb.debian.org/debian", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian/", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/debian", FeedByPrelude},
{&Volcengine, "https://mirrors.volces.com/debian", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/debian", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian", FeedByPrelude},
{&Tencent, "https://mirrors.tencent.com/debian", FeedByPrelude}
/* MirrorZ 的速度这么测也是可以的 */ // {&Tencent_Intra, "https://mirrors.tencentyun.com/debian", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian/",
"https://mirrors.cernet.edu.cn/debian/" OS_Debian_Speed_URL_Postfix},
{&Ali, "https://mirrors.aliyun.com/debian",
"https://mirrors.aliyun.com/debian" OS_Debian_Speed_URL_Postfix},
{&Volcengine, "https://mirrors.volces.com/debian",
"https://mirrors.volces.com/debian" OS_Debian_Speed_URL_Postfix},
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian",
"https://mirrors.bfsu.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Ustc, "https://mirrors.ustc.edu.cn/debian",
"https://mirrors.ustc.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian",
"https://mirrors.tuna.tsinghua.edu.cn/debian" OS_Debian_Speed_URL_Postfix},
{&Tencent, "https://mirrors.tencent.com/debian",
"https://mirrors.tencent.com/debian" OS_Debian_Speed_URL_Postfix}
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian", FeedBySourcesPrepare},
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/debian", FeedBySourcesPrepare}, // {&Netease, "https://mirrors.163.com/debian", FeedByPrelude},
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/debian", FeedBySourcesPrepare} // {&Sohu, "https://mirrors.sohu.com/debian", FeedByPrelude}
def_sources_end() def_sources_end()
}
chsrc_set_sources_speed_measure_url_with_postfix (this, "/dists/bookworm/main/Contents-all.gz");
void
os_debian_sources_prepare ()
{
chsrc_sources_prepare_speedurl_with_postfix (os_debian, OS_Debian_Speed_URL_Postfix);
} }

View File

@ -2,8 +2,6 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define OS_Ubuntu_Speed_URL_Postfix "/dists/noble/Contents-amd64.gz"
def_target(os_ubuntu); def_target(os_ubuntu);
void void
@ -34,47 +32,25 @@ os_ubuntu_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "http://archive.ubuntu.com/ubuntu/", /* 不支持https */ {&upstream, "http://archive.ubuntu.com/ubuntu/", FeedByPrelude}, /* 不支持https */
DelegateToUpstream}, {&MirrorZ, "https://mirrors.cernet.edu.cn/ubuntu/",FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/ubuntu",FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/ubuntu/", {&Volcengine, "https://mirrors.volces.com/ubuntu",FeedByPrelude},
"https://mirrors.cernet.edu.cn/ubuntu/" OS_Ubuntu_Speed_URL_Postfix }, {&Bfsu, "https://mirrors.bfsu.edu.cn/ubuntu",FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/ubuntu",FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/ubuntu", {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/ubuntu",FeedByPrelude},
"https://mirrors.aliyun.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix}, {&Tencent, "https://mirrors.tencent.com/ubuntu", FeedByPrelude},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/ubuntu",FeedByPrelude},
{&Volcengine, "https://mirrors.volces.com/ubuntu", {&Huawei, "https://mirrors.huaweicloud.com/ubuntu",FeedByPrelude}
"https://mirrors.volces.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
{&Bfsu, "https://mirrors.bfsu.edu.cn/ubuntu",
"https://mirrors.bfsu.edu.cn/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
{&Ustc, "https://mirrors.ustc.edu.cn/ubuntu",
"https://mirrors.ustc.edu.cn/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/ubuntu",
"https://mirrors.tuna.tsinghua.edu.cn/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
{&Tencent, "https://mirrors.tencent.com/ubuntu",
{&Tencent, "https://mirrors.tencent.com/ubuntu",
"https://mirrors.tencent.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/ubuntu",
// "https://mirrors.tencentyun.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
{&Huawei, "https://mirrors.huaweicloud.com/ubuntu",
"https://mirrors.huaweicloud.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix}
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/ubuntu", // {&Netease, "https://mirrors.163.com/ubuntu", FeedByPrelude},
// "https://mirrors.163.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix},
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/ubuntu", // {&Sohu, "https://mirrors.sohu.com/ubuntu", FeedByPrelude}
// "https://mirrors.sohu.com/ubuntu" OS_Ubuntu_Speed_URL_Postfix}
def_sources_end() def_sources_end()
chsrc_set_provider_speed_measure_url (&upstream, "http://archive.ubuntu.com/ubuntu/dists/noble/Contents-amd64.gz"); chsrc_set_sources_speed_measure_url_with_postfix (this, "/dists/noble/Contents-amd64.gz");
} }

View File

@ -30,18 +30,18 @@ os_alpine_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "http://dl-cdn.alpinelinux.org/alpine", DelegateToUpstream}, {&upstream, "http://dl-cdn.alpinelinux.org/alpine", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/alpine", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/alpine", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/alpine", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/alpine", FeedByPrelude},
{&Sustech, "https://mirrors.sustech.edu.cn/alpine", DelegateToMirror}, {&Sustech, "https://mirrors.sustech.edu.cn/alpine", FeedByPrelude},
{&Zju, "https://mirrors.zju.edu.cn/alpine", DelegateToMirror}, {&Zju, "https://mirrors.zju.edu.cn/alpine", FeedByPrelude},
{&Lzuoss, "https://mirror.lzu.edu.cn/alpine", DelegateToMirror}, {&Lzuoss, "https://mirror.lzu.edu.cn/alpine", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/alpine", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/alpine", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/alpine", DelegateToMirror}, {&Tencent, "https://mirrors.cloud.tencent.com/alpine", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/alpine", DelegateToMirror} {&Huawei, "https://mirrors.huaweicloud.com/alpine", FeedByPrelude}
def_sources_end() def_sources_end()
chsrc_set_provider_speed_measure_url (&upstream, "https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso"); chsrc_set_sources_speed_measure_url_with_postfix (this, "/latest-stable/releases/x86_64/alpine-standard-3.21.0-x86_64.iso");
} }

View File

@ -30,13 +30,13 @@ os_voidlinux_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "https://repo-default.voidlinux.org", DelegateToUpstream}, {&upstream, "https://repo-default.voidlinux.org", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/voidlinux", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/voidlinux", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/voidlinux", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/voidlinux", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/voidlinux", DelegateToMirror} {&Bfsu, "https://mirrors.bfsu.edu.cn/voidlinux", FeedByPrelude}
def_sources_end() def_sources_end()
chsrc_set_provider_speed_measure_url (&upstream, "https://repo-default.voidlinux.org/live/20240314/void-live-x86_64-musl-20240314-xfce.iso"); chsrc_set_sources_speed_measure_url_with_postfix (this, "/live/20240314/void-live-x86_64-musl-20240314-xfce.iso");
} }

View File

@ -28,12 +28,12 @@ os_almalinux_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "http://repo.almalinux.org/almalinux", DelegateToUpstream}, {&upstream, "http://repo.almalinux.org/almalinux", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/almalinux", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/almalinux", FeedByPrelude},
{&Volcengine, "https://mirrors.volces.com/almalinux", DelegateToMirror}, {&Volcengine, "https://mirrors.volces.com/almalinux", FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/almalinux", DelegateToMirror}, {&Sjtug_Zhiyuan, "https://mirrors.sjtug.sjtu.edu.cn/almalinux", FeedByPrelude},
{&Zju, "https://mirrors.zju.edu.cn/almalinux", DelegateToMirror}, {&Zju, "https://mirrors.zju.edu.cn/almalinux", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/almalinux", DelegateToMirror} {&Nju, "https://mirror.nju.edu.cn/almalinux", FeedByPrelude}
def_sources_end() def_sources_end()
chsrc_set_provider_speed_measure_url (&upstream, "https://raw.repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso"); chsrc_set_provider_speed_measure_url (&upstream, "https://raw.repo.almalinux.org/almalinux/9.5/isos/x86_64/AlmaLinux-9-latest-x86_64-minimal.iso");

View File

@ -31,21 +31,21 @@ os_openeuler_prelude ()
chef_set_note(this, NULL, NULL); chef_set_note(this, NULL, NULL);
def_sources_begin() def_sources_begin()
{&upstream, "https://repo.openeuler.org/", DelegateToUpstream}, {&upstream, "https://repo.openeuler.org/", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/openeuler/", DelegateToMirror}, {&Ali, "https://mirrors.aliyun.com/openeuler/", FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/openeuler/", DelegateToMirror}, {&Bfsu, "https://mirrors.bfsu.edu.cn/openeuler/", FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/openeuler/", DelegateToMirror}, {&Ustc, "https://mirrors.ustc.edu.cn/openeuler/", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/openeuler/", DelegateToMirror}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/openeuler/", FeedByPrelude},
{&Tencent, "https://mirrors.tencent.com/openeuler/", DelegateToMirror} {&Tencent, "https://mirrors.tencent.com/openeuler/", FeedByPrelude}
// {&Tencent_Intra, "https://mirrors.tencentyun.com/openeuler/", DelegateToMirror}, // {&Tencent_Intra, "https://mirrors.tencentyun.com/openeuler/", FeedByPrelude},
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/openeuler/", DelegateToMirror} // {&Netease, "https://mirrors.163.com/openeuler/", FeedByPrelude}
/* 不启用原因:过慢 */ /* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/openeuler/", DelegateToMirror} // {&Sohu, "https://mirrors.sohu.com/openeuler/", FeedByPrelude}
def_sources_end() def_sources_end()
chsrc_set_provider_speed_measure_url (&upstream, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso"); chsrc_set_sources_speed_measure_url_with_postfix (this, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso");
} }