Skip to content

Commit

Permalink
Only emit legacy compat tag developer_name for catalog data
Browse files Browse the repository at this point in the history
Resolves: #631
  • Loading branch information
ximion committed May 2, 2024
1 parent 5920761 commit 6ed8a98
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/as-component.c
Original file line number Diff line number Diff line change
Expand Up @@ -4967,8 +4967,11 @@ xmlNode *
as_component_to_xml_node (AsComponent *cpt, AsContext *ctx, xmlNode *root)
{
AsComponentPrivate *priv = GET_PRIVATE (cpt);
AsFormatStyle format_style;
xmlNode *cnode;

format_style = as_context_get_style (ctx);

/* define component root node properties */
if (root == NULL)
cnode = xmlNewNode (NULL, (xmlChar *) "component");
Expand All @@ -4990,7 +4993,7 @@ as_component_to_xml_node (AsComponent *cpt, AsContext *ctx, xmlNode *root)
as_xml_add_text_prop (cnode, "date_eol", time_str);
}

if (as_context_get_style (ctx) == AS_FORMAT_STYLE_CATALOG) {
if (format_style == AS_FORMAT_STYLE_CATALOG) {
/* write some propties which only exist in catalog XML */
if (priv->merge_kind != AS_MERGE_KIND_NONE) {
as_xml_add_text_prop (cnode,
Expand Down Expand Up @@ -5020,7 +5023,7 @@ as_component_to_xml_node (AsComponent *cpt, AsContext *ctx, xmlNode *root)
as_xml_add_localized_text_node (cnode, "summary", priv->summary);

/* order license and project group after name/summary */
if (as_context_get_style (ctx) == AS_FORMAT_STYLE_METAINFO)
if (format_style == AS_FORMAT_STYLE_METAINFO)
as_xml_add_text_node (cnode, "metadata_license", priv->metadata_license);

/* project license */
Expand All @@ -5036,7 +5039,8 @@ as_component_to_xml_node (AsComponent *cpt, AsContext *ctx, xmlNode *root)
if (priv->developer != NULL) {
as_developer_to_xml_node (priv->developer, ctx, cnode);

if (as_context_get_format_version (ctx) <= AS_FORMAT_VERSION_V1_0) {
if (format_style == AS_FORMAT_STYLE_CATALOG &&
as_context_get_format_version (ctx) <= AS_FORMAT_VERSION_V1_0) {
/* Add the deprecated tag for now, for improved backwards compatibility */
as_xml_add_text_node (
cnode,
Expand Down

0 comments on commit 6ed8a98

Please sign in to comment.