From e0f505e36f0074607c673f88ce416062e434ca07 Mon Sep 17 00:00:00 2001 From: Chip Childers Date: Wed, 22 Aug 2012 15:33:17 -0400 Subject: [PATCH] Patch from Greg Burd: Improve portability of the build-apidoc.sh script by replacing readlink Review: https://reviews.apache.org/r/6733/ Testing: Applied patch, and ran 'ant clean-all build-apidocs' on both OSX and Ubuntu 12. Initial testing confirmed the issue that Greg discovered on OSX. After the patch, the docs built correctly. --- setup/apidoc/build-apidoc.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/setup/apidoc/build-apidoc.sh b/setup/apidoc/build-apidoc.sh index 618273f74fe..14d6459d0c6 100644 --- a/setup/apidoc/build-apidoc.sh +++ b/setup/apidoc/build-apidoc.sh @@ -27,8 +27,18 @@ shift DISTDIR="$1" shift -thisdir=$(readlink -f $(dirname "$0")) +canonical_readlink () +{ + cd `dirname $1`; + __filename=`basename $1`; + if [ -h "$__filename" ]; then + canonical_readlink `readlink $__filename`; + else + echo "`pwd -P`"; + fi +} +thisdir=$(canonical_readlink $0) PATHSEP=':' if [[ $OSTYPE == "cygwin" ]] ; then @@ -50,7 +60,7 @@ java -cp $CP com.cloud.api.doc.ApiXmlDocWriter -d "$DISTDIR" $* if [ $? -ne 0 ] then - exit 1 + exit 1 fi set -e @@ -61,7 +71,7 @@ set -e sed -e 's,%API_HEADER%,Root Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocforadmin.xsl sed -e 's,%API_HEADER%,Domain Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocfordomainadmin.xsl - python "$thisdir/gen_toc.py" $(find -type f) + python "$thisdir/gen_toc.py" $(find . -type f) cat generatetocforuser_include.xsl >>generatetocforuser.xsl cat generatetocforadmin_include.xsl >>generatetocforadmin.xsl