pakfire_parser_set(parser, NULL, "DISTRO_RELEASE", version_id, 0);
// Set DISTRO_DISTTAG
- if (id && version_id) {
- pakfire_string_format(buffer, "%s%s", id, version_id);
-
- pakfire_parser_set(parser, NULL, "DISTRO_DISTTAG", buffer, 0);
- }
+ const char* tag = pakfire_get_distro_tag(pakfire);
+ if (tag)
+ pakfire_parser_set(parser, NULL, "DISTRO_DISTTAG", tag, 0);
// Set DISTRO_VENDOR
const char* vendor = pakfire_get_distro_vendor(pakfire);
const char* pakfire_get_distro_vendor(struct pakfire* pakfire);
const char* pakfire_get_distro_version(struct pakfire* pakfire);
const char* pakfire_get_distro_version_id(struct pakfire* pakfire);
+const char* pakfire_get_distro_tag(struct pakfire* pakfire);
const char* pakfire_get_keystore_path(struct pakfire* pakfire);
char version[64];
char version_codename[32];
char version_id[8];
+ char tag[40];
} distro;
// GPG Context
return NULL;
}
+const char* pakfire_get_distro_tag(struct pakfire* pakfire) {
+ int r;
+
+ if (*pakfire->distro.tag)
+ return pakfire->distro.tag;
+
+ const char* id = pakfire_get_distro_id(pakfire);
+ const char* version_id = pakfire_get_distro_version_id(pakfire);
+
+ // Break if the configuration is incomplete
+ if (!id || !version_id) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ // Format string
+ r = pakfire_string_format(pakfire->distro.tag, "%s%s", id, version_id);
+ if (r)
+ return NULL;
+
+ // Return the tag
+ return pakfire->distro.tag;
+}
+
static int pakfire_config_import_distro(struct pakfire* pakfire) {
// Nothing to do if there is no distro section
if (!pakfire_config_has_section(pakfire->config, "distro"))