summaryrefslogtreecommitdiff
path: root/doxygen/builder/rtems-doxygen-unpack-branches
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-09-15 01:22:03 +0000
committerChris Johns <chrisj@rtems.org>2017-09-15 01:22:03 +0000
commita5294ea7d40d3370e8e29cee57dd48baf5fad4da (patch)
tree8f7d5ed8530af8a5d50af9b312beb56903bd7c86 /doxygen/builder/rtems-doxygen-unpack-branches
parent55e1973c05243c5c92390762a12f36da9c4870af (diff)
Add doxygen publishing scripts.
Diffstat (limited to 'doxygen/builder/rtems-doxygen-unpack-branches')
-rwxr-xr-xdoxygen/builder/rtems-doxygen-unpack-branches156
1 files changed, 156 insertions, 0 deletions
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