Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support get reset ls for openEuler and measure upstream by default #159

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/recipe/os/YUM/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* -------------------------------------------------------------
* File Authors : Aoran Zeng <[email protected]>
* Contributors : Nil Null <[email protected]>
* |
* 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"
67 changes: 59 additions & 8 deletions src/recipe/os/YUM/openEuler.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@
* Contributors : Aoran Zeng <[email protected]>
* | Yangmoooo <[email protected]>
* | happy game <[email protected]>
* |
* 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/",
happy-game marked this conversation as resolved.
Show resolved Hide resolved
{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/"},
Expand All @@ -26,8 +34,19 @@ static Source_t os_openeuler_sources[] =
};
def_sources_n(os_openeuler);


/**
* @update: 2024-12-18
* chsrc get openeuler
*/
void
os_openeuler_getsrc (char *option)
{
chsrc_view_file (OS_openEuler_SourceList);
}


/**
* chsrc set openeuler
*/
void
os_openeuler_setsrc (char *option)
Expand All @@ -36,17 +55,17 @@ 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=<<URL>>/openEuler-xx.xx/...
// 替换 baseurl=<<URL>>/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,
"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);
Expand All @@ -55,4 +74,36 @@ os_openeuler_setsrc (char *option)
chsrc_conclude (&source);
}

def_target_s(os_openeuler);

/**
* chsrc reset openeuler
*/
void
os_openeuler_resetsrc (char *option)
{
os_openeuler_setsrc (option);
}


/**
* 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);