Fix #1289: tar.xz contains symlinks that are wrong for plugins
authorColin Clark <colin.clark@cclark.uk>
Fri, 22 Mar 2024 11:27:01 +0000 (11:27 +0000)
committerColin Clark <colin.clark@cclark.uk>
Fri, 22 Mar 2024 11:27:01 +0000 (11:27 +0000)
https://github.com/BestImageViewer/geeqie/issues/1289

Also fix scripts so that tests can be run from the source tar.

scripts/new-release.sh
scripts/test-all.sh
scripts/test-ancillary-files.sh

index 0faee50..4557fff 100755 (executable)
@@ -8,7 +8,7 @@
 ## -v \<a.b\> is a major.minor version number\n
 ## -s \<c\> is the start hash number for a new major.minor release - if omitted, HEAD is used\n
 ## -p \<d\> is the patch version if a major.minor.patch release is being created\n
-## -r Push the release to the repo. If omitted a test run is made (run from a temp. clone folder)\n
+## -r Push the release to the repo. If omitted a test run is made.\n
 ## -h Print Help
 ##
 ## Will create a new release off the master branch, or will create a new
 ##
 ## It is expected that the first line of NEWS is in the form "Geeqie \<a.b[.d]\>
 ##
+## 1. Ensure that the main repo. is up to date
+## 2. cd to a working directory and create or update NEWS and org.geeqie.Geeqie.appdata.xml.in for the new release data.
+## 4. Run this script
+##
+## This script will:
+## 1. Clone geeqie to a unique directory in /tmp and cd to it
+## 2. Copy NEWS and org.geeqie.Geeqie.appdata.xml.in from the working
+## directory to the new clone dir
+## 3. Create the new release
+## 4. Rename the unique dir name to the form geeqie-<n.m>
+## 5. Create the source tar
 
 version=
 start=
@@ -36,17 +47,43 @@ do
        esac
 done
 
-if [ ! -d .git ]
+orig_dir=$PWD
+
+if [ ! -f NEWS ]
 then
-       printf '%s\n' "Directory .git does not exist"
+       printf '%s\n' "File NEWS does not exist"
        exit 1
 fi
 
-if ! zenity --title="NEW RELEASE" --question --text "Edit the following files before running\n this  script:\n\nNEWS\norg.geeqie.Geeqie.appdata.xml.in\n\nContinue?" --width=300
+if [ ! -f org.geeqie.Geeqie.appdata.xml.in ]
 then
-       exit 0
+       printf '%s\n' "File org.geeqie.Geeqie.appdata.xml.in does not exist"
+       exit 1
 fi
 
+if ! zenity --title="NEW RELEASE" --question --text "Have the following files been updated?\n\n$orig_dir/NEWS\n$orig_dir/org.geeqie.Geeqie.appdata.xml.in\n\nContinue?" --width=600
+then
+       exit 1
+fi
+
+if [ "$push" = true ]
+then
+       if ! zenity --title="NEW RELEASE" --question --text "Do you have write access to the repo.?\nDo you really want to push?\n\nContinue?" --width=600
+       then
+               exit 1
+       fi
+fi
+
+tmp_dir=${TMPDIR:-/tmp}
+working_dir=$(mktemp --directory "$tmp_dir/geeqie.XXXXXXXXXX")
+
+git clone git://git.geeqie.org/geeqie.git "$working_dir"
+
+cp "$orig_dir/NEWS" "$working_dir"
+cp "$orig_dir/org.geeqie.Geeqie.appdata.xml.in" "$working_dir"
+
+cd "$working_dir" || exit 1
+
 if [ -n "$start" ] && [ -n "$patch" ]
 then
        printf '%s\n' "Cannot have start-hash and patch number together"
@@ -114,7 +151,7 @@ else
 fi
 
 # Regenerate to get the new version number in the man page
-rm -rf build
+rm --recursive --force build
 meson setup build
 ninja -C build
 
@@ -147,15 +184,19 @@ then
        git push git@geeqie.org:geeqie "v$revision"
 fi
 
-rm -rf /tmp/geeqie-"$revision".tar.xz
-rm -rf /tmp/geeqie-"$revision".tar.xz.asc
-rm -rf build
+rm --recursive --force build
+
+cd "$tmp_dir" || exit 1
+
+rm --recursive --force "geeqie-$revision.tar.xz"
+rm --recursive --force "geeqie-$revision.tar.xz.asc"
+rm --recursive --force "geeqie-$revision"
+
+mv "$working_dir" "geeqie-$revision"
 
-# shellcheck disable=SC2140
-tar --create --xz --file=/tmp/geeqie-"$revision".tar.xz --exclude=".git" --exclude="configure" --exclude="web" --transform s/"\bgeeqie\b"/"geeqie-$revision"/ ../geeqie
-gpg --armor --detach-sign --output /tmp/geeqie-"$revision".tar.xz.asc /tmp/geeqie-"$revision".tar.xz
+tar --create --xz --file="$tmp_dir/geeqie-$revision.tar.xz" --exclude="AppImage*" --exclude=".git*" "geeqie-$revision"
 
-git checkout master
+gpg --armor --detach-sign --output "$tmp_dir/geeqie-$revision.tar.xz.asc" "$tmp_dir/geeqie-$revision.tar.xz"
 
 git checkout stable/"$version" NEWS
 git checkout stable/"$version" geeqie.1
@@ -173,4 +214,4 @@ then
        git push git@geeqie.org:geeqie
 fi
 
-zenity --info --window-icon="info" --text="Upload files:\n\n/tmp/geeqie-$revision.tar.xz\n/tmp/geeqie-$revision.tar.xz.asc\n\nto https://github.com/BestImageViewer/geeqie/releases" --width=400
+zenity --info --window-icon="info" --text="Upload files:\n\n$tmp_dir/geeqie-$revision.tar.xz\n$tmp_dir/geeqie-$revision.tar.xz.asc\n\nto https://github.com/BestImageViewer/geeqie/releases" --width=400
index 9424e35..4d87a02 100755 (executable)
@@ -26,7 +26,7 @@
 ## and then with -Ddevel=enabled and other
 ## options as auto
 
-if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
+if [ ! -d "src" ] || [ ! -f "geeqie.1" ]
 then
        printf '%s\n' "This is not a Geeqie project folder"
        exit 1
index 4325b75..4aef378 100755 (executable)
@@ -33,7 +33,7 @@
 
 cd "$1" || exit 1
 
-if [ ! -d ".git" ] || [ ! -d "src" ] || [ ! -f "geeqie.1" ]
+if [ ! -d "src" ] || [ ! -f "geeqie.1" ]
 then
        printf '%s\n' "This is not a Geeqie project folder"
        exit 1
@@ -82,21 +82,25 @@ 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" ]
+# Check if all options are in the disabled checks in a GitHub run
+# Directory .github is not in the source tar
+if [ -d ".github" ]
+then
+       while read -r line
+       do
+               if [ -n "$line" ]
                then
-                       printf "ERROR; Option no disabled check in .github/workflows/check-build-actions.yml: %s\n" "$line"
-                       exit_status=1
+                       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
-       fi
-done << EOF
+       done << EOF
 $(awk 'BEGIN {FS="\047"} /option/ { if (substr($2,0,2) != "gq") { print $2 } }' meson_options.txt)
 EOF
+fi
 
 # Markdown lint
 # Runs as a GitHub Action