From: Michael Tremer Date: Mon, 1 Mar 2021 18:05:01 +0000 (+0000) Subject: parser: Handle appending variables correctly X-Git-Tag: 0.9.28~1285^2~670 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ec0f04197261871ebc2ffe940bff3146073e4532;p=pakfire.git parser: Handle appending variables correctly Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/parser.h b/src/libpakfire/include/pakfire/parser.h index 78f33c58a..43d763fc9 100644 --- a/src/libpakfire/include/pakfire/parser.h +++ b/src/libpakfire/include/pakfire/parser.h @@ -75,6 +75,7 @@ struct pakfire_parser_declaration { enum flags { PAKFIRE_PARSER_DECLARATION_NONE = 0, PAKFIRE_PARSER_DECLARATION_EXPORT = (1 << 0), + PAKFIRE_PARSER_DECLARATION_APPEND = (1 << 1), } flags; }; diff --git a/src/libpakfire/parser.c b/src/libpakfire/parser.c index 353d04f9e..ff621c187 100644 --- a/src/libpakfire/parser.c +++ b/src/libpakfire/parser.c @@ -209,6 +209,9 @@ PAKFIRE_EXPORT int pakfire_parser_set(PakfireParser parser, const char* name, co int pakfire_parser_apply_declaration(PakfireParser parser, struct pakfire_parser_declaration* declaration) { + if (declaration->flags & PAKFIRE_PARSER_DECLARATION_APPEND) + return pakfire_parser_append(parser, declaration->name, declaration->value); + return pakfire_parser_set(parser, declaration->name, declaration->value); } diff --git a/src/libpakfire/parser/grammar.y b/src/libpakfire/parser/grammar.y index d1e210fb8..182574301 100644 --- a/src/libpakfire/parser/grammar.y +++ b/src/libpakfire/parser/grammar.y @@ -218,8 +218,8 @@ declaration : key T_ASSIGN value T_EOL } | key T_APPEND value T_EOL { - // XXX HANDLE APPEND PROPERLY - int r = pakfire_parser_new_declaration(&$$, $1, $3, 0); + int r = pakfire_parser_new_declaration(&$$, $1, $3, + PAKFIRE_PARSER_DECLARATION_APPEND); if (r) ABORT; }