PKGBUILDs/c++utilities/default/0002-Enable-AppStream-tests...

36 lines
1.4 KiB
Diff

From 8fb7de6fe0ce506d1521f586ab841266b2783ef8 Mon Sep 17 00:00:00 2001
From: Martchus <martchus@gmx.net>
Date: Wed, 22 Nov 2023 12:59:20 +0100
Subject: [PATCH 2/2] Enable AppStream tests only by default via
`ENABLE_DEVEL_DEFAULTS`
This test already fails on deprecations so it is likely not a good idea to
run it in general as it would cause needless failures.
---
cmake/modules/AppUtilities.cmake | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmake/modules/AppUtilities.cmake b/cmake/modules/AppUtilities.cmake
index 9a46b48..2272431 100644
--- a/cmake/modules/AppUtilities.cmake
+++ b/cmake/modules/AppUtilities.cmake
@@ -80,9 +80,14 @@ function (add_appstream_file)
COMPONENT appimage)
# add test
+ set(APPSTREAM_TESTS_ENABLED_DEFAULT OFF)
find_program(APPSTREAMCLI_BIN "appstreamcli")
+ if (ENABLE_DEVEL_DEFAULTS AND APPSTREAMCLI_BIN)
+ set(APPSTREAM_TESTS_ENABLED_DEFAULT ON)
+ endif ()
+ option(APPSTREAM_TESTS_ENABLED "enables tests for checking whether AppStream files" "${APPSTREAM_TESTS_ENABLED_DEFAULT}")
if (NOT APPSTREAMCLI_BIN)
- message(STATUS "Could not find appstreamcli; won't add test/target to validate appstream files")
+ message(FATAL_ERROR "Unable to validate appstreamcli files; appstreamcli not found")
else ()
add_test(NAME "${META_TARGET_NAME}_appstream_validation" COMMAND "${APPSTREAMCLI_BIN}" validate "${APPSTREAM_FILE}")
endif ()
--
2.42.1