42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
+
|
fi
echo 'Tcl Nano'
echo '========'
echo ''
echo "Current release: **${version}**"
echo ''
echo " - [Manual](/uv/manuals/tcl-nano-${version}-manual.pdf)"
echo ' - Downloads:'
echo " - [Source](/uv/${tarball}) <small>(SHA2-256: ${sha256})</small>"
echo ''
echo "Older releases may be found in the [archives](/uvlist)."
return 0
}
# Determine if a Fossil UV file exists
function fossilUVExists() {
local file
file="$1"
if fossil uv cat "${file}" 2>/dev/null | grep '^' >/dev/null; then
return 0
fi
return 1
}
# Ensure we are operating in the root of the checkout
cd "$(dirname "${BASH_SOURCE[0]}")/.."
# Update the repository
fossil sync
fossil uv sync
# Determine latest release
tclNanoVersion="$(fossil uv ls | sed 's/^releases\/tcl-nano-\(.*\)\.tar\.gz/\1/;t;d' | sort --version-sort | tail -n 1)"
tclNanoTarball="releases/tcl-nano-${tclNanoVersion}.tar.gz"
tclNanoReleaseDate="$(fossil uv cat "${tclNanoTarball}" 2>/dev/null | gzip -dc 2>/dev/null | tar -tvf - 2>/dev/null | awk '{ print $4 }')"
tclNanoTarballSHA256="$(fossil uv cat "${tclNanoTarball}" 2>/dev/null | openssl dgst -sha256 | sed 's/.*= *//')"
tclNanoReleaseVersion="$(fossil uv ls | sed 's/^releases\/tcl-nano-\(.*\)\.tar\.gz/\1/;t;d' | sort --version-sort | tail -n 1)"
tclNanoReleaseManualPDF="manuals/tcl-nano-${tclNanoReleaseVersion}.pdf"
tclNanoReleaseTarball="releases/tcl-nano-${tclNanoReleaseVersion}.tar.gz"
tclNanoReleaseDate="$(fossil uv cat "${tclNanoReleaseTarball}" 2>/dev/null | gzip -dc 2>/dev/null | tar -tvf - 2>/dev/null | awk '{ print $4 }')"
tclNanoReleaseTarballSHA256="$(fossil uv cat "${tclNanoReleaseTarball}" 2>/dev/null | openssl dgst -sha256 | sed 's/.*= *//')"
# Determine current development version
tclNanoDevelopmentVersion="$(awk '/^AC_INIT\(/{ sub(/^AC_INIT\([^,]*, */, ""); sub(/[,\)].*$/, ""); print; }' < configure.ac)"
tclNanoDevelopmentDate="$(date +%d-%b-%Y)"
# Generate the new manual page entry
manPage="$(groff -mandoc -Thtml nano.man | sed -r 's@</*(body|html)( [^>]*|)>@@g;/<head>/,/<\/head>/ d' | sed "s/@@VERS@@/${tclNanoVersion}/g;s/@@SHORT_DATE@@/${tclNanoRelaseDate}/g" | sed 's/\[/\[/g;s/\]/\]/g' | tail -n +5)"
updatePage "${wikiPageManual}" "${manPage}"
# Generate the new manual page entry for the development version
developmentManPage="$(groff -mandoc -Thtml nano.man | sed -r 's@</*(body|html)( [^>]*|)>@@g;/<head>/,/<\/head>/ d' | sed "s/@@VERS@@/${tclNanoDevelopmentVersion}/g;s/@@SHORT_DATE@@/${tclNanoDevelopmentDate}/g" | sed 's/\[/\[/g;s/\]/\]/g' | tail -n +5)"
updatePage "${wikiPageManual}" "${developmentManPage}"
# Generate a PDF manual page for the release version, if it does not already exist
if ! fossilUVExists "${tclNanoReleaseManualPDF}"; then
tclNanoReleaseManualPDFTmp="$(mktemp -u)"
fossil uv cat "${tclNanoReleaseTarball}" 2>/dev/null | gzip -dc 2>/dev/null | tar -xOf - '*/nano.man' | groff -mandoc -Tpdf > "${tclNanoReleaseManualPDFTmp}"
fossil uv add "${tclNanoReleaseManualPDFTmp}" --as "${tclNanoReleaseManualPDF}"
rm -f "${tclNanoReleaseManualPDFTmp}"
fi
# Generate the new download page entry
downloadsPage="$(generateDownloads "${tclNanoVersion}" "${tclNanoTarball}" "${tclNanoTarballSHA256}")"
downloadsPage="$(generateDownloads "${tclNanoReleaseVersion}" "${tclNanoReleaseTarball}" "${tclNanoReleaseTarballSHA256}")"
updatePage "${wikiPageDownloads}" "${downloadsPage}" 'markdown'
# Push changes if any have been made
fossil sync
fossil uv sync
exit 0
|