Repository navigation
Conversation
Use an existing reverse-DNS ID from os-release when it prefixed with the rdns of `HOME_URL` or passes the known-TLD check.
ximion
left a comment
There was a problem hiding this comment.
The tests also look fairly verbose to me, I think it would be nicer to simply test the positive case ("ID is already rDNS") and the negative case ("ID isn't rDNS"), because the other things like invalid IDs are already tested in other parts of the testsuite.
This can also be compacted a lot by just having the test generate the os-release file into a temporary location, then you could just change the values in a loop and make a more compact test with no extra files.
| return priv->os_cid; | ||
| } | ||
|
|
||
| homepage_cid = as_utils_dns_to_rdns (priv->os_homepage, NULL); |
There was a problem hiding this comment.
This looks quite redundant - the logic should be "if the ID already looks like rDNS, we simply copy it over as cid and stop guessing from the homepage". So, something like this would be what I would have in mind here:
/* the OS ID may already be an rDNS ID (e.g. org.freedesktop.platform), don't prefix it again */
if (priv->os_id != NULL) {
g_auto(GStrv) id_parts = g_strsplit (priv->os_id, ".", 3);
if (g_strv_length (id_parts) == 3 && as_utils_is_tld (id_parts[0])) {
priv->os_cid = g_strdup (priv->os_id);
return priv->os_cid;
}
}That way, you can drop the other code and no redundant calls to as_utils_dns_to_rdns happen, that should make this code really small.
Use an existing reverse-DNS ID from os-release when it prefixed with the
rdns of
HOME_URLor passes the known-TLD check.closes #801