[yocto] [RFCv3 3/7] scripts/generate_doc.sh: Add script to handle eclipse help generation

mail at timomueller.eu mail at timomueller.eu
Thu Dec 6 07:48:34 PST 2012


From: Timo Mueller <timo.mueller at bmw-carit.de>

This script will checkout the yocto-docs project containing the
official yocto documentation. After successful checkout the eclipse
help is generated and the about.html file of the doc.user plugin is
created.
---
 scripts/generate_doc.sh |   84 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100755 scripts/generate_doc.sh

diff --git a/scripts/generate_doc.sh b/scripts/generate_doc.sh
new file mode 100755
index 0000000..faab9ef
--- /dev/null
+++ b/scripts/generate_doc.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+help()
+{
+	echo "Generate and add eclipse help from yocto's documentation"
+	echo "Usage: $0 BRANCH_NAME PLUGIN_FOLDER"
+	echo "       $0 -t TAG_NAME PLUGIN_FOLDER"
+	echo ""
+	echo "Options:"
+	echo "-h - display this help and exit"
+	echo "-t TAG_NAME - tag to build the documentation upon"
+	echo "BRANCH_NAME - branch to build the documentation upon"
+	echo "PLUGIN_FOLDER - root folder of the eclipse-poky project"
+	exit 1
+}
+
+fail ()
+{
+  local retval=$1
+  shift $1
+  echo "[Fail $retval]: $*"
+  echo "BUILD_TOP=${BUILD_TOP}"
+  cd ${TOP}
+  exit ${retval}
+}
+
+CHECKOUT_TAG=0
+while getopts ":ht" opt; do
+	case $opt in
+		h)
+			help
+			;;
+		t)
+			CHECKOUT_TAG=1
+			;;
+	esac
+done
+shift $(($OPTIND - 1))
+
+if [ $# -ne 2 ]; then
+	help
+fi
+
+if [ $CHECKOUT_TAG -eq 0 ]; then
+	REFERENCE=origin/$1
+else
+	REFERENCE=$1
+fi
+PLUGIN_FOLDER=$2
+
+TOP=`pwd`
+
+DOC_DIR=${PLUGIN_FOLDER}/docs
+rm -rf ${DOC_DIR}
+DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.sdk.ide.doc.user
+DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/
+
+# git clone
+DOC_GIT=git://git.yoctoproject.org/yocto-docs.git
+git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}"
+cd ${DOC_DIR}
+git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}"
+COMMIT_ID=`git rev-parse HEAD`
+
+# build and copy
+DOCS="yocto-project-qs adt-manual kernel-manual \
+      bsp-guide poky-ref-manual dev-manual"
+
+cd documentation
+ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?`
+if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then
+	echo "WARNING:"
+	echo "This version does not support generating eclipse help"
+	echo "Documentation will not be available in eclipse"
+	exit 1
+fi
+
+for DOC in ${DOCS}; do
+	make DOC=${DOC} eclipse;
+done
+
+sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html
+
+cd ${TOP}
-- 
1.7.7.6




More information about the yocto mailing list