new: add nogen key to the target

This commit is contained in:
ngn 2024-05-04 20:29:35 +03:00
parent 9e8f57c175
commit dbaf581335
4 changed files with 27 additions and 21 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-05-02 23:20+0300\n" "POT-Creation-Date: 2024-05-04 20:25+0300\n"
"PO-Revision-Date: 2024-05-01 13:34+0300\n" "PO-Revision-Date: 2024-05-01 13:34+0300\n"
"Last-Translator: <ngn@ngn.tf>\n" "Last-Translator: <ngn@ngn.tf>\n"
"Language-Team: Turkish <gnome-turk@gnome.org>\n" "Language-Team: Turkish <gnome-turk@gnome.org>\n"
@ -33,32 +33,32 @@ msgstr ""
msgid "Configuration contains multiple targets with the same name" msgid "Configuration contains multiple targets with the same name"
msgstr "" msgstr ""
#: src/config.c:116 #: src/config.c:119
#, c-format #, c-format
msgid "Key %s is unknown" msgid "Key %s is unknown"
msgstr "" msgstr ""
#: src/config.c:146 #: src/config.c:149
msgid "Configuration file not found" msgid "Configuration file not found"
msgstr "" msgstr ""
#: src/config.c:161 #: src/config.c:164
msgid "Failed to parse configuration file" msgid "Failed to parse configuration file"
msgstr "" msgstr ""
#: src/config.c:177 #: src/config.c:180
msgid "Configuration details:\n" msgid "Configuration details:\n"
msgstr "" msgstr ""
#: src/config.c:178 src/target.c:119 #: src/config.c:181 src/target.c:122
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: src/config.c:179 #: src/config.c:182
msgid "Author" msgid "Author"
msgstr "" msgstr ""
#: src/config.c:181 #: src/config.c:184
msgid "Keywords" msgid "Keywords"
msgstr "" msgstr ""
@ -224,16 +224,16 @@ msgstr ""
msgid "Failed to open the directory: %s" msgid "Failed to open the directory: %s"
msgstr "" msgstr ""
#: src/target.c:81 #: src/target.c:84
#, c-format #, c-format
msgid "Source directory \"%s\" does not exist" msgid "Source directory \"%s\" does not exist"
msgstr "" msgstr ""
#: src/target.c:118 #: src/target.c:121
msgid "Target details:\n" msgid "Target details:\n"
msgstr "" msgstr ""
#: src/target.c:120 #: src/target.c:123
msgid "Description" msgid "Description"
msgstr "" msgstr ""

View File

@ -107,8 +107,11 @@ int config_handler(void *data, const char *section, const char *key, const char
} else if (MATCHKEY("src")) { } else if (MATCHKEY("src")) {
config->t_last->src = strdup(value); config->t_last->src = strdup(value);
return 1; return 1;
} else if (MATCHKEY("requires")) { } else if (MATCHKEY("require")) {
clist_from_str(&config->t_last->requires, strdup(value)); clist_from_str(&config->t_last->require, strdup(value));
return 1;
} else if (MATCHKEY("nogen")) {
config->t_last->nogen = eq((char *)value, "true");
return 1; return 1;
} }

View File

@ -72,6 +72,9 @@ bool target_copy(target_t *t, bool fromdst) {
char *src = t->src, *dst = t->dst; char *src = t->src, *dst = t->dst;
bool ret = false; bool ret = false;
if (fromdst && t->nogen)
return true;
if (fromdst) { if (fromdst) {
src = t->dst; src = t->dst;
dst = t->src; dst = t->src;
@ -98,7 +101,7 @@ bool target_copy(target_t *t, bool fromdst) {
} }
void target_init(target_t *t) { void target_init(target_t *t) {
clist_init(&t->requires); clist_init(&t->require);
t->next = NULL; t->next = NULL;
t->name = NULL; t->name = NULL;
t->desc = NULL; t->desc = NULL;
@ -111,7 +114,7 @@ void target_free(target_t *t) {
free(t->desc); free(t->desc);
free(t->dst); free(t->dst);
free(t->src); free(t->src);
clist_free(&t->requires); clist_free(&t->require);
} }
void target_print(target_t *t) { void target_print(target_t *t) {

View File

@ -3,12 +3,12 @@
typedef struct target { typedef struct target {
struct target *next; struct target *next;
clist_t clist_t require;
requires; bool nogen;
char *name; char *name;
char *desc; char *desc;
char *src; char *src;
char *dst; char *dst;
} target_t; } target_t;
bool target_is_valid(target_t *); bool target_is_valid(target_t *);