File: appstreamtest.cmake

package info (click to toggle)
kf6-extra-cmake-modules 6.22.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,608 kB
  • sloc: python: 668; cpp: 330; ansic: 291; xml: 182; sh: 62; makefile: 8
file content (39 lines) | stat: -rw-r--r-- 957 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
cmake_policy(VERSION 3.16)

file(GLOB install_done "${INSTALL_FILES}")
if (install_done)
    file(READ "${INSTALL_FILES}" out)
    string(REPLACE "\n" ";" out "${out}")
else()
    message("Not installed yet, skipping")
    set(out "")
endif()

set(metadatafiles)
foreach(file IN LISTS out)
    if(NOT (file MATCHES ".+\\.appdata.xml" OR file MATCHES ".+\\.metainfo.xml"))
        continue()
    endif()

    if(EXISTS ${file})
        list(APPEND metadatafiles ${file})
    else()
        message(WARNING "Could not find ${file}")
    endif()
endforeach()

if(metadatafiles)
    set(appstreamcliout "")
    execute_process(COMMAND ${APPSTREAMCLI} validate --no-net ${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()