|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# Helper script for building online documentation |
| 4 | +# |
| 5 | +# These packages must be installed: |
| 6 | +# * doxygen |
| 7 | +# * abi-compliance-checker |
| 8 | + |
| 9 | +set -e |
| 10 | + |
| 11 | +die() { |
| 12 | + echo "$@" >&2 |
| 13 | + exit 1 |
| 14 | +} |
| 15 | + |
| 16 | +git_checkout() { |
| 17 | + BRANCH="$1" |
| 18 | + git checkout "$BRANCH" >/dev/null 2>&1 || die "$BRANCH branch not found" |
| 19 | +} |
| 20 | + |
| 21 | +make_version_dir() { |
| 22 | + # Make sure the online documentation branch exists |
| 23 | + # and does not already have a directory for this version. |
| 24 | + git_checkout gh-pages |
| 25 | + [ ! -e "$NV" ] || die "gh-pages branch already has $NV" |
| 26 | + |
| 27 | + # Create the online documentation directory for the new version. |
| 28 | + mkdir "$NV/" |
| 29 | +} |
| 30 | + |
| 31 | +build_doxygen() { |
| 32 | + # Build API documentation for exact revision of requested version |
| 33 | + echo |
| 34 | + echo "Building online API documentation in v$NV branch ..." |
| 35 | + git_checkout "v$NV" |
| 36 | + |
| 37 | + make doxygen |
| 38 | + mv docs/html "$NV/doxygen" |
| 39 | +} |
| 40 | + |
| 41 | +build_abi_compat() { |
| 42 | + # Make sure we're using latest version of check script |
| 43 | + git_checkout master |
| 44 | + |
| 45 | + # Some versions of check return error if ABI had incompatible changes |
| 46 | + set +e |
| 47 | + ./check abi "$OV" "$NV" |
| 48 | + set -e |
| 49 | + mv "compat_reports/libqb/${OV}_to_${NV}/compat_report.html" "$NV/${OV}_to_${NV}.html" |
| 50 | + rm -rf compat_reports |
| 51 | +} |
| 52 | + |
| 53 | +build_changelog() { |
| 54 | + echo |
| 55 | + echo "Building sorry excuse for a change log" |
| 56 | + |
| 57 | + # Make sure we're using latest version of changelog script |
| 58 | + git_checkout master |
| 59 | + |
| 60 | + ./build-aux/gitlog-to-changelog -- "v${OV}..v${NV}" > "$NV/Changelog.txt" |
| 61 | +} |
| 62 | + |
| 63 | +[ -x .git ] || die "This script must be run from the top-level git checkout." |
| 64 | + |
| 65 | +echo "Warning: This script changes git branches frequently and can leave you in any." |
| 66 | +echo |
| 67 | +while [ "$OV" = "" ]; do read -p "Previous version (e.g. 0.17.1): " OV; done |
| 68 | +while [ "$NV" = "" ]; do read -p "New version (e.g. 0.17.2): " NV; done |
| 69 | + |
| 70 | +make_version_dir |
| 71 | +build_doxygen |
| 72 | +build_abi_compat |
| 73 | +build_changelog |
| 74 | + |
| 75 | +# Now switch to the online documentation branch and add the new files. |
| 76 | +echo |
| 77 | +echo "Adding online documentation to gh-pages branch ..." |
| 78 | +git checkout gh-pages |
| 79 | +git add "$NV" |
| 80 | +git commit -m "Add online documentation for v$NV" |
| 81 | + |
| 82 | +echo |
| 83 | +echo "Done building online documentation for $NV." |
| 84 | +echo "If the head commit looks OK, push it to the upstream gh-pages branch," |
| 85 | +echo "and it should show up at: http://clusterlabs.github.io/libqb/" |
0 commit comments