Skip to content

Commit e0f505e

Browse files
committed
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.
1 parent 3ada5e4 commit e0f505e

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

‎setup/apidoc/build-apidoc.sh‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,18 @@ shift
2727
DISTDIR="$1"
2828
shift
2929

30-
thisdir=$(readlink -f $(dirname "$0"))
30+
canonical_readlink ()
31+
{
32+
cd `dirname $1`;
33+
__filename=`basename $1`;
34+
if [ -h "$__filename" ]; then
35+
canonical_readlink `readlink $__filename`;
36+
else
37+
echo "`pwd -P`";
38+
fi
39+
}
3140

41+
thisdir=$(canonical_readlink $0)
3242

3343
PATHSEP=':'
3444
if [[ $OSTYPE == "cygwin" ]] ; then
@@ -50,7 +60,7 @@ java -cp $CP com.cloud.api.doc.ApiXmlDocWriter -d "$DISTDIR" $*
5060

5161
if [ $? -ne 0 ]
5262
then
53-
exit 1
63+
exit 1
5464
fi
5565

5666
set -e
@@ -61,7 +71,7 @@ set -e
6171
sed -e 's,%API_HEADER%,Root Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocforadmin.xsl
6272
sed -e 's,%API_HEADER%,Domain Admin API,g' "$thisdir/generatetoc_header.xsl" >generatetocfordomainadmin.xsl
6373

64-
python "$thisdir/gen_toc.py" $(find -type f)
74+
python "$thisdir/gen_toc.py" $(find . -type f)
6575

6676
cat generatetocforuser_include.xsl >>generatetocforuser.xsl
6777
cat generatetocforadmin_include.xsl >>generatetocforadmin.xsl

0 commit comments

Comments
 (0)