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:
35 if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
37 printf '%s\n' "This is not a Geeqie project folder"
43 # Script files must have the file extension .sh or
44 # be symlinked as so - for doxygen
48 result=$(file "$file" | grep "POSIX shell script")
52 base_with_sh=$(basename "$file")
53 base_without_sh=$(basename "$file" .sh)
55 if [ "$base_with_sh" = "$base_without_sh" ]
57 if [ ! -f "$file.sh" ]
59 printf "ERROR; Executable script does not have a .sh extension: %s\n" "$file"
65 $(find "$1/plugins" "$1/src" "$1/scripts" -type f -executable)
68 # Check if all options are in the disabled checks
73 res=$(grep "$line" "$1/scripts/test-all.sh")
76 printf "ERROR; Option no disabled check in ./scripts/test-all.sh: %s\n" "$line"
81 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
84 # Check if all options are in the disabled checks
89 res=$(grep "\-D$line=disabled" "$1/.github/workflows/check-build-actions.yml")
92 printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
97 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
101 # Runs as a GitHub Action
102 if [ -z "$GITHUB_WORKSPACE" ]
104 if [ -z "$(command -v mdl)" ]
106 printf "ERROR: mdl is not installed"
113 if [ "${line#*": MD"}" != "$line" ]
115 printf "ERROR; Markdown lint error in: %s\n" "$line"
120 $(find . -not -path "*/.*" -name "*.md" -exec mdl --no-verbose --config .mdlrc {} \;)
126 # Runs as a GitHub Action
127 if [ -z "$GITHUB_WORKSPACE" ]
129 if [ -z "$(command -v shellcheck)" ]
131 printf "ERROR: shellcheck is not installed"
138 shellcheck_error=$(shellcheck "$line" 2>&1)
139 if [ -n "$shellcheck_error" ]
141 printf "ERROR; shellcheck error in: %s\n" "$shellcheck_error"
146 $(find . -name "*.sh")
151 # gtk-builder ui lint - should not check the menu.ui files
152 if [ -z "$(command -v gtk-builder-tool)" ]
154 printf "ERROR: gtk-builder-tool is not installed"
161 if [ "${line#*"menu"}" = "$line" ]
163 if [ -z "$GITHUB_WORKSPACE" ]
165 builder_error=$(gtk-builder-tool validate "$line" 2>&1)
166 if [ -n "$builder_error" ]
168 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
172 builder_error=$(xvfb-run --auto-servernum gtk-builder-tool validate "$line" 2>&1)
173 if [ -n "$builder_error" ]
175 printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
182 $(find $! -name "*.ui")
187 if [ -z "$(command -v desktop-file-validate)" ]
189 printf "ERROR: desktop-file-validate is not installed"
196 desktop_file=$(basename "$line" ".in")
197 ln --symbolic "$line" "$1/$desktop_file"
198 result=$(desktop-file-validate "$1/$desktop_file")
200 rm "$1/$desktop_file"
203 printf "ERROR; desktop-file-validate error in: %s %s\n" "$line" "$result"
208 $(find . -name "*.desktop.in")