Revise testing
authorColin Clark <colin.clark@cclark.uk>
Fri, 2 Feb 2024 11:46:25 +0000 (11:46 +0000)
committerColin Clark <colin.clark@cclark.uk>
Fri, 2 Feb 2024 11:46:25 +0000 (11:46 +0000)
- Move ancillary file checks from meson.build to test-ancillary-files.sh
- Scripts to run checks locally - test-all.sh, clang-tidy-check.sh
- revise .clang-tidy so that no errors are shown for current sources
- remove files erroneously in .git
- include .shellcheckrc

26 files changed:
.clang-tidy
.github/workflows/check-build-actions.yml
.shellcheckrc [new file with mode: 0644]
doc/meson.build
meson.build
meson_options.txt
plugins/camera-import/meson.build
plugins/export-jpeg/meson.build
plugins/image-crop/meson.build
plugins/meson.build
plugins/open-with/meson.build
plugins/random-image/meson.build
plugins/refresh-thumbnail/geeqie-refresh-thumbnail [deleted file]
plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh [deleted file]
plugins/refresh-thumbnail/meson.build [deleted file]
plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in [deleted file]
plugins/resize-image/meson.build
plugins/rotate/meson.build
plugins/symlink/meson.build
plugins/tethered-photography/meson.build
plugins/video-player/meson.build
po/meson.build
scripts/clang-tidy-check.sh [new file with mode: 0755]
scripts/meson.build [deleted file]
scripts/test-all.sh [new file with mode: 0755]
scripts/test-ancillary-files.sh [new file with mode: 0755]

index 0a77b0e..7ec167b 100644 (file)
@@ -26,17 +26,46 @@ Checks: >
   performance-*,
   portability-*,
   readability-*,
+  -bugprone-assignment-in-if-condition,
+  -bugprone-branch-clone,
   -bugprone-easily-swappable-parameters,
+  -bugprone-implicit-widening-of-multiplication-result,
+  -bugprone-incorrect-roundings,
+  -bugprone-integer-division,
+  -bugprone-macro-parentheses,
+  -bugprone-narrowing-conversions,
+  -bugprone-reserved-identifier,
+  -bugprone-sizeof-expression,
+  -bugprone-suspicious-missing-comma,
+  -bugprone-suspicious-string-compare,
   -misc-const-correctness,
+  -misc-no-recursion,
+  -misc-non-private-member-variables-in-classes,
+  -misc-redundant-expression,
+  -misc-unused-parameters,
+  -misc-use-anonymous-namespace,
   -modernize-avoid-c-arrays,
   -modernize-macro-to-enum,
+  -modernize-raw-string-literal,
+  -modernize-redundant-void-arg,
+  -modernize-use-auto,
+  -modernize-use-nullptr,
   -modernize-use-trailing-return-type,
+  -modernize-use-using,
   -performance-no-int-to-ptr,
   -readability-braces-around-statements,
+  -readability-duplicate-include,
   -readability-else-after-return,
   -readability-function-cognitive-complexity,
   -readability-identifier-length,
   -readability-implicit-bool-conversion,
+  -readability-inconsistent-declaration-parameter-name,
   -readability-isolate-declaration,
   -readability-magic-numbers,
-  -readability-qualified-auto
+  -readability-misleading-indentation,
+  -readability-named-parameter,
+  -readability-non-const-parameter,
+  -readability-qualified-auto,
+  -readability-simplify-boolean-expr,
+  -readability-suspicious-call-argument,
+  -readability-uppercase-literal-suffix
index 598303e..f403a24 100644 (file)
@@ -9,12 +9,24 @@ jobs:
     - name: Run Markdown Lint
       uses: actionshub/markdownlint@main
 
+  Check-Shellcheck:
+    runs-on: ubuntu-22.04
+    steps:
+    - uses: actions/checkout@v2
+    - name: Run Shellcheck Lint
+      uses: ludeeus/action-shellcheck@2.0.0
+      with:
+        ignore_names: downsize
+
   Check-Build-No-Options:
     runs-on: ubuntu-22.04
     steps:
     - run: sudo apt-get update
     - 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
     - run: sudo apt-get install gettext
+    - run: sudo apt-get install libgtk-3-bin
     - run: sudo apt-get install shellcheck
     - uses: actions/checkout@v3
     - uses: actions/setup-python@v4
@@ -23,7 +35,31 @@ jobs:
       with:
         action: test
         directory: build
