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:
37 if [ ! -d "src" ] || [ ! -f "geeqie.1" ]
39 printf '%s\n' "This is not a Geeqie project folder"
45 # Script files must have the file extension .sh or
46 # be symlinked as so - for doxygen
50 result=$(file "$file" | grep "POSIX shell script")
54 base_with_sh=$(basename "$file")
55 base_without_sh=$(basename "$file" .sh)
57 if [ "$base_with_sh" = "$base_without_sh" ]
59 if [ ! -f "$file.sh" ]
61 printf "ERROR; Executable script does not have a .sh extension: %s\n" "$file"
67 $(find "$1/plugins" "$1/src" "$1/scripts" -type f -executable)
70 # Check if all options are in the disabled checks
75 res=$(grep "$line" "$1/scripts/test-all.sh")
78 printf "ERROR; Option no disabled check in ./scripts/test-all.sh: %s\n" "$line"
83 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
86 # Check if all options are in the disabled checks in a GitHub run
87 # Directory .github is not in the source tar
94 res=$(grep "\-D$line=disabled" "$1/.github/workflows/check-build-actions.yml")
97 printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
102 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
107 # Runs as a GitHub Action
108 if [ -z "$GITHUB_WORKSPACE" ]
110 if [ -z "$(command -v mdl)" ]
112 printf "ERROR: mdl is not installed"
119 if [ "${line#*": MD"}" != "$line" ]
121 printf "ERROR; Markdown lint error in: %s\n" "$line"
126 $(find . -not -path "*/.*" -name "*.md" -exec mdl --no-verbose --config .mdlrc {} \;)
132 # Runs as a GitHub Action
133 if [ -z "$GITHUB_WORKSPACE" ]
135 if [ -z "$(command -v shellcheck)" ]
137 printf "ERROR: shellcheck is not installed"
144 shellcheck_error=$(shellcheck "$line" 2>&1)
145 if [ -n "$shellcheck_error" ]
147 printf "ERROR; shellcheck error in: %s\n" "$shellcheck_error"
152 $(find . -name "*.sh")
157 # gtk-builder ui lint - should not check the menu.ui files
158 if [ -z "$(command -v gtk-builder-tool)" ]
160 printf "ERROR: gtk-builder-tool is not installed"
167 if [ "${line#*"menu"}" = "$line" ]
169 if [ -z "$GITHUB_WORKSPACE" ]
171 builder_error=$(gtk-builder-tool validate "$line" 2>&1)
172 if [ -n "$builder_error" ]
174 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
178 builder_error=$(xvfb-run --auto-servernum gtk-builder-tool validate "$line" 2>&1)
179 if [ -n "$builder_error" ]
181 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
188 $(find $! -name "*.ui")
193 if [ -z "$(command -v desktop-file-validate)" ]
195 printf "ERROR: desktop-file-validate is not installed"
202 desktop_file=$(basename "$line" ".in")
203 ln --symbolic "$line" "$1/$desktop_file"
204 result=$(desktop-file-validate "$1/$desktop_file")
206 rm "$1/$desktop_file"
209 printf "ERROR; desktop-file-validate error in: %s %s\n" "$line" "$result"
214 $(find . -name "*.desktop.in")
219 if [ -z "$(command -v appstreamcli)" ]
221 printf "ERROR: appstreamcli is not installed"
224 if ! result=$(appstreamcli validate org.geeqie.Geeqie.appdata.xml.in --pedantic --explain)
229 line_count=$(echo "$result" | wc --lines)
231 if [ "$line_count" -gt 1 ]
239 printf "%s: appstreamcli in org.geeqie.Geeqie.appdata.xml.in: \n%s\n" "$status" "$result"
243 if [ -z "$(command -v xmllint)" ]
245 printf "ERROR: xmllint is not installed"
252 if ! xmllint --quiet --nowarning "$line" > /dev/null
254 printf "ERROR: xmllint error in: %s\n" "$line"
259 $(find ./doc/docbook -name "*.xml")