From da431580d4b1cb7d3c40808e5d029b2784f68e61 Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 11 Oct 2022 20:05:02 +0200 Subject: [PATCH] Prevent AppStream validation error `asv-cid-desktopapp-is-not-rdns` See https://github.com/Martchus/syncthingtray/issues/158 --- cmake/modules/BasicConfig.cmake | 13 +++++++++++++ cmake/templates/appdata.xml.in | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 5de5f29..e91ef52 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -174,6 +174,19 @@ if (NOT META_PROJECT_LICENSE) endif () endif () +# determine RDNS automatically from other meta-data +if (NOT META_PROJECT_RDNS) + if (NOT META_PROJECT_RDNS_BASE) + if (META_APP_URL MATCHES ".*github\\.com.*") + set(META_PROJECT_RDNS_BASE "io.github") # assume GitHub pages + else () + set(META_PROJECT_RDNS_BASE "org") + endif () + endif () + string(TOLOWER "${META_APP_AUTHOR}" META_APP_AUTHOR_LOWER) + set(META_PROJECT_RDNS "${META_PROJECT_RDNS_BASE}.${META_APP_AUTHOR_LOWER}.${META_PROJECT_NAME}${TARGET_SUFFIX}") +endif () + # provide variables for other projects built as part of the same subdirs project to access files from this project get_directory_property(HAS_PARENT PARENT_DIRECTORY) if (HAS_PARENT) diff --git a/cmake/templates/appdata.xml.in b/cmake/templates/appdata.xml.in index 35772fa..91f8eaa 100644 --- a/cmake/templates/appdata.xml.in +++ b/cmake/templates/appdata.xml.in @@ -1,6 +1,6 @@ - @META_ID@ + @META_PROJECT_RDNS@ MIT @META_PROJECT_LICENSE@ @META_APP_NAME@