2 #**********************************************************************
3 # Copyright (C) 2024 - The Geeqie Team
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #**********************************************************************
23 ## @brief Perform validity checks on project ancillary files
25 ## $1 Root of project sources
27 ## Perform validity checks on project ancillary files:
36 if [ ! -d "src" ] || [ ! -f "geeqie.1" ]
38 printf '%s\n' "This is not a Geeqie project folder"
44 # Script files must have the file extension .sh or
45 # be symlinked as so - for doxygen
49 result=$(file "$file" | grep "POSIX shell script")
53 base_with_sh=$(basename "$file")
54 base_without_sh=$(basename "$file" .sh)
56 if [ "$base_with_sh" = "$base_without_sh" ]
58 if [ ! -f "$file.sh" ]
60 printf "ERROR; Executable script does not have a .sh extension: %s\n" "$file"
66 $(find "$1/plugins" "$1/src" "$1/scripts" -type f -executable)
69 # Check if all options are in the disabled checks
74 res=$(grep "$line" "$1/scripts/test-all.sh")
77 printf "ERROR; Option no disabled check in ./scripts/test-all.sh: %s\n" "$line"
82 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
85 # Check if all options are in the disabled checks in a GitHub run
86 # Directory .github is not in the source tar
93 res=$(grep "\-D$line=disabled" "$1/.github/workflows/check-build-actions.yml")
96 printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
101 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
106 # Runs as a GitHub Action
107 if [ -z "$GITHUB_WORKSPACE" ]
109 if [ -z "$(command -v mdl)" ]
111 printf "ERROR: mdl is not installed"
118 if [ "${line#*": MD"}" != "$line" ]
120 printf "ERROR; Markdown lint error in: %s\n" "$line"
125 $(find . -not -path "*/.*" -name "*.md" -exec mdl --no-verbose --config .mdlrc {} \;)
131 # Runs as a GitHub Action
132 if [ -z "$GITHUB_WORKSPACE" ]
134 if [ -z "$(command -v shellcheck)" ]
136 printf "ERROR: shellcheck is not installed"
143 shellcheck_error=$(shellcheck "$line" 2>&1)
144 if [ -n "$shellcheck_error" ]
146 printf "ERROR; shellcheck error in: %s\n" "$shellcheck_error"
151 $(find . -name "*.sh")
156 # gtk-builder ui lint - should not check the menu.ui files
157 if [ -z "$(command -v gtk-builder-tool)" ]
159 printf "ERROR: gtk-builder-tool is not installed"
166 if [ "${line#*"menu"}" = "$line" ]
168 if [ -z "$GITHUB_WORKSPACE" ]
170 builder_error=$(gtk-builder-tool validate "$line" 2>&1)
171 if [ -n "$builder_error" ]
173 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
177 builder_error=$(xvfb-run --auto-servernum gtk-builder-tool validate "$line" 2>&1)
178 if [ -n "$builder_error" ]
180 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
187 $(find $! -name "*.ui")
192 if [ -z "$(command -v desktop-file-validate)" ]
194 printf "ERROR: desktop-file-validate is not installed"
201 desktop_file=$(basename "$line" ".in")
202 ln --symbolic "$line" "$1/$desktop_file"
203 result=$(desktop-file-validate "$1/$desktop_file")
205 rm "$1/$desktop_file"
208 printf "ERROR; desktop-file-validate error in: %s %s\n" "$line" "$result"
213 $(find . -name "*.desktop.in")
218 if [ -z "$(command -v appstreamcli)" ]
220 printf "ERROR: appstreamcli is not installed"
223 if ! result=$(appstreamcli validate org.geeqie.Geeqie.appdata.xml.in --pedantic --explain)
228 line_count=$(echo "$result" | wc --lines)
230 if [ "$line_count" -gt 1 ]
238 printf "%s: appstreamcli in org.geeqie.Geeqie.appdata.xml.in: \n%s\n" "$status" "$result"