2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 NEC and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
16 GIT_CLONE_BASE=${GIT_CLONE_BASE:-ssh://gerrit.opnfv.org:29418}
17 GERRIT_BRANCH=${GERRIT_BRANCH:-master}
18 WORKSPACE=${WORKSPACE:-/tmp}
21 # NOTE: Not all repositories are ready for the composite docs,
22 # so we have the repo name list here to add project docs
23 # one by one. This will be replaced by the list in project.cfg .
24 # grep -v '^#' releng/jjb/opnfvdocs/project.cfg | sort
28 echo "fastpathmetrics"
41 [[ -d "$WORKSPACE/$_repo" ]] && return 0
43 git clone -b $GERRIT_BRANCH --depth 1 --quiet $GIT_CLONE_BASE/$_repo
49 repos=$(get_repo_names)
51 [[ -e docs/projects ]] && rm -rf docs/projects
52 mkdir -p docs/projects
55 echo "Cloning repos of participating OPNFV Projects and copying docs"
57 for repo in $repos; do
58 echo " $repo ($GERRIT_BRANCH)"
60 [[ -e $WORKSPACE/$repo/docs ]] || continue
61 [[ -e docs/projects/$repo ]] && rm -rf docs/projects/$repo
62 cp -r $WORKSPACE/$repo/docs docs/projects/$repo
65 # NOTE: Removing index.rst in project repos to reduce number of docs.
66 find docs/projects -type f -name 'index.rst' -print | xargs -I i rm -f i
68 # fix relative file paths
69 pattern='.. \(include\|figure\):: *[^ \/]'
70 base_path="/$(pwd)/docs_build/_src"
71 find docs/projects -type f -name '*.rst' -print | while read f
73 sed -i -e "/$pattern/s|:: *|:: $base_path/$(dirname ${f#docs/})/|" $f
77 grep -e '.. include::' -e '.. figure::' -r docs/projects
79 # NOTE: automated link generation is not ready...
81 echo "Creating document links"
84 configguide/installer-config.rst
85 configguide/feature-config.rst
86 userguide/test-usage.rst
87 userguide/feature-usage.rst
89 # configguide/post-install.rst
92 mainfile="$WORKSPACE/docs/$guide"
93 basefilename=$(basename ${guide/-/})
96 targetfile="$WORKSPACE/docs/projects/$repo/${guide/-/}"
97 targetlink="../projects/$repo/${guide/-/}"
98 projectfilename="${basefilename/.rst/-$repo.rst}"
99 projectfile="$(dirname $mainfile)/$projectfilename"
100 [[ -e "$targetfile" ]] || continue
101 echo "Adding $repo to $guide ..."
103 echo ".. toctree::" >> $mainfile
105 echo " $projectfilename" >> $mainfile
106 echo ".. include:: $targetlink" > $projectfile
109 echo "Generated $guide:"
114 $WORKSPACE/releng/utils/docs-build.sh