Overview
| Comment: | Include download page in wiki pages updated |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
333c671a3a495f8ae846aec83c5b790f |
| User & Date: | rkeene on 2018-07-09 22:12:53.875 |
| Other Links: | manifest | tags |
Context
|
2018-07-10
| ||
| 00:01 | As part of release engineering, upload unversioned files check-in: f3070aed72 user: rkeene tags: trunk | |
|
2018-07-09
| ||
| 22:12 | Include download page in wiki pages updated check-in: 333c671a3a user: rkeene tags: trunk | |
| 16:52 | Updated to support creating a wiki page for the Tcl Nano manual page check-in: 3bf973af21 user: rkeene tags: trunk | |
Changes
Modified build/update-wiki
from [044a2d83b9]
to [c5365d627b].
1 2 3 4 | #! /usr/bin/env bash set -e | | > > > | > > | | > > > > > | > > > > > | > | | > > > | > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 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 |
#! /usr/bin/env bash
set -e
# Wiki pages to update
wikiPageManual='Manual'
wikiPageDownloads='Downloads'
# Function to update a wiki page, if it has changed
function updatePage() {
local pageName newContents mimeType
local oldContents
pageName="$1"
newContents="$2"
mimeType="$3"
if [ -z "${mimeType}" ]; then
mimeType='text/x-fossil-wiki'
fi
oldContents="$(fossil wiki export "${pageName}" 2>/dev/null)" || oldContents=''
if [ "${oldContents}" != "${newContents}" ]; then
echo "${newContents}" | fossil wiki commit --mimetype "${mimeType}" "${pageName}" >/dev/null 2>/dev/null || \
echo "${newContents}" | fossil wiki create --mimetype "${mimeType}" "${pageName}" || return 1
fi
return 0
}
# Generate the new downloads page
function generateDownloads() {
local version tarball sha256
version="$1"
tarball="$2"
sha256="$3"
if [ -z "${version}" -o -z "${tarball}" ]; then
return 0
fi
echo 'Tcl Nano'
echo '========'
echo ''
echo "Current release: **${version}**"
echo ' - Downloads:'
echo " - [Source](/uv/${tarball}) <small>(SHA2-256: ${sha256})</small>"
echo ''
echo "Older releases may be found in the [archives](/uvlist)."
return 0
}
# 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/.*= *//')"
# 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 download page entry
downloadsPage="$(generateDownloads "${tclNanoVersion}" "${tclNanoTarball}" "${tclNanoTarballSHA256}")"
updatePage "${wikiPageDownloads}" "${downloadsPage}" 'text/markdown'
# Push changes if any have been made
fossil sync
exit 0
|