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 ".git" ] || [ ! -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
90 res=$(grep "\-D$line=disabled" "$1/.github/workflows/check-build-actions.yml")
93 printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
98 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
102 # Runs as a GitHub Action
103 if [ -z "$GITHUB_WORKSPACE" ]
105 if [ -z "$(command -v mdl)" ]
107 printf "ERROR: mdl is not installed"
114 if [ "${line#*": MD"}" != "$line" ]
116 printf "ERROR; Markdown lint error in: %s\n" "$line"
121 $(find . -not -path "*/.*" -name "*.md" -exec mdl --no-verbose --config .mdlrc {} \;)
127 # Runs as a GitHub Action
128 if [ -z "$GITHUB_WORKSPACE" ]
130 if [ -z "$(command -v shellcheck)" ]
132 printf "ERROR: shellcheck is not installed"
139 shellcheck_error=$(shellcheck "$line" 2>&1)
140 if [ -n "$shellcheck_error" ]
142 printf "ERROR; shellcheck error in: %s\n" "$shellcheck_error"
147 $(find . -name "*.sh")
152 # gtk-builder ui lint - should not check the menu.ui files
153 if [ -z "$(command -v gtk-builder-tool)" ]
155 printf "ERROR: gtk-builder-tool is not installed"
162 if [ "${line#*"menu"}" = "$line" ]
164 if [ -z "$GITHUB_WORKSPACE" ]
166 builder_error=$(gtk-builder-tool validate "$line" 2>&1)
167 if [ -n "$builder_error" ]
169 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
173 builder_error=$(xvfb-run --auto-servernum gtk-builder-tool validate "$line" 2>&1)
174 if [ -n "$builder_error" ]
176 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
183 $(find $! -name "*.ui")
188 if [ -z "$(command -v desktop-file-validate)" ]
190 printf "ERROR: desktop-file-validate is not installed"
197 desktop_file=$(basename "$line" ".in")
198 ln --symbolic "$line" "$1/$desktop_file"
199 result=$(desktop-file-validate "$1/$desktop_file")
201 rm "$1/$desktop_file"
204 printf "ERROR; desktop-file-validate error in: %s %s\n" "$line" "$result"
209 $(find . -name "*.desktop.in")
214 if [ -z "$(command -v appstreamcli)" ]
216 printf "ERROR: appstreamcli is not installed"
219 if ! result=$(appstreamcli validate org.geeqie.Geeqie.appdata.xml.in --pedantic --explain)
224 line_count=$(echo "$result" | wc --lines)
226 if [ "$line_count" -gt 1 ]
234 printf "%s: appstreamcli in org.geeqie.Geeqie.appdata.xml.in: \n%s\n" "$status" "$result"