summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-09-15 01:22:03 (UTC)
committerChris Johns <chrisj@rtems.org>2017-09-15 01:22:03 (UTC)
commita5294ea7d40d3370e8e29cee57dd48baf5fad4da (patch)
tree8f7d5ed8530af8a5d50af9b312beb56903bd7c86
parent55e1973c05243c5c92390762a12f36da9c4870af (diff)
Add doxygen publishing scripts.
-rwxr-xr-xdoxygen/builder/rtems-doxygen-download100
-rwxr-xr-xdoxygen/builder/rtems-doxygen-publish51
-rwxr-xr-xdoxygen/builder/rtems-doxygen-publish-cron24
-rwxr-xr-xdoxygen/builder/rtems-doxygen-unpack-branches156
4 files changed, 331 insertions, 0 deletions
diff --git a/doxygen/builder/rtems-doxygen-download b/doxygen/builder/rtems-doxygen-download
new file mode 100755
index 0000000..f72e2e1
--- /dev/null
+++ b/doxygen/builder/rtems-doxygen-download
@@ -0,0 +1,100 @@
+#! /bin/sh
+#
+# RTEMS Documentation Project
+#
+# Copyright 2017 Chris Johns <chrisj@rtems.org>
+# All rights reserved
+#
+# Public domain
+#
+
+#
+# Exit on error.
+#
+set -e
+
+#
+# Executables
+#
+cp=/bin/cp
+diff=/usr/bin/diff
+grep=/usr/bin/grep
+mkdir=/bin/mkdir
+rm=/bin/rm
+sed=/usr/bin/sed
+
+#
+# We run where the script is located.
+#
+cd $(dirname $0)
+
+#
+# Top directory
+#
+top=$PWD
+
+#
+# The current directory.
+#
+wwwdocs=/data/www/docs.rtems.org/doxygen/branches
+
+#
+# Handover path.
+#
+handover=/data/ftp/pub/rtems/people/chrisj/docs.rtems.org/doxygen
+
+#
+# Latest files.
+#
+latest_tags=rtems-doxygen-latest-tags
+latest_doxygen=rtems-doxygen-latest.tar.gz
+
+#
+# Current tags.
+#
+current_tags=${wwwdocs}/.tags
+
+#
+# If no update directory create it.
+#
+if [ ! -d latest ]; then
+ ${rm} -rf latest
+ ${mkdir} latest
+fi
+
+cd latest
+ update=no
+ #
+ # Download the latest tags and compare the branches in the package with the
+ # current tags.
+ #
+ if [ -f ${handover}/${latest_tags} ] && [ -f ${handover}/${latest_doxygen} ]; then
+ ${cp} ${handover}/${latest_tags} ${latest_tags}
+ if [ -f ${current_tags} ]; then
+ exec 3<& 0
+ exec 0< ${latest_tags}
+ while read line
+ do
+ branch=$(echo ${line} | ${sed} -e 's/[[:space:]].*//g')
+ latest_hash=$(echo ${line} | ${sed} -e 's/.*[[:space:]]//g')
+ current_hash=$(cat ${current_tags} | ${grep} ${branch} | ${sed} -e 's/.*[[:space:]]//g')
+ if [ "${latest_hash}" != "${current_hash}" ]; then
+ update=yes
+ fi
+ done
+ else
+ update=yes
+ fi
+ if [ ${update} = yes ]; then
+ ${rm} -rf current
+ ${cp} -r ${wwwdocs} current
+ ${cp} ${handover}/${latest_doxygen} ${latest_doxygen}
+ set +e
+ ../rtems-doxygen-unpack-branches
+ set -e
+ fi
+ ${rm} -f ${latest_tags}
+ fi
+ cd ..
+
+exit 0
diff --git a/doxygen/builder/rtems-doxygen-publish b/doxygen/builder/rtems-doxygen-publish
new file mode 100755
index 0000000..4f12eab
--- /dev/null
+++ b/doxygen/builder/rtems-doxygen-publish
@@ -0,0 +1,51 @@
+#! /bin/sh
+#
+# RTEMS Documentation Project
+#
+# Copyright 2017 Chris Johns <chrisj@rtems.org>
+# All rights reserved
+#
+# Public domain
+#
+
+#
+# Exit on error.
+#
+set -e
+
+#
+# Executables
+#
+cp=/bin/cp
+rm=/bin/rm
+
+#
+# We run where the script is located.
+#
+cd $(dirname $0)
+
+#
+# Top directory
+#
+top=$PWD
+
+#
+# The current directory.
+#
+current=/data/www/docs.rtems.org/doxygen/branches
+
+#
+# The new docs
+#
+new=${top}/latest/new
+
+#
+# If there is a new directory we have something to publsh.
+#
+if [ -d ${new} ]; then
+ ${rm} -rf ${current}.tags ${current}/*
+ ${cp} -r ${new}/.tags ${new}/* ${current}/.
+ ${rm} -rf ${new}
+fi
+
+exit 0
diff --git a/doxygen/builder/rtems-doxygen-publish-cron b/doxygen/builder/rtems-doxygen-publish-cron
new file mode 100755
index 0000000..a3d4251
--- /dev/null
+++ b/doxygen/builder/rtems-doxygen-publish-cron
@@ -0,0 +1,24 @@
+#! /bin/sh
+#
+# RTEMS Documentation Project
+#
+# Copyright 2017 Chris Johns <chrisj@rtems.org>
+# All rights reserved
+#
+# Public domain
+#
+
+#
+# Exit on error.
+#
+set -e
+
+#
+# We run where the script is located.
+#
+cd $(dirname $0)
+
+./rtems-doxygen-download
+./rtems-doxygen-publish
+
+exit 0
diff --git a/doxygen/builder/rtems-doxygen-unpack-branches b/doxygen/builder/rtems-doxygen-unpack-branches
new file mode 100755
index 0000000..299e82f
--- /dev/null
+++ b/doxygen/builder/rtems-doxygen-unpack-branches
@@ -0,0 +1,156 @@
+#! /bin/sh
+#
+# RTEMS Documentation Project
+#
+# Copyright 2017 Chris Johns <chrisj@rtems.org>
+# All rights reserved
+#
+# Public domain
+#
+
+#
+# Exit on error.
+#
+set -e
+
+#
+# Executables
+#
+cp=/bin/cp
+curl=/usr/local/bin/curl
+diff=/usr/bin/diff
+mkdir=/bin/mkdir
+mv=/bin/mv
+tar=/usr/bin/tar
+touch=/usr/bin/touch
+rm=/bin/rm
+
+#
+# Top directory
+#
+top=$PWD
+
+#
+# Directory of the latest build.
+#
+latest=latest
+
+#
+# Directory of the current website build.
+#
+current=current
+
+#
+# Directory of the current website build.
+#
+new=new
+
+#
+# New doxygen file.
+#
+latest_doxygen=rtems-doxygen-latest.tar.gz
+
+#
+# The build tags files.
+#
+latest_tags=${latest}/.tags
+current_tags=${current}/.tags
+new_tags=${new}/.tags
+
+#
+# Branches to install as current
+#
+branches="master 4.11"
+
+#
+# Logging.
+#
+log() {
+ echo $* >> ${log_file}
+}
+log_file=${top}/unpack.log
+for f in 4 3 2 1
+do
+ t=`expr $f + 1`
+ ${rm} -f ${top}/unpack-${t}.log
+ if [ -f ${top}/unpack-${f}.log ]; then
+ ${mv} ${top}/unpack-${f}.log ${top}/unpack-${t}.log
+ fi
+done
+if [ -f ${top}/unpack.log ]; then
+ ${mv} ${top}/unpack.log ${top}/unpack-1.log
+fi
+${rm} -rf ${log_file}
+
+# Unpack the latest build and check if the hashes match and if different update
+# the current with the latest.
+
+log "RTEMS Doxygen Unpack: " `date`
+
+if [ ! -d ${current} ]; then
+ log "error: no current website found"
+ exit 1
+fi
+
+#
+# Remove any new website if there is one hanging about.
+#
+log ${rm} -rf ${new}
+${rm} -rf ${new}
+log ${mkdir} ${new}
+log ${cp} -r ${current} ${new}
+${cp} -r ${current} ${new}
+
+#
+# Unpack the latest website.
+#
+log ${rm} -rf ${latest}
+${rm} -rf ${latest}
+log ${mkdir} ${latest}
+${mkdir} ${latest}
+cd latest
+ log ${tar} Jxf ../${latest_doxygen}
+ ${tar} Jxf ../${latest_doxygen}
+ cd ..
+
+#
+# if no current tag file create an empty one.
+#
+if [ ! -f ${current_tags} ]; then
+ log touch ${current_tags}
+ ${touch} ${current_tags}
+fi
+
+if [ -f ${latest_tags} ]; then
+ #
+ # Check each branch to see if the tags match.
+ #
+ for b in ${branches}
+ do
+ latest_hash=$(cat ${latest_tags} | grep ${b} | sed -e 's/.* //')
+ current_hash=$(cat ${current_tags} | grep ${b} | sed -e 's/.* //')
+ log "Latest ${b} hash: ${latest_hash}"
+ log "Current ${b} hash: ${current_hash}"
+ if [ ! -z "${latest_hash}" \
+ -a "${latest_hash}" != "${current_hash}" ]; then
+ src=${latest}/${b}
+ hash=${latest_hash}
+ if [ -d ${src} ]; then
+ log "New: ${b} from ${src} (${hash})"
+ log rm -rf ${new}/${b}
+ rm -rf ${new}/${b}
+ log cp -r ${src} ${new}/${b}
+ ${cp} -r ${src} ${new}/${b}
+ log "Update ${b} in tags"
+ cat ${new_tags} | grep -v ${b} > ${new_tags}.tmp
+ echo "${b} ${hash}" >> ${new_tags}.tmp
+ rm -f ${new_tags}
+ mv ${new_tags}.tmp ${new_tags}
+ fi
+ fi
+ done
+else
+ log "No tags found in the latest doxygen"
+fi
+
+exit 0