diff --git a/documentation/update-opendylan.org.sh b/documentation/update-opendylan.org.sh index da01ec4a0..c317db9c6 100755 --- a/documentation/update-opendylan.org.sh +++ b/documentation/update-opendylan.org.sh @@ -1,23 +1,24 @@ #!/bin/bash -xe -# This script is intended to be run from cron. +# This script is intended to be run from a systemd timer. We use our own log +# file because there can be a lot of output and it seems better not to spam the +# systemd journal. logfile=/var/log/update-opendylan.org.`date +%Y%m%d%H%M`.log exec > $logfile 2>&1 -exe_dir="$(realpath $(dirname $0))" +export PATH=/root/dylan/bin:/opt/opendylan/bin:/opt/python3-venv/bin:${PATH} -repo_dir=/root/deploy-opendylan.org -gendoc_exe=${repo_dir}/gendoc/_build/bin/gendoc +exe_dir="$(realpath $(dirname $0))" +opendylan_dir="$(dirname ${exe_dir})" dest_dir=/var/www/opendylan.org -# Update opendylan and website submodule first so we get any changes -# to the update.sh script. -cd ${repo_dir}/opendylan -git pull --rebase origin master +# Pull changes to update.sh and the docs. +cd "${opendylan_dir}" +git pull --rebase --tags origin master git submodule update --init --recursive -${exe_dir}/update.sh "${dest_dir}" "${repo_dir}" "${gendoc_exe}" +${exe_dir}/update.sh "${dest_dir}" echo "Done updating opendylan.org" bzip2 $logfile diff --git a/documentation/update.sh b/documentation/update.sh index 9ca5b21cf..bd8701ac8 100755 --- a/documentation/update.sh +++ b/documentation/update.sh @@ -7,7 +7,6 @@ # Three directories in ${dest_dir} are special: # 1. /downloads # copy files there by hand # 2. /books/drm # the DRM is .html files, copied here separately -# 3. /package # package docs are generated here echo "" @@ -28,6 +27,7 @@ if [[ ! -d "$dest_dir" ]]; then fi set -e # die on any error +set -x # debug output opendylan_dir=$(dirname $(dirname $(realpath "$0"))) @@ -35,8 +35,6 @@ opendylan_dir=$(dirname $(dirname $(realpath "$0"))) echo "Updating the Dylan workspace to get latest package dependencies..." cd "${opendylan_dir}/documentation" dylan update -dylan build gendoc - # Build and install main docs @@ -44,32 +42,15 @@ echo "Building Open Dylan docs in ${opendylan_dir}/documentation/_build/html/ .. make --directory ${opendylan_dir}/documentation html echo "Copying main docs to ${dest_dir} ..." -rsync -avz ${opendylan_dir}/documentation/_build/html/ ${dest_dir} - - -# Build and install package docs. -# -# Copy the gendoc package first since we're about to modify its docs/source dir. - -work_dir=$(mktemp -d) -cp -rp ${opendylan_dir}/_packages/gendoc/current/src ${work_dir}/gendoc -cd ${work_dir}/gendoc -dylan update # Install sphinx-extensions in the right relative location. - -package_dir="${work_dir}/gendoc/docs/source/" -echo "Generating package docs in ${package_dir}..." -${opendylan_dir}/_build/bin/gendoc ${package_dir}/index.rst -make --directory ${work_dir}/gendoc/docs html - -echo "Copying package docs to ${dest_dir}/package ..." -rsync -avz ${work_dir}/gendoc/docs/_build/html/ ${dest_dir}/package +rsync -a ${opendylan_dir}/documentation/_build/html/ ${dest_dir} # Install the DRM docs. # # Note that the DRM docs depend on rewrite rules setup in nginx config in order -# to redirect Foo to Foo.html or Foo.png etc. +# to redirect Foo to Foo.html or Foo.png etc., so testing is difficult. But it +# also rarely changes so is unlikely to break. echo "Copying DRM docs to ${dest_dir}/books/drm ..." mkdir -p ${dest_dir}/books/drm -rsync -avz ${opendylan_dir}/_packages/dylan-reference-manual/current/src/source/ ${dest_dir}/books/drm +rsync -a ${opendylan_dir}/_packages/dylan-reference-manual/current/src/source/ ${dest_dir}/books/drm