Add sources prepare for Debian

This commit is contained in:
Aoran Zeng
2025-07-11 19:43:39 +08:00
parent 6e2b33269a
commit 6e40cfe238
3 changed files with 67 additions and 13 deletions

View File

@@ -818,6 +818,42 @@ 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 || !is_url(src->speed_measure_url))
src->speed_measure_url = xy_2strjoin (src->url, postfix);
}
}
}
/** /**
* 自动测速选择镜像站和源 * 自动测速选择镜像站和源
*/ */

View File

@@ -92,6 +92,8 @@ Source_t;
#define DelegateToMirror NULL #define DelegateToMirror NULL
/* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */ /* 看到该注释的贡献者,你可以帮忙寻找专用测速链接 */
#define NeedContribute NULL #define NeedContribute NULL
/* 由 _sources_prepare 填充 */
#define FeedBySourcesPrepare 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

@@ -8,9 +8,11 @@
* | * |
* Created On : <2023-09-02> * Created On : <2023-09-02>
* Major Revision : 3 * Major Revision : 3
* Last Modified : <2025-06-16> * Last Modified : <2025-07-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
#define OS_Debian_Speed_URL_Postfix "/dists/bookworm/main/Contents-all.gz"
static SourceProvider_t os_debian_upstream = static SourceProvider_t os_debian_upstream =
{ {
def_upstream, "https://ftp.debian.org/debian/", def_upstream, "https://ftp.debian.org/debian/",
@@ -19,25 +21,39 @@ static SourceProvider_t os_debian_upstream =
/** /**
* @update 2024-11-21 * @update 2025-07-11
*/ */
static Source_t os_debian_sources[] = static Source_t os_debian_sources[] =
{ {
{&os_debian_upstream, "http://deb.debian.org/debian"}, {&os_debian_upstream, "http://deb.debian.org/debian", DelegateToUpstream},
{&MirrorZ, "https://mirrors.cernet.edu.cn/debian/"},
{&Ali, "https://mirrors.aliyun.com/debian"}, /* MirrorZ 的速度这么测也是可以的 */
{&Volcengine, "https://mirrors.volces.com/debian"}, {&MirrorZ, "https://mirrors.cernet.edu.cn/debian/", FeedBySourcesPrepare },
{&Bfsu, "https://mirrors.bfsu.edu.cn/debian"}, {&Ali, "https://mirrors.aliyun.com/debian", FeedBySourcesPrepare},
{&Ustc, "https://mirrors.ustc.edu.cn/debian"}, {&Volcengine, "https://mirrors.volces.com/debian", FeedBySourcesPrepare},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian"}, {&Bfsu, "https://mirrors.bfsu.edu.cn/debian", FeedBySourcesPrepare},
{&Tencent, "https://mirrors.tencent.com/debian"}, {&Ustc, "https://mirrors.ustc.edu.cn/debian", FeedBySourcesPrepare},
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian"}, {&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/debian", FeedBySourcesPrepare},
// {&Netease, "https://mirrors.163.com/debian"}, /* 不启用原因:过慢 */ {&Tencent, "https://mirrors.tencent.com/debian", FeedBySourcesPrepare},
// {&Sohu, "https://mirrors.sohu.com/debian"} /* 不启用原因:过慢 */
// {&Tencent_Intra, "https://mirrors.tencentyun.com/debian", FeedBySourcesPrepare},
/* 不启用原因:过慢 */
// {&Netease, "https://mirrors.163.com/debian", FeedBySourcesPrepare},
/* 不启用原因:过慢 */
// {&Sohu, "https://mirrors.sohu.com/debian", FeedBySourcesPrepare}
}; };
def_sources_n(os_debian); def_sources_n(os_debian);
void
os_debian_sources_prepare ()
{
chsrc_sources_prepare_speedurl_with_postfix (os_debian, OS_Debian_Speed_URL_Postfix);
}
void void
os_debian_getsrc (char *option) os_debian_getsrc (char *option)
{ {