From a7360aac22bfe1c532580b119eb9918bb013d2c2 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 18 Dec 2024 16:55:07 +0800 Subject: [PATCH 1/5] Measure upstream speed for `openEuler` --- src/recipe/os/YUM/openEuler.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index c996ead2..e8086eaa 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -5,16 +5,24 @@ * Contributors : Aoran Zeng * | Yangmoooo * | happy game + * | * Created On : <2023-09-06> * Last Modified : <2024-12-18> * ------------------------------------------------------------*/ +static SourceProvider_t os_Upstream_openEuler = +{ + "upstream", "https://repo.openeuler.org/", "上游默认源 https://repo.openeuler.org/", "https://repo.openeuler.org/", + {NotSkip, NA, NA, "https://repo.openeuler.org/openEuler-24.03-LTS/ISO/x86_64/openEuler-24.03-LTS-netinst-x86_64-dvd.iso"} // 896MB +}; + + /** - * @update 2024-09-14 + * @update 2024-12-18 */ static Source_t os_openeuler_sources[] = { - {&UpstreamProvider, "https://repo.openeuler.org/"}, + {&os_Upstream_openEuler, "https://repo.openeuler.org/"}, {&Ali, "https://mirrors.aliyun.com/openeuler/"}, {&Bfsu, "https://mirrors.bfsu.edu.cn/openeuler/"}, {&Ustc, "https://mirrors.ustc.edu.cn/openeuler/"}, @@ -38,7 +46,7 @@ os_openeuler_setsrc (char *option) chsrc_backup (OS_Yum_SourceList_D OS_openEuler_SourceList); - // 替换 baseurl=<>/openEuler-xx.xx/... + // 替换 baseurl=<>/openEuler-xx.xx/... // openEuler-xx.xx 为 openEuler 版本号 // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=source.url/openEuler-\1/!g' OS_openEuler_SourceList char* cmd = xy_strjoin (6, "sed ", From c11bb287c00fd9938ebe20e3edc28b4cd5680331 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 18 Dec 2024 16:59:14 +0800 Subject: [PATCH 2/5] Add `getsrc` for `openEuler` --- src/recipe/os/YUM/common.h | 5 +++-- src/recipe/os/YUM/openEuler.c | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/recipe/os/YUM/common.h b/src/recipe/os/YUM/common.h index 068c6b5d..a5c20d89 100644 --- a/src/recipe/os/YUM/common.h +++ b/src/recipe/os/YUM/common.h @@ -3,11 +3,12 @@ * ------------------------------------------------------------- * File Authors : Aoran Zeng * Contributors : Nil Null + * | * Created On : <2024-08-16> - * Last Modified : <2024-08-16> + * Last Modified : <2024-12-18> * ------------------------------------------------------------*/ // #define OS_Yum_SourceList "/etc/yum.repos" #define OS_Yum_SourceList_D "/etc/yum.repos.d/" -#define OS_openEuler_SourceList "openEuler.repo" +#define OS_openEuler_SourceList OS_Yum_SourceList_D "openEuler.repo" diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index e8086eaa..d3c6e93f 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -34,8 +34,19 @@ static Source_t os_openeuler_sources[] = }; def_sources_n(os_openeuler); + +/** + * chsrc get openeuler + */ +void +os_openeuler_getsrc (char *option) +{ + chsrc_view_file (OS_openEuler_SourceList); +} + + /** - * @update: 2024-12-18 + * chsrc set openeuler */ void os_openeuler_setsrc (char *option) @@ -44,7 +55,7 @@ os_openeuler_setsrc (char *option) chsrc_yield_source_and_confirm (os_openeuler); - chsrc_backup (OS_Yum_SourceList_D OS_openEuler_SourceList); + chsrc_backup (OS_openEuler_SourceList); // 替换 baseurl=<>/openEuler-xx.xx/... // openEuler-xx.xx 为 openEuler 版本号 @@ -54,7 +65,7 @@ os_openeuler_setsrc (char *option) source.url, "openEuler-\\1", "!g' ", - OS_Yum_SourceList_D OS_openEuler_SourceList); + OS_openEuler_SourceList); chsrc_run (cmd, RunOpt_Default); chsrc_run ("dnf makecache", RunOpt_No_Last_New_Line); @@ -63,4 +74,4 @@ os_openeuler_setsrc (char *option) chsrc_conclude (&source); } -def_target_s(os_openeuler); +def_target_gs(os_openeuler); From 8361699b6eb1bb195cd5821e4934cf9ba932ee7e Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 18 Dec 2024 17:01:15 +0800 Subject: [PATCH 3/5] Add `reset` for `openEuler` --- src/recipe/os/YUM/openEuler.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index d3c6e93f..6aadc94f 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -74,4 +74,15 @@ os_openeuler_setsrc (char *option) chsrc_conclude (&source); } -def_target_gs(os_openeuler); + +/** + * chsrc reset openeuler + */ +void +os_openeuler_resetsrc (char *option) +{ + os_openeuler_setsrc (option); +} + + +def_target_gsr(os_openeuler); From c15dfce337f2da27c99d264379d694f93954f4b7 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 18 Dec 2024 17:03:56 +0800 Subject: [PATCH 4/5] Add feature for `openEuler` --- src/recipe/os/YUM/openEuler.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 6aadc94f..18aff557 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -85,4 +85,25 @@ os_openeuler_resetsrc (char *option) } -def_target_gsr(os_openeuler); +/** + * chsrc ls openeuler + */ +Feature_t +os_openeuler_feat (char *option) +{ + Feature_t f = {0}; + + f.can_get = true; + f.can_reset = true; + + f.cap_locally = CanNot; + f.cap_locally_explain = NULL; + f.can_english = true; + f.can_user_define = true; + + f.note = NULL; + + return f; +} + +def_target_gsrf(os_openeuler); From 716589ff0e87d4572b86d6286d6960a2565ad2e7 Mon Sep 17 00:00:00 2001 From: Aoran Zeng Date: Wed, 18 Dec 2024 18:51:57 +0800 Subject: [PATCH 5/5] Add clearer comment --- src/recipe/os/YUM/openEuler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/recipe/os/YUM/openEuler.c b/src/recipe/os/YUM/openEuler.c index 18aff557..0e734d5c 100644 --- a/src/recipe/os/YUM/openEuler.c +++ b/src/recipe/os/YUM/openEuler.c @@ -59,7 +59,7 @@ os_openeuler_setsrc (char *option) // 替换 baseurl=<>/openEuler-xx.xx/... // openEuler-xx.xx 为 openEuler 版本号 - // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=source.url/openEuler-\1/!g' OS_openEuler_SourceList + // sed -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=$(source.url)/openEuler-\1/!g' OS_openEuler_SourceList char* cmd = xy_strjoin (6, "sed ", "-i -E 's!^baseurl=.*?/openEuler-([^/]+)!baseurl=", source.url,