From: Michael Tremer Date: Fri, 5 Mar 2021 16:51:21 +0000 (+0000) Subject: parser: Add more string attributes to the package X-Git-Tag: 0.9.28~1285^2~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f00837c0f08fd1b9cb9b2ea5e98ad73a4ee17f24;p=pakfire.git parser: Add more string attributes to the package Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/parser.c b/src/libpakfire/parser.c index 09c503824..d9d43de53 100644 --- a/src/libpakfire/parser.c +++ b/src/libpakfire/parser.c @@ -784,6 +784,30 @@ PAKFIRE_EXPORT int pakfire_parser_create_package(PakfireParser parser, pakfire_package_set_uuid(*pkg, uuid); free(uuid); + // Assign more attributes + const struct attribute { + const char* name; + void(*func)(PakfirePackage pkg, const char* value); + } attributes[] = { + { "summary", pakfire_package_set_summary, }, + { "description", pakfire_package_set_description, }, + { "license", pakfire_package_set_license, }, + { "url", pakfire_package_set_url, }, + { "groups", pakfire_package_set_groups, }, + { "vendor", pakfire_package_set_vendor, }, + { "maintainer", pakfire_package_set_maintainer, }, + { NULL }, + }; + + for (const struct attribute* a = attributes; a->name; a++) { + char* value = pakfire_parser_get(parser, namespace, a->name); + if (!value) + continue; + + a->func(*pkg, value); + free(value); + } + // All okay r = 0;