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.
This commit is contained in:
Chip Childers 2012-08-22 15:33:17 -04:00
parent 3ada5e4a46
commit e0f505e36f

View File

@ -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