From 47d580f9de23ef1ef5e71f054ea893b23702e097 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 24 Aug 2016 04:01:44 +0200 Subject: Create a test that validates projects' appstream information At the moment, we're validating it in build.kde.org, but I feel it will be easier for developers to test if we do so locally. This patch does it by seeing which *.appdata.xml files are being installed and validating them. This way we can keep it generic for all KDE projects. REVIEW: 128533 --- kde-modules/appstreamtest.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 kde-modules/appstreamtest.cmake (limited to 'kde-modules/appstreamtest.cmake') 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() -- cgit v1.2.1