Simplify chef api

This commit is contained in:
Aoran Zeng 2025-08-09 20:58:50 +08:00
parent 23ba6b8419
commit 1f1008c440
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
2 changed files with 28 additions and 42 deletions

View File

@ -46,6 +46,11 @@ chef_ensure_trailing_slash (char *str)
} }
#define chef_has_getfn() this->getfn = t##_getsrc;
#define chef_has_setfn() this->setfn = t##_setsrc;
#define chef_has_resetsrc() this->resetfn = t##_resetsrc;
void void
chef_set_contributors (Target_t *target, uint32_t count, ...) chef_set_contributors (Target_t *target, uint32_t count, ...)
{ {
@ -70,7 +75,7 @@ chef_set_contributors (Target_t *target, uint32_t count, ...)
void void
chef_set_recipe_authors (Target_t *target, size_t count, ...) chef_set_authors (Target_t *target, size_t count, ...)
{ {
if (!target || count == 0) if (!target || count == 0)
return; return;
@ -95,7 +100,7 @@ chef_set_recipe_authors (Target_t *target, size_t count, ...)
void void
chef_set_current_chef (Target_t *target, char *name, char *email) chef_set_chef (Target_t *target, char *name, char *email)
{ {
if (!target || !name || !email) if (!target || !name || !email)
return; return;
@ -107,7 +112,7 @@ chef_set_current_chef (Target_t *target, char *name, char *email)
void void
chef_set_current_sous_chefs (Target_t *target, size_t count, ...) chef_set_sous_chefs (Target_t *target, size_t count, ...)
{ {
if (!target) if (!target)
return; return;
@ -139,7 +144,7 @@ chef_set_current_sous_chefs (Target_t *target, size_t count, ...)
void void
chef_set_recipe_created_on_date (Target_t *target, char *date) chef_set_created_on (Target_t *target, char *date)
{ {
if (!target) if (!target)
return; return;
@ -149,7 +154,7 @@ chef_set_recipe_created_on_date (Target_t *target, char *date)
void void
chef_set_recipe_last_updated_date (Target_t *target, char *date) chef_set_last_updated (Target_t *target, char *date)
{ {
if (!target) if (!target)
return; return;
@ -159,7 +164,7 @@ chef_set_recipe_last_updated_date (Target_t *target, char *date)
void void
chef_set_sources_last_updated_date (Target_t *target, char *date) chef_set_sources_last_updated (Target_t *target, char *date)
{ {
if (!target) if (!target)
return; return;

View File

@ -9,18 +9,29 @@ wr_flathub_prelude ()
{ {
use_this(wr_flathub); use_this(wr_flathub);
chef_set_recipe_created_on_date (this, "2023-09-11"); chef_set_created_on (this, "2023-09-11");
chef_set_recipe_last_updated_date (this, "2025-08-09"); chef_set_last_updated (this, "2025-08-09");
chef_set_recipe_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com"); chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_current_chef (this, NULL, NULL); chef_set_chef (this, NULL, NULL);
chef_set_current_sous_chefs (this, 0); chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1, chef_set_contributors (this, 1,
"Jialin Lyu", "jialinlvcn@aliyun.com"); "Jialin Lyu", "jialinlvcn@aliyun.com");
chef_set_sources_last_updated_date (this, "2025-05-27"); chef_has_getfn();
chef_has_setfn();
chef_has_resetsrc();
this.cap_locally = CanNot;
this.cap_locally_explain = NULL;
this.can_english = false;
this.can_user_define = true;
this.note = "对Flathub目标进行测速的文件非常小测速效果严重失真若你知道可供测速的URL欢迎参与贡献: chsrc issue";
chef_set_sources_last_updated (this, "2025-05-27");
def_upstream_provider("https://flathub.org/repo"); def_upstream_provider("https://flathub.org/repo");
def_sources_begin() def_sources_begin()
@ -48,9 +59,6 @@ wr_flathub_prelude ()
} }
/**
* chsrc get flathub
*/
void void
wr_flathub_getsrc (char *option) wr_flathub_getsrc (char *option)
{ {
@ -88,35 +96,8 @@ wr_flathub_setsrc (char *option)
} }
/**
* chsrc reset flathub
*/
void void
wr_flathub_resetsrc (char *option) wr_flathub_resetsrc (char *option)
{ {
wr_flathub_setsrc (option); wr_flathub_setsrc (option);
} }
/**
* chsrc ls flathub
*/
Feature_t
wr_flathub_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 = false;
f.can_user_define = true;
f.note = "对Flathub目标进行测速的文件非常小测速效果严重失真若你知道可供测速的URL欢迎参与贡献: chsrc issue";
return f;
}
// def_target_gsrf (wr_flathub);