summarylogtreecommitdiffstats
path: root/0002-Enable-AppStream-tests-only-by-default-via-ENABLE_DE.patch
blob: be676b3d7a43563c5034ba875f9b2a725003eb41 (plain)
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
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