Warning, /frameworks/kpackage/autotests/kpackagetoolappstreamtest.cmake is written in an unsupported language. File is not indexed.
0001 get_filename_component(generated_name ${generated} NAME) 0002 0003 if(NOT ${generated_name} STREQUAL "testpackage.appdata.xml") 0004 message(STATUS "cd ${input} ; ${kpackagetool} --appstream-metainfo . --appstream-metainfo-output ${generated}") 0005 execute_process(COMMAND ${kpackagetool} --appstream-metainfo . --appstream-metainfo-output "${generated}" 0006 WORKING_DIRECTORY ${input} 0007 ERROR_VARIABLE std_error_output) 0008 else() 0009 message(STATUS "cd ${input} ; ${kpackagetool} --appstream-metainfo .") 0010 # Make sure that without output argument we get the output on STDOUT. 0011 # This only runs on the testpackage test. 0012 execute_process(COMMAND ${kpackagetool} --appstream-metainfo . 0013 WORKING_DIRECTORY ${input} 0014 OUTPUT_FILE "${generated}" 0015 ERROR_VARIABLE std_error_output) 0016 endif() 0017 0018 if (std_error_output) 0019 message(STATUS "${std_error_output}") 0020 endif() 0021 0022 # We'll want no generated output file at all on NoDisplay. For other tests we'll want to compare 0023 # the expected with the generated output. 0024 if(${generated_name} STREQUAL "testpackage-nodisplay.appdata.xml") 0025 if(EXISTS "${generated}") 0026 message(FATAL_ERROR "expected file ${output} does not exist, but one was generated at ${generated}") 0027 endif() 0028 else() 0029 execute_process(COMMAND cmake -E compare_files ${output} ${generated} ERROR_VARIABLE error_compare) 0030 if (error_compare) 0031 message(FATAL_ERROR "error on compare: ${error_compare}") 0032 endif() 0033 endif() 0034 0035 # Make sure the standard test passes appstream validation. 0036 if(${generated_name} STREQUAL "testpackage.appdata.xml") 0037 find_program(APPSTREAMCLI appstreamcli) 0038 if(APPSTREAMCLI) 0039 execute_process(COMMAND ${APPSTREAMCLI} validate ${generated} 0040 ERROR_VARIABLE appstream_stderr 0041 OUTPUT_VARIABLE appstream_stdout 0042 RESULT_VARIABLE result 0043 ) 0044 if(NOT result EQUAL 0) 0045 message(FATAL_ERROR "appstream data seems to be imperfect: ${appstream_stderr} ${appstream_stdout}") 0046 endif() 0047 else() 0048 message(WARNING "skipping appstream validation as no appstreamcli binary was found") 0049 endif() 0050 endif()