]> git.proxmox.com Git - ceph.git/blobdiff - ceph/admin/build-doc
import ceph 15.2.13
[ceph.git] / ceph / admin / build-doc
index 0caa048767c8ac01c06d0ed4c5c7ca8829969b75..c38208e8439fb2ffd03427a1f2459207f45291dd 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -e
 
 cd "$(dirname "$0")"
 cd ..
@@ -20,8 +20,8 @@ if command -v dpkg >/dev/null; then
         exit 1
     fi
 elif command -v yum >/dev/null; then
-    for package in python-devel python-pip python-virtualenv doxygen ditaa ant libxml2-devel libxslt-devel Cython graphviz; do
-       if ! rpm -q $package >/dev/null ; then
+    for package in ant ditaa doxygen libxslt-devel libxml2-devel graphviz python3-devel python3-pip python3-virtualenv python3-Cython; do
+       if ! rpm -q --whatprovides $package >/dev/null ; then
                missing="${missing:+$missing }$package"
        fi
     done
@@ -50,16 +50,20 @@ fi
 # for availability of commands
 set -e
 
-cat $TOPDIR/src/osd/PG.h $TOPDIR/src/osd/PG.cc | $TOPDIR/doc/scripts/gen_state_diagram.py > $TOPDIR/doc/dev/peering_graph.generated.dot
+cat $TOPDIR/src/osd/PeeringState.h $TOPDIR/src/osd/PeeringState.cc | $TOPDIR/doc/scripts/gen_state_diagram.py > $TOPDIR/doc/dev/peering_graph.generated.dot
 
 cd build-doc
 
 [ -z "$vdir" ] && vdir="$TOPDIR/build-doc/virtualenv"
 
 if [ ! -e $vdir ]; then
-    virtualenv --system-site-packages $vdir -p python2
+    virtualenv --python=python3 $vdir
 fi
-$vdir/bin/pip install --quiet -r $TOPDIR/admin/doc-requirements.txt
+
+$vdir/bin/pip install --quiet --upgrade pip setuptools
+$vdir/bin/pip install --quiet \
+              -r $TOPDIR/admin/doc-requirements.txt \
+              -r $TOPDIR/admin/doc-python-common-requirements.txt
 
 install -d -m0755 \
     $TOPDIR/build-doc/output/html \
@@ -85,10 +89,20 @@ for bind in rados rbd cephfs rgw; do
     BUILD_DOC=1 \
         CFLAGS="-iquote$TOPDIR/src/include" \
         CPPFLAGS="-iquote$TOPDIR/src/include" \
-        LDFLAGS="-L$vdir/lib -Wl,--no-as-needed" \
-        $vdir/bin/pip install $TOPDIR/src/pybind/${bind}
+        LDFLAGS="-L$vdir/lib -Wl,--no-as-needed,-rpath=$vdir/lib" \
+        $vdir/bin/pip install --upgrade $TOPDIR/src/pybind/${bind}
     # rgwfile_version(), librgw_create(), rgw_mount()
-    nm $vdir/lib/python*/*-packages/${bind}.so | grep -E "U (lib)?${bind}" | \
+    # since py3.5, distutils adds postfix in between ${bind} and so
+    lib_fn=$vdir/lib/python*/*-packages/${bind}.*.so
+    if [ ! -e $lib_fn ]; then
+       lib_fn=$vdir/lib/python*/*-packages/${bind}.so
+    fi
+    if [ ${bind} = "cephfs" ]; then
+        func_prefix="ceph"
+    else
+        func_prefix="(lib)?${bind}"
+    fi
+    nm $lib_fn | grep -E "U ${func_prefix}" | \
         awk '{ print "void "$2"(void) {}" }' | \
         gcc -shared -o $vdir/lib/lib${bind}.so.1 -xc -
     if [ ${bind} != rados ]; then
@@ -106,15 +120,37 @@ for target in $sphinx_targets; do
     case $target in
         html)
             builder=dirhtml
+            extra_opt="-D graphviz_output_format=svg"
             ;;
         man)
             extra_opt="-t man"
             ;;
     esac
-    $vdir/bin/sphinx-build -a -b $builder $extra_opt -d doctrees \
+    # Build with -W so that warnings are treated as errors and this fails
+    $vdir/bin/sphinx-build -W --keep-going -a -b $builder $extra_opt -d doctrees \
                            $TOPDIR/doc $TOPDIR/build-doc/output/$target
+
+
 done
 
+# build the releases.json. this reads in the yaml version and dumps
+# out the json representation of the same file. the resulting releases.json
+# should be served from the root of hosted site.
+$vdir/bin/python << EOF > $TOPDIR/build-doc/output/html/releases.json
+from __future__ import print_function
+import datetime
+import json
+import yaml
+
+def json_serialize(obj):
+    if isinstance(obj, datetime.date):
+        return obj.isoformat()
+
+with open("$TOPDIR/doc/releases/releases.yml", 'r') as fp:
+    releases = yaml.safe_load(fp)
+    print(json.dumps(releases, indent=2, default=json_serialize))
+EOF
+
 #
 # Build and install JavaDocs
 #
@@ -131,3 +167,5 @@ mkdir $JAVA_OUTDIR
 
 # Copy JavaDocs to target directory
 cp -a $JAVADIR/doc/* $JAVA_OUTDIR/
+
+echo "SUCCESS"