blob: 718467f08f6caf1aa7e185c3d029cade32ae971c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Called with $1 as the build directory
# $2 as the path to yocto-docs
# $3 as the path to bitbake
#
# Environment variables:
# - docs_buildtools as the path to buildtools script for the docs.
# Can be found here: https://autobuilder.yocto.io/pub/buildtools/
# - docbookarchive as the path to old (pre 3.1.5 and Sphinx migration) docs tarball
# Can be found here: https://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-archives-20201105.tar.xz
# - PUBLISH (0/1) for whether the files should be rsync'ed to docs.yoctoproject.org
set -e
set -u
set -o pipefail
set -x
builddir=$(realpath "$1")
ypdocs=$(realpath "$2/documentation/")
bbdocs=$(realpath "$3/doc/")
docs_buildtools=${docs_buildtools:-/srv/autobuilder/autobuilder.yocto.io/pub/buildtools/x86_64-buildtools-docs-nativesdk-standalone-4.1.2.sh}
outputdir=$builddir/output
scriptdir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
PUBLISH=${PUBLISH:-1}
cd $builddir
mkdir buildtools
$docs_buildtools -y -d $builddir/buildtools
. $builddir/buildtools/environment-setup*
# Getting the old docbook built docs from an archive. Not rebuilding them.
#wget https://downloads.yoctoproject.org/mirror/docbook-mirror/docbook-archives-20201105.tar.xz
docbookarchive=${docbookarchive:-/srv/autobuilder/autobuilder.yocto.io/pub/docbook-mirror/docbook-archives-20201105.tar.xz}
mkdir $outputdir
cd $outputdir
echo Extracing old content from archive
tar --exclude=eclipse -xJf $docbookarchive
$scriptdir/docs_add_banner.py
cd $bbdocs
mkdir $outputdir/bitbake
# A decision was made to keep updating all the Sphinx generated docs for the moment,
# even the ones corresponding to no longer supported releases
# https://lists.yoctoproject.org/g/docs/message/2193
# We copy the releases.rst file from master so that all versions of the docs
# see the latest releases.
first_sphinx_commit=84ccba0f4aff91528f764523fe1205a354c889ed
latest_branch=$(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)' --sort='-version:refname' | grep --max-count=1 "[0-9]*\.[0-9]*")
for branch in 1.46 $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)'); do
if [ "$branch" = "HEAD" ]; then
continue
fi
echo Building bitbake $branch branch
git checkout $branch
git reset --hard
git clean -ffdx
git checkout origin/master releases.rst
make clean
SPHINXOPTS="-j auto" make publish
if [ "$branch" = "master-next" ]; then
branch="next"
mkdir $outputdir/bitbake/$branch
elif [ "$branch" = "master" ]; then
branch="dev"
mkdir $outputdir/bitbake/$branch
elif [ "$branch" = "$latest_branch" ]; then
branch=""
mkdir $outputdir/bitbake/$latest_branch
cp -r ./_build/final/* $outputdir/bitbake/$latest_branch
else
mkdir $outputdir/bitbake/$branch
fi
cp -r ./_build/final/* $outputdir/bitbake/$branch
git reset --hard
git clean -ffdx
done
if [ "$PUBLISH" -ne 0 ]; then
# only sync bitbake folder for now. We need bitbake to be published first
# since the bitbake intersphinx index will be downloaded to build yocto-docs
cd $outputdir
rsync -irlp --checksum --ignore-times --delete bitbake docs@docs.yoctoproject.org:docs/
fi
cd $ypdocs
# transition must build after master for the switchers.js file
# Again, keeping even the no longer supported releases (see above comment)
first_sphinx_commit=01dd5af7954e24552aca022917669b27bb0541ed
first_dunfell_sphinx_commit=c25fe058b88b893b0d146f3ed27320b47cdec236
git checkout origin/master set_versions.py
#latest_tag=$(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" --sort="version:refname" 'yocto-*' | tail -1 | sed 's/yocto-//')
latest_tag=$(./set_versions.py getlatest)
git reset --hard
git clean -ffdx
for branch in dunfell $(git branch --remote --contains "$first_sphinx_commit" --format '%(refname:lstrip=3)') $(git tag --contains "$first_sphinx_commit" --contains "$first_dunfell_sphinx_commit" 'yocto-*') transition; do
if [ "$branch" = "HEAD" ]; then
continue
fi
# Do not build <release>-next branches as they are development branches only
# Do build master-next branch though!
if echo "$branch" | grep -v "master-next" | grep -q -E "-next$"; then
continue
fi
echo Building $branch
git checkout $branch
git reset --hard
git clean -ffdx
if [ -e "${scriptdir}/docs-build-patches/${branch}/" ]; then
echo Adding patch for $branch
git am "${scriptdir}/docs-build-patches/${branch}/"000*
fi
git checkout origin/master sphinx-static/switchers.js.in set_versions.py
if [ -e poky.yaml ]; then
cp poky.yaml poky.yaml.in
case $branch in
yocto-*)
./set_versions.py $(echo "$branch" | sed 's/yocto-//')
;;
*)
./set_versions.py
;;
esac
fi
make clean
SPHINXOPTS="-j auto" make publish
# Strip yocto- from tag names
branch=$(echo "$branch" | sed 's/yocto-//')
if [ "$branch" = "master-next" ]; then
branch="next"
mkdir -p $outputdir/$branch
elif [ "$branch" = "master" ]; then
branch="dev"
mkdir -p $outputdir/$branch
elif [ "$branch" = "$latest_tag" ]; then
branch=""
mkdir -p $outputdir/$latest_tag
cp -r ./_build/final/* $outputdir/$latest_tag
echo Linking to $latest_tag as current
ln -s $latest_tag $outputdir/current
elif [ "$branch" = "transition" ]; then
branch=""
else
mkdir -p $outputdir/$branch
fi
cp -r ./_build/final/* $outputdir/$branch
git reset --hard
git clean -ffdx
done
# Update bitbake switchers.js with the copy from master ypdocs
cd $outputdir/bitbake
find . -name switchers.js -exec cp $outputdir/current/_static/switchers.js {} \;
if [ "$PUBLISH" -ne 0 ]; then
cd $outputdir
rsync -irlp --checksum --ignore-times --delete . docs@docs.yoctoproject.org:docs/
fi
|