Include appstreamcli in ancillary files check
authorColin Clark <colin.clark@cclark.uk>
Wed, 13 Mar 2024 09:50:29 +0000 (09:50 +0000)
committerColin Clark <colin.clark@cclark.uk>
Wed, 13 Mar 2024 09:50:29 +0000 (09:50 +0000)
appstreamcli is used to lint org.geeqie.Geeqie.appdata.xml.in

.github/workflows/check-build-actions.yml
scripts/test-ancillary-files.sh

index 955a9e5..53a8e30 100644 (file)
@@ -22,6 +22,7 @@ jobs:
     runs-on: ubuntu-22.04
     steps:
     - run: sudo apt-get update
+    - run: sudo apt-get install appstream
     - run: sudo apt-get install build-essential libgtk-3-dev libgtk-3-bin
     - run: sudo apt-get install at-spi2-core
     - run: sudo apt-get install desktop-file-utils
@@ -74,6 +75,7 @@ jobs:
     runs-on: ubuntu-22.04
     steps:
     - run: sudo apt-get update
+    - run: sudo apt-get install appstream
     - run: sudo apt-get install at-spi2-core
     - run: sudo apt-get install build-essential libgtk-3-dev libgtk-3-bin
     - run: sudo apt-get install clang-tidy
index bc59396..4325b75 100755 (executable)
@@ -25,6 +25,7 @@
 ## $1 Root of project sources
 ##
 ## Perform validity checks on project ancillary files:
+## appdata
 ## desktop
 ## scripts
 ## ui
@@ -209,4 +210,28 @@ $(find . -name "*.desktop.in")
 EOF
 fi
 
+# Appdata lint
+if [ -z "$(command -v appstreamcli)" ]
+then
+       printf "ERROR: appstreamcli is not installed"
+       exit_status=1
+else
+       if ! result=$(appstreamcli validate org.geeqie.Geeqie.appdata.xml.in --pedantic --explain)
+       then
+               exit_status=1
+               status="Error"
+       else
+               line_count=$(echo "$result" | wc --lines)
+
+               if [ "$line_count" -gt 1 ]
+               then
+                       status="Warning"
+               else
+                       status="Passed"
+               fi
+       fi
+
+       printf "%s: appstreamcli in org.geeqie.Geeqie.appdata.xml.in: \n%s\n" "$status" "$result"
+fi
+
 exit "$exit_status"