File: 03_compose-lowercase-cids.patch

package info (click to toggle)
appstream 0.16.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 15,140 kB
  • sloc: ansic: 46,770; xml: 10,353; cpp: 3,864; sh: 252; python: 232; makefile: 18
file content (47 lines) | stat: -rw-r--r-- 1,656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From d3109b7a19fb8760904b35638670d5fbc1409c3c Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <mak@debian.org>
Date: Sun, 28 May 2023 17:07:18 +0200
Subject: [PATCH] compose: Set lower-cased cid for synthesized components again

This is a regression from previous appstream-generator behavior that
caused GCIDs and CIDs to no longer match, yielding all kinds of weird
behavior.
It also broke the Ratings & Reviews associations.
---
 compose/asc-utils-metainfo.c | 3 ++-
 src/as-desktop-entry.c       | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/compose/asc-utils-metainfo.c b/compose/asc-utils-metainfo.c
index 179f861..9c76061 100644
--- a/compose/asc-utils-metainfo.c
+++ b/compose/asc-utils-metainfo.c
@@ -344,7 +344,8 @@ asc_parse_desktop_entry_data (AscResult *cres,
 	gsize data_len;
 	gboolean ret;
 
-
+	/* NOTE: The cid needs to be the exact desktop-entry name briefly, as as_desktop_entry_parse_data
+	 * uses it to synthesize a Launchable. We can reset it later. */
 	if (cpt != NULL) {
 		ncpt = g_object_ref (cpt);
 		prev_cid = g_strdup (as_component_get_id (cpt));
diff --git a/src/as-desktop-entry.c b/src/as-desktop-entry.c
index e030b03..ea06f8e 100644
--- a/src/as-desktop-entry.c
+++ b/src/as-desktop-entry.c
@@ -400,6 +400,11 @@ as_desktop_entry_parse_data (AsComponent *cpt,
 
 				as_component_set_id (cpt, id_raw);
 			}
+		} else {
+			/* for components synthesized from desktop-entry files, that we can't guess
+			 * a rDNS ID for, we need a lower-cased ID instead */
+			g_autofree gchar *cid_low = g_utf8_strdown (desktop_basename, -1);
+			as_component_set_id (cpt, cid_low);
 		}
 	}
 
-- 
2.39.2