mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-02 15:50:29 +08:00
使用 chef_set_source_url
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
* -------------------------------------------------------------
|
||||
* File Name : chef.c
|
||||
* File Authors : 曾奥然 <ccmywish@qq.com>
|
||||
* Contributors : BingChunMoLi <bingchunmoli@bingchunmoli.com>
|
||||
* File Authors : @ccmywish
|
||||
* Contributors : @BingChunMoLi
|
||||
* Created On : <2025-08-09>
|
||||
* Last Modified : <2025-10-27>
|
||||
* Last Modified : <2026-01-21>
|
||||
*
|
||||
* chef DSL: for chefs (recipe makers) to define a target
|
||||
* ------------------------------------------------------------*/
|
||||
@@ -156,6 +156,29 @@ chef_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 修改 或 补充 某个镜像站的换源链接
|
||||
*
|
||||
* @example 见 os_ubuntu_resetsrc() 中对非 x86_64 架构源地址的修改
|
||||
*/
|
||||
void
|
||||
chef_set_source_url (Target_t *target, SourceProvider_t *provider, char *url)
|
||||
{
|
||||
for (int i=0; i < target->sources_n; i++)
|
||||
{
|
||||
Source_t *src = &target->sources[i];
|
||||
SourceProvider_t *p = src->provider;
|
||||
if (p == provider)
|
||||
{
|
||||
src->url = xy_strdup (url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
xy_unreached();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @note 用于: 组中的 item target 在 standalone 模式时正确填充源信息
|
||||
*/
|
||||
|
||||
@@ -152,8 +152,9 @@ os_ubuntu_resetsrc (char *option)
|
||||
char *arch = chsrc_get_cpuarch ();
|
||||
if (strncmp (arch, "x86_64", 6)!=0)
|
||||
{
|
||||
// ubuntu arm的源地址和x86_64不一样
|
||||
this->sources[0].url = "http://ports.ubuntu.com/ubuntu";
|
||||
// Ubuntu 非 x86_64 架构的源地址有所不同
|
||||
chef_set_source_url (this, &UpstreamProvider, "http://ports.ubuntu.com/ubuntu");
|
||||
// this->sources[0].url = "http://ports.ubuntu.com/ubuntu";
|
||||
}
|
||||
os_ubuntu_setsrc (option);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user