mirror of
https://github.com/xroche/httrack.git
synced 2026-08-13 11:12:19 +03:00
* The AppStream metainfo still advertises WebHTTrack 3.49.8 The metainfo installs to usr/share/metainfo, so GNOME Software and KDE Discover read both the version and the "What's new" text out of it. Its releases block held one entry, 3.49.8, and nothing had moved it since. It now lists 3.49.8 through 3.49.15, newest first, each with a short user-facing note taken from history.txt. Dates come from the git tags; that also corrects 3.49.8's, which carried 3.49.7's date. 01_engine-version-macros.test gains two assertions so the next release cannot miss this file, or configure.ac: AC_INIT and the top release entry must both match HTTRACK_VERSIONID, and the entries must descend so the top one really is the newest. Closes #884 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> * Harden the metainfo version check and correct four release notes The release-version extraction matched <releases ...> as well as <release>, ignored XML comments and took only the last tag on a shared line, so a parked or wrapper version= could pose as the newest entry and pass a stale metainfo. Split tags one per line, drop comments, and anchor the match. Widen the awk ordering key so a component of 1000 or more cannot borrow into the next. In the notes: "3.49-2" and "site rules with wildcards" are unreadable in a software centre, the Windows path bullet does not apply to the Unix WebHTTrack GUI it ships with, and 3.49.15 listed no web-interface fix at all. Signed-off-by: Xavier Roche <xroche@gmail.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Xavier Roche <roche@httrack.com> --------- Signed-off-by: Xavier Roche <roche@httrack.com> Signed-off-by: Xavier Roche <xroche@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
93 lines
3.4 KiB
Bash
Executable File
93 lines
3.4 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# htsglobal.h declares the version; version.rc, configure.ac and the metainfo
|
|
# repeat it. Miss one and a release ships a mismatched binary or a stale store entry.
|
|
|
|
set -euo pipefail
|
|
|
|
top="${top_srcdir:-..}"
|
|
src="$top/src"
|
|
h="$src/htsglobal.h"
|
|
rc="$src/version.rc"
|
|
ac="$top/configure.ac"
|
|
metainfo="$top/html/server/div/com.httrack.WebHTTrack.metainfo.xml"
|
|
for f in "$h" "$rc" "$ac" "$metainfo"; do
|
|
[ -f "$f" ] || {
|
|
echo "cannot find $f"
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
# 3.49-12 (display) and 3.49.12 (dotted).
|
|
version=$(sed -n 's/^#define HTTRACK_VERSION[[:space:]][[:space:]]*"\([^"]*\)".*/\1/p' "$h")
|
|
versionid=$(sed -n 's/^#define HTTRACK_VERSIONID[[:space:]][[:space:]]*"\([^"]*\)".*/\1/p' "$h")
|
|
if [ -z "$version" ] || [ -z "$versionid" ]; then
|
|
echo "could not read the version from $h"
|
|
exit 1
|
|
fi
|
|
|
|
# The same version, as version.rc states it.
|
|
fileversion=$(sed -n 's/^[[:space:]]*FILEVERSION[[:space:]][[:space:]]*\(.*\)$/\1/p' "$rc" | tr -d ' \r')
|
|
productversion=$(sed -n 's/^[[:space:]]*PRODUCTVERSION[[:space:]][[:space:]]*\(.*\)$/\1/p' "$rc" | tr -d ' \r')
|
|
rc_fileversion=$(sed -n 's/.*VALUE "FileVersion",[[:space:]]*"\([^"]*\)".*/\1/p' "$rc")
|
|
rc_productversion=$(sed -n 's/.*VALUE "ProductVersion",[[:space:]]*"\([^"]*\)".*/\1/p' "$rc")
|
|
rc_productname=$(sed -n 's/.*VALUE "ProductName",[[:space:]]*"\([^"]*\)".*/\1/p' "$rc")
|
|
|
|
# And again in configure.ac and the AppStream metainfo.
|
|
ac_version=$(sed -n 's/^AC_INIT(\[[^]]*\],[[:space:]]*\[\([^]]*\)\].*/\1/p' "$ac")
|
|
# Comments dropped, one tag per line: a parked <release> or a version= on the
|
|
# <releases> wrapper would otherwise pose as the newest entry.
|
|
releases=$(sed 's/<!--.*-->//g' "$metainfo" | tr '<' '\n' |
|
|
sed -n 's/^release[[:space:]][^>]*version="\([^"]*\)".*/\1/p')
|
|
if [ -z "$ac_version" ]; then
|
|
echo "could not read the version from $ac"
|
|
exit 1
|
|
fi
|
|
if [ -z "$releases" ]; then
|
|
echo "could not read any release version from $metainfo"
|
|
exit 1
|
|
fi
|
|
|
|
# 3.49.12 -> 3,49,12,0
|
|
expected_numeric="$(echo "$versionid" | tr '.' ','),0"
|
|
|
|
fail=0
|
|
check() { # what expected actual
|
|
if [ "$2" != "$3" ]; then
|
|
echo "$1 is \"$3\", but htsglobal.h says it should be \"$2\""
|
|
fail=1
|
|
fi
|
|
}
|
|
check "version.rc FILEVERSION" "$expected_numeric" "$fileversion"
|
|
check "version.rc PRODUCTVERSION" "$expected_numeric" "$productversion"
|
|
check "version.rc FileVersion" "$versionid" "$rc_fileversion"
|
|
check "version.rc ProductVersion" "$version" "$rc_productversion"
|
|
|
|
# Signing pins the product name too.
|
|
check "version.rc ProductName" "HTTrack Website Copier" "$rc_productname"
|
|
|
|
check "the configure.ac AC_INIT version" "$versionid" "$ac_version"
|
|
check "the newest metainfo release" "$versionid" "$(echo "$releases" | head -n 1)"
|
|
|
|
# The check above trusts head -1, so require the list to actually descend.
|
|
echo "$releases" | awk -F'[.]' '
|
|
!/^[0-9]+\.[0-9]+\.[0-9]+$/ { print "unparsable metainfo release version: " $0; exit 1 }
|
|
{ n = $1 * 1000000000 + $2 * 1000000 + $3 }
|
|
NR > 1 && n >= prev { print "metainfo releases are not newest-first: " $0; exit 1 }
|
|
{ prev = n }
|
|
' || fail=1
|
|
|
|
[ "$fail" -eq 0 ] || exit 1
|
|
|
|
# And the shipped binary must agree with the header it was built from.
|
|
out=$(httrack --version)
|
|
case "$out" in
|
|
*"$version"*) ;;
|
|
*)
|
|
echo "httrack --version says \"$out\", which does not mention $version"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
echo "version.rc, configure.ac and the metainfo agree with htsglobal.h: $version ($expected_numeric)"
|