-        setup-options: -Darchive=disabled -Dcms=disabled -Ddevel=disabled -Ddoxygen=disabled -Ddjvu=disabled -Devince=disabled -Dexecinfo=disabled -Dexiv2=disabled -Dgit=disabled -Dgps-map=disabled -Dheif=disabled -Dj2k=disabled -Djpeg=disabled -Djpegxl=disabled -Dlibraw=disabled -Dlua=disabled -Dpandoc=disabled -Dpdf=disabled -Dspell=disabled -Dtiff=disabled -Dvideothumbnailer=disabled -Dyelp-build=disabled
+        setup-options: >
+          -Darchive=disabled
+          -Dcms=disabled
+          -Ddevel=disabled
+          -Ddjvu=disabled
+          -Ddoxygen=disabled
+          -Devince=disabled
+          -Dexecinfo=disabled
+          -Dexiv2=disabled
+          -Dgit=disabled
+          -Dgps-map=disabled
+          -Dgtk4=disabled
+          -Dheif=disabled
+          -Dj2k=disabled
+          -Djpeg=disabled
+          -Djpegxl=disabled
+          -Dlibraw=disabled
+          -Dlua=disabled
+          -Dpandoc=disabled
+          -Dpdf=disabled
+          -Dspell=disabled
+          -Dtiff=disabled
+          -Dvideothumbnailer=disabled
+          -Dwebp=disabled
+          -Dyelp-build=disabled
         options: --verbose
         meson-version: 1.0.0
     - name: Upload logs
@@ -31,34 +67,36 @@ jobs:
       if: always()
       with:
         name: logs-all-no-options
