aboutsummaryrefslogtreecommitdiff
path: root/kde-modules/appstreamtest.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'kde-modules/appstreamtest.cmake')
-rw-r--r--kde-modules/appstreamtest.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/kde-modules/appstreamtest.cmake b/kde-modules/appstreamtest.cmake
new file mode 100644
index 00000000..e524bacb
--- /dev/null
+++ b/kde-modules/appstreamtest.cmake
@@ -0,0 +1,27 @@
+file(READ "${INSTALL_FILES}" out)
+string(REPLACE "\n" ";" out "${out}")
+
+set(metadatafiles)
+foreach(file IN LISTS out)
+ if(NOT (file MATCHES ".+\\.appdata.xml" OR file MATCHES ".+\\.metainfo.xml"))
+ continue()
+ endif()
+
+ list(APPEND metadatafiles ${file})
+endforeach()
+
+if(metadatafiles)
+ set(appstreamcliout "")
+ execute_process(COMMAND ${APPSTREAMCLI} validate ${metadatafiles}
+ ERROR_VARIABLE appstreamcliout
+ OUTPUT_VARIABLE appstreamcliout
+ RESULT_VARIABLE result
+ )
+
+ if(result EQUAL 0)
+ set(msgType STATUS)
+ else()
+ set(msgType FATAL_ERROR)
+ endif()
+ message(${msgType} ${appstreamcliout})
+endif()