-        path: /home/runner/work/geeqie/geeqie/build/meson-logs/*.txt
+        path: ${{ github.workspace }}/build/meson-logs/*.txt
         retention-days: 5
 
   Check-Build-Most-Options:
     runs-on: ubuntu-22.04
     steps:
     - run: sudo apt-get update
+    - 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 gettext
-    - run: sudo apt-get install shellcheck
+    - run: sudo apt-get install desktop-file-utils
     - run: sudo apt-get install evince
+    - run: sudo apt-get install gettext
     - run: sudo apt-get install libarchive-dev
     - run: sudo apt-get install libchamplain-0.12-dev libchamplain-gtk-0.12-dev
     - run: sudo apt-get install libdw-dev
     - run: sudo apt-get install libdwarf-dev
-    #~ - run: sudo apt-get install libffmpegthumbnailer-dev
     - run: sudo apt-get install libgexiv2-dev
     - run: sudo apt-get install libgspell-1-dev
+    - run: sudo apt-get install libgtk-3-bin
     - run: sudo apt-get install libheif-dev
-    #~ - run: sudo apt-get install libjxl-dev
     - run: sudo apt-get install liblua5.3-dev
     - run: sudo apt-get install libpoppler-glib-dev
     - run: sudo apt-get install libraw-dev libomp-dev
     - run: sudo apt-get install libunwind-dev
-    - run: sudo apt-get install libwebp7
     - run: sudo apt-get install libwebp-dev
-    - run: sudo apt-get install webp-pixbuf-loader
+    - run: sudo apt-get install libwebp7
     - run: sudo apt-get install pandoc
+    - run: sudo apt-get install shellcheck
+    #~ - run: sudo apt-get install libffmpegthumbnailer-dev
+    #~ - run: sudo apt-get install libjxl-dev
     #~ - run: sudo apt-get install yelp-tools
     - uses: actions/checkout@v3
     - uses: actions/setup-python@v4
@@ -75,5 +113,5 @@ jobs:
       if: always()
       with:
         name: logs-all-most-options
-        path: /home/runner/work/geeqie/geeqie/build/meson-logs/*.txt
+        path: ${{ github.workspace }}/build/meson-logs/*.txt
         retention-days: 5
diff --git a/.shellcheckrc b/.shellcheckrc
new file mode 100644 (file)
index 0000000..c5e9dc2
--- /dev/null
@@ -0,0 +1,5 @@
+enable=add-default-case
+enable=avoid-nullary-conditions
+enable=check-unassigned-uppercase
+enable=deprecate-which
+enable=quote-safe-variables
index d7d7790..11e7fa3 100644 (file)
@@ -50,6 +50,3 @@ if running_from_git
         summary({'lua-api' : ['disabled - lua-api help file created:', false]}, section : 'Documentation', bool_yn : true)
     endif
 endif
-
-script_sources += files('create-doxygen-lua-api.sh',
-'create-shortcuts-xml.sh')
index bb40d8d..9a13794 100644 (file)
@@ -577,19 +577,9 @@ configure_file(input : 'config.h.in',
                encoding : 'UTF-8',
                configuration : conf_data)
 
-# For shellcheck on scripts
-script_sources = []
-subdir('scripts')
-
-# For markdownlint on .md files
-mdl_sources = []
-
 # For gtk builder checks on .ui files
 ui_sources = []
 
-# For checks on .desktop files
-desktop_sources = []
-
 # Process subdirs before the sources
 subdir('po')
 subdir('plugins')
@@ -649,78 +639,9 @@ else
 endif
 
 # The tests are run on GitHub with all options disabled, and then
-# with all or most options enabled. Shellcheck and GtkBuilder need only
-# be run once when options are disabled. Use option archive as a flag.
 # Image tests use option devel as a flag so that normal users do not
 # download the test image database.
 
-# Shellcheck
-option = get_option('archive')
-if option.disabled()
-    shellcheck_exe = find_program('shellcheck', required : false)
-    script_sources += files('gen_changelog.sh',
-    'geeqie-install-debian.sh',
-    'version.sh')
-
-    if shellcheck_exe.found()
-        foreach script : script_sources
-            script_path = '@0@'.format(script)
-            test('Shellcheck_ ' + script_path, shellcheck_exe, args: ['--norc', '--shell=sh', '--enable=add-default-case,avoid-nullary-conditions,check-unassigned-uppercase,deprecate-which,quote-safe-variables', script], timeout: 100)
-        endforeach
-        summary({'shellcheck' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
-    else
-        summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-    endif
-else
-    summary({'shellcheck' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-endif
-
-# Markdownlint
-option = get_option('archive')
-if option.disabled()
-    mdl_exe = find_program('mdl', required : false)
-
-    if mdl_exe.found()
-        mdl_sources += files('CHECKLIST.md',
-        'CODING.md',
-        'DEVELOPER-NOTES.md',
-        'README.md',
-        join_paths(meson.project_source_root(), '.github', 'ISSUE_TEMPLATE.md'))
-
-        style = join_paths(meson.project_source_root(), '.mdl.rb')
-        foreach md_file : mdl_sources
-            md_path = '@0@'.format(md_file)
-            test('Mdl_check_ ' + md_path, mdl_exe, args: ['--style', style, md_file], timeout: 100)
-        endforeach
-        summary({'markdownlint' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
-    else
-        summary({'markdownlint' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-    endif
-else
-    summary({'markdownlint' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-endif
-
-# GtkBuilder .ui check
-option = get_option('archive')
-if option.disabled()
-    if xvfb.found()
-        gtk_builder_tool = find_program('gtk-builder-tool', required : false)
-        if gtk_builder_tool.found()
-            foreach ui_file : ui_sources
-                ui_path = '@0@'.format(ui_file)
-                test('UI Build_ ' + ui_path, xvfb, args: ['--auto-servernum', gtk_builder_tool.full_path(), 'validate', ui_file], timeout: 100)
-            endforeach
-            summary({'gtk-builder-tool' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
-        else
-            summary({'gtk-builder-tool' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-        endif
-    else
-        summary({'gtk-builder-tool xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-    endif
-else
-    summary({'gtk-builder-tool xvfb' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-endif
-
 # Image checks
 option = get_option('devel')
 if option.enabled()
@@ -800,22 +721,8 @@ else
     summary({'lua' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
 endif
 
-# Desktop files test
-option = get_option('desktop')
-if not option.disabled()
-    desktop_exe = find_program('desktop-file-validate', required : false)
-    if desktop_exe.found()
-        desktop_sh = find_program('desktop-file-validate.sh', dirs : scriptsdir, required : true)
-        test_desktop_dir = join_paths(meson.current_build_dir(), 'test-desktop-files.p')
-        foreach desktop_file : desktop_sources
-            desktop_path = '@0@'.format(desktop_file)
-            test('Desktop_check_ ' + desktop_path, desktop_sh, args: [test_desktop_dir, desktop_file], timeout: 100)
-        endforeach
+# Ancillary files test
+test_ancillary_files_sh = find_program('test-ancillary-files.sh', dirs : scriptsdir, required : true)
+test('Ancillary files', test_ancillary_files_sh, args: [meson.current_source_dir()], timeout: 100)
 
-        summary({'Desktop files' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
-    else
-        summary({'Desktop files' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-    endif
-else
-    summary({'Desktop files' : ['Test runs:', false]}, section : 'Testing', bool_yn : true)
-endif
+summary({'Ancillary files' : ['Test runs:', true]}, section : 'Testing', bool_yn : true)
index eb3a9f1..9bc8508 100644 (file)
@@ -25,7 +25,6 @@ option('gq_localedir', type : 'string', value : '', description : 'Location wher
 
 option('archive', type : 'feature', value : 'auto', description : 'archive files e.g. zip, gz')
 option('cms', type : 'feature', value : 'auto', description : 'color management system')
-option('desktop', type : 'feature', value : 'auto', description : 'desktop file check')
 option('devel', type : 'feature', value : 'disabled', description : 'developer mode')
 option('doxygen', type : 'feature', value : 'auto', description : 'lua api help file')
 option('djvu', type : 'feature', value : 'auto', description : 'djvu')
index a7838ac..26ca4db 100644 (file)
@@ -20,8 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-camera-import',
-'geeqie-camera-import-hook-script')
-
-desktop_sources += files('org.geeqie.camera-import.desktop.in')
index c9c0394..cb317a4 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-export-jpeg')
-
-desktop_sources += files('org.geeqie.export-jpeg.desktop.in')
index 14c056f..8a6748c 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-image-crop')
-
-desktop_sources += files('org.geeqie.image-crop.desktop.in')
index 76dab89..503c94c 100644 (file)
@@ -31,5 +31,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : appdir)
-
-desktop_sources += files('org.geeqie.template.desktop.in')
index 2872a29..1c00db0 100644 (file)
@@ -20,4 +20,4 @@ i18n.merge_file(
     install_dir : desktopdir)
 
 
-desktop_sources += files('org.geeqie.open-with.desktop.in')
+#~ desktop_sources += files('org.geeqie.open-with.desktop.in')
index d6d4aed..73320e7 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-random-image')
-
-desktop_sources += files('org.geeqie.random-image.desktop.in')
diff --git a/plugins/refresh-thumbnail/geeqie-refresh-thumbnail b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail
deleted file mode 100755 (executable)
index 86ca6cc..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/bin/sh
-
-## @file
-## @brief Import all images from camera
-##
-## Requires gphoto2
-##
-finish()
-{
-       if [ -f /tmp/geeqie-camera-import-files ]
-       then
-               rm /tmp/geeqie-camera-import-files
-       fi
-
-       if [ -p "$zen_pipe" ]
-       then
-               rm "$zen_pipe"
-       fi
-
-       if [ "$gphoto2_pid" != "" ]
-       then
-               if ps -p "$gphoto2_pid" > /dev/null
-               then
-                       kill "$gphoto2_pid"
-               fi
-       fi
-
-       if [ "$zen_pid" != "" ]
-       then
-               if ps -p "$zen_pid" > /dev/null
-               then
-                       kill "$zen_pid"
-               fi
-       fi
-}
-trap finish EXIT
-
-if ! [ -x "$(command -v gphoto2)" ]
-then
-       zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2> /dev/null
-       exit 0
-fi
-
-if [ -f /tmp/geeqie-camera-import.log ]
-then
-       rm /tmp/geeqie-camera-import.log
-fi
-
-if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ]
-then
-       zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2> /dev/null
-       exit 0
-fi
-
-IFS='
-'
-
-list=$(gphoto2 --auto-detect | tail -n +3)
-camera_list=""
-n=1
-count=$(gphoto2 --auto-detect | tail -n +3 | wc -l)
-if [ "$count" -gt 1 ]
-then
-       for camera in $list
-       do
-               if [ "$n" -eq "$count" ]
-               then
-                       camera_list="${camera_list:+${camera_list}}TRUE\n$camera\n$n"
-               else
-                       camera_list="${camera_list:+${camera_list}}FALSE\n$camera\n$n\n"
-               fi
-               n=$((n + 1))
-       done
-
-       camera_selected=$(printf '%b' "$camera_list" | zenity --width=500 --height=250 --title="Geeqie camera import" --list --text "Select camera" --radiolist --column "Select" --column "Camera" --column "n" --print-column=2 2> /dev/null)
-
-       if [ $? = 1 ]
-       then
-               exit 0
-       fi
-else
-       camera_selected=$(gphoto2 --auto-detect | tail +3)
-fi
-
-port_type=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $1}' | awk '{print $NF}')
-camera=$(printf '%s\n' "$camera_selected" | awk -F "$port_type" '{print $1}')
-port_address=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $2}')
-port="$port_type:$port_address"
-
-script_dir=$(dirname "$0")
-
-if ! zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n<b>$PWD</b>" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2> /dev/null
-then
-       exit 0
-fi
-
-src_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-dest_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-
-(
-       gphoto2 --port "$port" --list-files 2> /tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > "$src_files_sorted"
-) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..." --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250
-
-error=$(grep -i error /tmp/geeqie-camera-import.log)
-
-if [ -n "$error" ]
-then
-       zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 < /tmp/geeqie-camera-import.log 2> /dev/null
-       exit 1
-fi
-
-find . -maxdepth 1 -type f -exec basename {} \; | sort > "$dest_files_sorted"
-existing_file_count=$(comm -12 "$src_files_sorted" "$dest_files_sorted" | wc -l)
-
-repeated=$(uniq --repeated "$src_files_sorted")
-if [ -n "$repeated" ]
-then
-       repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated"
-
-       if zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null
-       then
-               exit 1
-       fi
-fi
-
-total=$(wc -l < "$src_files_sorted")
-files_to_load=$((total - existing_file_count))
-
-rm "$src_files_sorted"
-rm "$dest_files_sorted"
-
-if [ "$files_to_load" -eq 0 ]
-then
-       zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2> /dev/null
-       exit 0
-fi
-
-if [ -f /tmp/geeqie-camera-import-files ]
-then
-       rm /tmp/geeqie-camera-import-files
-fi
-touch /tmp/geeqie-camera-import-files
-
-zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-mkfifo "$zen_pipe"
-
-gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2> /tmp/geeqie-camera-import.log &
-
-gphoto2_pid=$!
-
-(tail -f "$zen_pipe" 2> /dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null &
-zen_pid=$!
-
-n=0
-while [ -f /tmp/geeqie-camera-import-files ] && [ "$n" -lt 100 ]
-do
-       i=$(wc -l < "/tmp/geeqie-camera-import-files")
-       n=$(($((i * 100)) / files_to_load))
-       printf '%s\n' "$n" > "$zen_pipe"
-
-       latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files)
-       if [ -z "$latest_file" ]
-       then
-               latest_file="Skipping existing files, if any..."
-       fi
-       printf '#Downloading: total: %s existing: %s\n%s' "$files_to_load existing" "$existing_file_count" "$latest_file" > "$zen_pipe"
-
-       sleep 1
-done
diff --git a/plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh b/plugins/refresh-thumbnail/geeqie-refresh-thumbnail.sh
deleted file mode 100755 (executable)
index 2520385..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/sh
-
-## @file
-## @brief Import all images from camera
-##
-## Requires gphoto2
-##
-finish()
-{
-       if [ -f /tmp/geeqie-camera-import-files ]
-       then
-               rm /tmp/geeqie-camera-import-files
-       fi
-
-       if [ -p "$zen_pipe" ]
-       then
-               rm "$zen_pipe"
-       fi
-
-       if [ "$gphoto2_pid" != "" ]
-       then
-               if ps -p "$gphoto2_pid" > /dev/null
-               then
-                       kill "$gphoto2_pid"
-               fi
-       fi
-
-       if [ "$zen_pid" != "" ]
-       then
-               if ps -p "$zen_pid" > /dev/null
-               then
-                       kill "$zen_pid"
-               fi
-       fi
-}
-trap finish EXIT
-
-if [ $XDG_CACHE_HOME ]
-then
-       
-       thumb_dir="$XDG_CACHE_HOME"
-else
-       thumb_dir="$HOME/.cache/geeqie/thumbnails"
-fi
-echo $thumb_dir
-
-exit
-
-
-if ! [ -x "$(command -v gphoto2)" ]
-then
-       zenity --title="Geeqie camera import" --info --width=200 --text="gphoto2 is not installed" 2> /dev/null
-       exit 0
-fi
-
-if [ -f /tmp/geeqie-camera-import.log ]
-then
-       rm /tmp/geeqie-camera-import.log
-fi
-
-if [ "$(gphoto2 --auto-detect | wc -l)" -le 2 ]
-then
-       zenity --error --title="Geeqie camera import" --text="No camera detected" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250 2> /dev/null
-       exit 0
-fi
-
-IFS='
-'
-
-list=$(gphoto2 --auto-detect | tail -n +3)
-camera_list=""
-n=1
-count=$(gphoto2 --auto-detect | tail -n +3 | wc -l)
-if [ "$count" -gt 1 ]
-then
-       for camera in $list
-       do
-               if [ "$n" -eq "$count" ]
-               then
-                       camera_list="${camera_list:+${camera_list}}TRUE\n$camera\n$n"
-               else
-                       camera_list="${camera_list:+${camera_list}}FALSE\n$camera\n$n\n"
-               fi
-               n=$((n + 1))
-       done
-
-       camera_selected=$(printf '%b' "$camera_list" | zenity --width=500 --height=250 --title="Geeqie camera import" --list --text "Select camera" --radiolist --column "Select" --column "Camera" --column "n" --print-column=2 2> /dev/null)
-
-       if [ $? = 1 ]
-       then
-               exit 0
-       fi
-else
-       camera_selected=$(gphoto2 --auto-detect | tail +3)
-fi
-
-port_type=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $1}' | awk '{print $NF}')
-camera=$(printf '%s\n' "$camera_selected" | awk -F "$port_type" '{print $1}')
-port_address=$(printf '%s\n' "$camera_selected" | awk -F ':' '{print $2}')
-port="$port_type:$port_address"
-
-script_dir=$(dirname "$0")
-
-if ! zenity --question --title="Geeqie camera import" --text="Camera: $camera\n\nDownloading to folder:\n<b>$PWD</b>" --ok-label="OK" --cancel-label="Cancel" --window-icon=/usr/local/share/pixmaps/geeqie.png --width=350 2> /dev/null
-then
-       exit 0
-fi
-
-src_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-dest_files_sorted=$(mktemp "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-
-(
-       gphoto2 --port "$port" --list-files 2> /tmp/geeqie-camera-import.log | awk '/#/ {print $2}' | sort > "$src_files_sorted"
-) | zenity --progress --auto-close --auto-kill --title="Geeqie camera import" --text="Searching for files to download..." --pulsate --window-icon=/usr/local/share/pixmaps/geeqie.png --width=250
-
-error=$(grep -i error /tmp/geeqie-camera-import.log)
-
-if [ -n "$error" ]
-then
-       zenity --text-info --title="Geeqie camera import" - --window-icon=error --width=250 < /tmp/geeqie-camera-import.log 2> /dev/null
-       exit 1
-fi
-
-find . -maxdepth 1 -type f -exec basename {} \; | sort > "$dest_files_sorted"
-existing_file_count=$(comm -12 "$src_files_sorted" "$dest_files_sorted" | wc -l)
-
-repeated=$(uniq --repeated "$src_files_sorted")
-if [ -n "$repeated" ]
-then
-       repeated="Warning: The following source filenames are not unique.\nSome files may not be downloaded.\nSee the Help file.\n\n$repeated"
-
-       if zenity --question --text="$repeated" --title="Geeqie camera import" --cancel-label="OK" --ok-label="Cancel" --width=400 --window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null
-       then
-               exit 1
-       fi
-fi
-
-total=$(wc -l < "$src_files_sorted")
-files_to_load=$((total - existing_file_count))
-
-rm "$src_files_sorted"
-rm "$dest_files_sorted"
-
-if [ "$files_to_load" -eq 0 ]
-then
-       zenity --info --title="Geeqie camera download" --text="No photos to download" --width=250 --window-icon=usr/local/share/pixmaps/geeqie.png 2> /dev/null
-       exit 0
-fi
-
-if [ -f /tmp/geeqie-camera-import-files ]
-then
-       rm /tmp/geeqie-camera-import-files
-fi
-touch /tmp/geeqie-camera-import-files
-
-zen_pipe=$(mktemp -u "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
-mkfifo "$zen_pipe"
-
-gphoto2 --port "$port" --hook-script "$script_dir/"geeqie-camera-import-hook-script --get-all-files --skip-existing 2> /tmp/geeqie-camera-import.log &
-
-gphoto2_pid=$!
-
-(tail -f "$zen_pipe" 2> /dev/null) | zenity --progress --title="Geeqie camera import" --width=370 --text="Downloading: total: $files_to_load existing: $existing_file_count\n" --auto-close --auto-kill --percentage=0 window-icon=/usr/local/share/pixmaps/geeqie.png 2> /dev/null &
-zen_pid=$!
-
-n=0
-while [ -f /tmp/geeqie-camera-import-files ] && [ "$n" -lt 100 ]
-do
-       i=$(wc -l < "/tmp/geeqie-camera-import-files")
-       n=$(($((i * 100)) / files_to_load))
-       printf '%s\n' "$n" > "$zen_pipe"
-
-       latest_file=$(tail -n 1 /tmp/geeqie-camera-import-files)
-       if [ -z "$latest_file" ]
-       then
-               latest_file="Skipping existing files, if any..."
-       fi
-       printf '#Downloading: total: %s existing: %s\n%s' "$files_to_load existing" "$existing_file_count" "$latest_file" > "$zen_pipe"
-
-       sleep 1
-done
diff --git a/plugins/refresh-thumbnail/meson.build b/plugins/refresh-thumbnail/meson.build
deleted file mode 100644 (file)
index 3b76719..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# This file is a part of Geeqie project (https://www.geeqie.org/).
-# Copyright (C) 2008 - 2022 The Geeqie Team
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#
-
-install_data('geeqie-refresh-thumbnail', install_dir : gq_bindir)
-
-i18n.merge_file(
-    input : 'org.geeqie.refresh-thumbnail.desktop.in',
-    output : 'org.geeqie.refresh-thumbnail.desktop',
-    type : 'desktop',
-    po_dir : podir,
-    install : true,
-    install_dir : desktopdir)
-
-desktop_sources += files('org.geeqie.refresh-thumbnail.desktop.in')
diff --git a/plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in b/plugins/refresh-thumbnail/org.geeqie.refresh-thumbnail.desktop.in
deleted file mode 100644 (file)
index 646f415..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Type=Application
-Name=Refresh Thumbnail
-Comment=Refresh Thumbnail
-
-# Requires gphoto2
-# The gphoto2 file $HOME/.gphoto2/settings can
-# be used to set auto-rename on download
-
-Exec=geeqie-refresh-thumbnail
-
-# Desktop files that are usable only in Geeqie should be marked like this:
-Categories=Graphics;
-OnlyShowIn=X-Geeqie;
-
-# It can be made verbose
-#X-Geeqie-Verbose=true
-
-Icon=geeqie
index 5259652..824f9d3 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-resize-image')
-
-desktop_sources += files('org.geeqie.resize-image.desktop.in')
index 8952ad2..ff0007c 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-rotate')
-
-desktop_sources += files('org.geeqie.rotate.desktop.in')
index 992d58f..5c40a5c 100644 (file)
@@ -20,7 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-symlink')
-
-desktop_sources += files('org.geeqie.symlink.desktop.in')
index e8058df..2f79a7c 100644 (file)
@@ -20,8 +20,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-script_sources += files('geeqie-tethered-photography',
-'geeqie-tethered-photography-hook-script')
-
-desktop_sources += files('org.geeqie.tethered-photography.desktop.in')
index d379f9d..1f25ed6 100644 (file)
@@ -18,5 +18,3 @@ i18n.merge_file(
     po_dir : podir,
     install : true,
     install_dir : desktopdir)
-
-desktop_sources += files('org.geeqie.video-player.desktop.in')
index 6b4979f..f6801e4 100644 (file)
@@ -70,6 +70,3 @@ translator_resources = custom_target('translator_resources',
                 command : [translators_sh, '@PRIVATE_DIR@', po_source_list, meson.current_build_dir() , '@INPUT0@', '@INPUT1@'])
 
 project_sources += translator_resources
-
-script_sources += files('gen_translations_stats.sh',
-'regen_potfiles.sh')
diff --git a/scripts/clang-tidy-check.sh b/scripts/clang-tidy-check.sh
new file mode 100755 (executable)
index 0000000..95c510a
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+#**********************************************************************
+# Copyright (C) 2024 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Run clang-tidy on all source files.
+##
+
+if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
+then
+       printf '%s\n' "This is not a Geeqie project folder"
+       exit 1
+fi
+
+i=0
+
+secs_start=$(cut --delimiter='.' --fields=1 < /proc/uptime)
+total=$(find src -name "*.cc" | wc --lines)
+
+while read -r file
+do
+       i=$((i + 1))
+       printf '%d/%d %s\n' "$i" "$total" "$file"
+       clang-tidy --config-file ./.clang-tidy -p ./build "$file" 2>/dev/null
+
+       secs_now=$(cut --delimiter='.' --fields=1 < /proc/uptime)
+
+       elapsed_time=$(( secs_now - secs_start ))
+       remaining_files=$(( total - i ))
+       average_time=$(( elapsed_time / i ))
+       estimated=$(( average_time * remaining_files ))
+
+       printf 'Remaining: %dm:%ds\n' $((estimated%3600/60)) $((estimated%60))
+done << EOF
+$(find src -name "*.cc")
+EOF
diff --git a/scripts/meson.build b/scripts/meson.build
deleted file mode 100644 (file)
index 1d47776..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# This file is a part of Geeqie project (https://www.geeqie.org/).
-# Copyright (C) 2008 - 2023 The Geeqie Team
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-script_sources += files('authors.sh',
-'desktop-file-validate.sh',
-'devel-install.sh',
-'doxygen-help.sh',
-'doxygen.sh',
-'geeqie-download-appimage.sh',
-'generate-ClayRGB1998-icc-h.sh',
-'generate-man-page.sh',
-'get-test-images.sh',
-'gq-marshal-pragma.sh',
-'image-test.sh',
-'keyword_merge.sh',
-'lua-test.sh',
-'modify-downloaded-icons.sh',
-'new-release.sh',
-'template-desktop.sh',
-'translators.sh',
-'untranslated-text.sh',
-'web-help.sh')
-
diff --git a/scripts/test-all.sh b/scripts/test-all.sh
new file mode 100755 (executable)
index 0000000..537dc57
--- /dev/null
@@ -0,0 +1,76 @@
+#!/bin/sh
+#**********************************************************************
+# Copyright (C) 2024 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Run all tests
+##
+## Run test with all options disabled,
+## and then with -Ddevel=enabled and other
+## options as auto
+
+if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
+then
+       printf '%s\n' "This is not a Geeqie project folder"
+       exit 1
+fi
+
+rm --recursive --force build
+
+# Check with all options disabled
+meson setup \
+-Darchive=disabled \
+-Dcms=disabled \
+-Ddevel=disabled \
+-Ddoxygen=disabled \
+-Ddjvu=disabled \
+-Devince=disabled \
+-Dexecinfo=disabled \
+-Dexiv2=disabled \
+-Dgit=disabled \
+-Dgps-map=disabled \
+-Dgtk4=disabled \
+-Dheif=disabled \
+-Dj2k=disabled \
+-Djpeg=disabled \
+-Djpegxl=disabled \
+-Dlibraw=disabled \
+-Dlua=disabled \
+-Dpandoc=disabled \
+-Dpdf=disabled \
+-Dspell=disabled \
+-Dtiff=disabled \
+-Dvideothumbnailer=disabled \
+-Dwebp=disabled \
+-Dyelp-build=disabled \
+build
+
+meson test -C build
+
+tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/geeqie.XXXXXXXXXX")
+cp ./build/meson-logs/testlog.txt "$tmpdir/testlog-options-disabled.txt"
+
+rm --recursive --force build
+
+meson setup -Ddevel=enabled build
+
+meson test -C build
+
+cp ./build/meson-logs/testlog.txt "$tmpdir/testlog-options-enabled.txt"
diff --git a/scripts/test-ancillary-files.sh b/scripts/test-ancillary-files.sh
new file mode 100755 (executable)
index 0000000..bc59396
--- /dev/null
@@ -0,0 +1,212 @@
+#!/bin/sh
+#**********************************************************************
+# Copyright (C) 2024 - The Geeqie Team
+#
+# Author: Colin Clark
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#**********************************************************************
+
+## @file
+## @brief Perform validity checks on project ancillary files
+##
+## $1 Root of project sources
+##
+## Perform validity checks on project ancillary files:
+## desktop
+## scripts
+## ui
+##
+
+cd "$1" || exit 1
+
+if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
+then
+       printf '%s\n' "This is not a Geeqie project folder"
+       exit 1
+fi
+
+exit_status=0
+
+# Script files must have the file extension .sh  or
+# be symlinked as so - for doxygen
+while read -r file
+do
+       #~ check_sh
+       result=$(file "$file" | grep "POSIX shell script")
+
+       if [ -n "$result" ]
+       then
+               base_with_sh=$(basename "$file")
+               base_without_sh=$(basename "$file" .sh)
+
+               if [ "$base_with_sh" = "$base_without_sh" ]
+               then
+                       if [ ! -f "$file.sh" ]
+                       then
+                               printf "ERROR; Executable script does not have a .sh extension: %s\n" "$file"
+                               exit_status=1
+                       fi
+               fi
+       fi
+done << EOF
+$(find "$1/plugins" "$1/src" "$1/scripts" -type f -executable)
+EOF
+
+# Check if all options are in the disabled checks
+while read -r line
+do
+       if [ -n "$line" ]
+       then
+               res=$(grep "$line" "$1/scripts/test-all.sh")
+               if [ -z "$res" ]
+               then
+                       printf "ERROR; Option no disabled check in ./scripts/test-all.sh: %s\n" "$line"
+                       exit_status=1
+               fi
+       fi
+done << EOF
+$(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
+EOF
+
+# Check if all options are in the disabled checks
+while read -r line
+do
+       if [ -n "$line" ]
+       then
+               res=$(grep "\-D$line=disabled" "$1/.github/workflows/check-build-actions.yml")
+               if [ -z "$res" ]
+               then
+                       printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
+                       exit_status=1
+               fi
+       fi
+done << EOF
+$(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
+EOF
+
+# Markdown lint
+# Runs as a GitHub Action
+if [ -z "$GITHUB_WORKSPACE" ]
+then
+       if [ -z "$(command -v mdl)" ]
+       then
+               printf "ERROR: mdl is not installed"
+               exit_status=1
+       else
+               while read -r line
+               do
+                       if [ -n "$line" ]
+                       then
+                               if [ "${line#*": MD"}" != "$line" ]
+                               then
+                                       printf "ERROR; Markdown lint error in: %s\n" "$line"
+                                       exit_status=1
+                               fi
+                       fi
+               done << EOF
+$(find . -not -path "*/.*" -name "*.md" -exec mdl --no-verbose --config .mdlrc {} \;)
+EOF
+       fi
+fi
+
+# Shellcheck lint
+# Runs as a GitHub Action
+if [ -z "$GITHUB_WORKSPACE" ]
+then
+       if [ -z "$(command -v shellcheck)" ]
+       then
+               printf "ERROR: shellcheck is not installed"
+               exit_status=1
+       else
+               while read -r line
+               do
+                       if [ -n "$line" ]
+                       then
+                               shellcheck_error=$(shellcheck "$line" 2>&1)
+                               if [ -n "$shellcheck_error" ]
+                               then
+                                       printf "ERROR; shellcheck error in: %s\n" "$shellcheck_error"
+                                       exit_status=1
+                               fi
+                       fi
+               done << EOF
+$(find . -name "*.sh")
+EOF
+       fi
+fi
+
+# gtk-builder ui lint - should not check the menu.ui files
+if [ -z "$(command -v gtk-builder-tool)" ]
+then
+       printf "ERROR: gtk-builder-tool is not installed"
+       exit_status=1
+else
+       while read -r line
+       do
+               if [ -n "$line" ]
+               then
+                       if [ "${line#*"menu"}" = "$line" ]
+                       then
+                               if [ -z "$GITHUB_WORKSPACE" ]
+                               then
+                                       builder_error=$(gtk-builder-tool validate "$line" 2>&1)
+                                       if [ -n "$builder_error" ]
+                                       then
+                                               printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
+                                               exit_status=1
+                                       fi
+                               else
+                                       builder_error=$(xvfb-run --auto-servernum gtk-builder-tool validate "$line" 2>&1)
+                                       if [ -n "$builder_error" ]
+                                       then
+                                               printf "ERROR; gtk-builder-tool error in: %s\n" "$builder_error"
+                                               exit_status=1
+                                       fi
+                               fi
+                       fi
+               fi
+       done << EOF
+$(find $! -name "*.ui")
+EOF
+fi
+
+# Desktop files lint
+if [ -z "$(command -v desktop-file-validate)" ]
+then
+       printf "ERROR: desktop-file-validate is not installed"
+       exit_status=1
+else
+       while read -r line
+       do
+               if [ -n "$line" ]
+               then
+                       desktop_file=$(basename "$line" ".in")
+                       ln --symbolic "$line" "$1/$desktop_file"
+                       result=$(desktop-file-validate "$1/$desktop_file")
+
+                       rm "$1/$desktop_file"
+                       if [ -n "$result" ]
+                       then
+                               printf "ERROR; desktop-file-validate error in: %s %s\n" "$line" "$result"
+                               exit_status=1
+                       fi
+               fi
+       done << EOF
+$(find . -name "*.desktop.in")
+EOF
+fi
+
+exit "$exit_status"