aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2020-02-27 19:10:17 +0100
committerUlrich Müller <ulm@gentoo.org>2020-02-28 07:17:47 +0100
commite01ceaed422f53a782300feaebf252773e78c2e4 (patch)
tree136f045ac26150eccd0d2d805198ced17bea3bd5 /bin
parentMakefile: Quieten the documents.js recipe. (diff)
downloaddevmanual-e01ceaed422f53a782300feaebf252773e78c2e4.tar.gz
devmanual-e01ceaed422f53a782300feaebf252773e78c2e4.tar.bz2
devmanual-e01ceaed422f53a782300feaebf252773e78c2e4.zip
bin/gen-eclass-html.sh: New option -n to create a placeholder file.
The new strict dependencies will cause the build to fail if eclass-reference/text.xml is missing, because it is needed as a dependency for index.html of the previous and next documents. Add an option that makes it possible to create the file, even if the eclass documentation is missing. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gen-eclass-html.sh50
1 files changed, 43 insertions, 7 deletions
diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh
index 10292eb..ed43090 100755
--- a/bin/gen-eclass-html.sh
+++ b/bin/gen-eclass-html.sh
@@ -100,8 +100,35 @@ guesscompress() {
esac
}
-# We also need the ebuild man page
-for i in $(/usr/bin/qlist eclass-manpages) /usr/share/man/man5/ebuild.5*; do
+usage() {
+ cat <<- EOF >&2
+ Usage: $0 [OPTION]...
+ Convert eclass man pages to HTML.
+
+ -n do not build anything, only create a placeholder index
+ -h display this help and exit
+ EOF
+}
+
+while getopts 'nh' opt; do
+ case ${opt} in
+ n) NOMAN=true ;;
+ h) usage; exit 0 ;;
+ *) usage; exit 1 ;;
+ esac
+done
+shift $((OPTIND-1))
+
+MANPAGES=()
+[[ -n ${NOMAN} ]] || MANPAGES=(
+ $(/usr/bin/qlist eclass-manpages)
+ # We also need the ebuild man page
+ /usr/share/man/man5/ebuild.5*
+)
+
+[[ -d ${OUTPUTDIR} ]] || mkdir -p "${OUTPUTDIR}" || exit 1
+
+for i in "${MANPAGES[@]}"; do
FILEBASE=${i##*/}
BASENAME="${FILEBASE%.5*}"
[[ ${BASENAME} != "${FILEBASE}" ]] || continue
@@ -150,15 +177,24 @@ installed by emerging <c>app-doc/eclass-manpages</c>.
<section>
<title>Contents</title>
<body>
-<ul class="list-group">
EOF
-for i in $(find $OUTPUTDIR/ -maxdepth 1 -mindepth 1 -type d | sort); do
- echo "<li><uri link=\"$(basename $i)/index.html\">$(basename $i)</uri></li>" >> ${OUTPUTDIR}/text.xml
-done
+if [[ -n ${NOMAN} ]]; then
+ cat <<- EOF >> "${OUTPUTDIR}"/text.xml
+ <warning>
+ This is only a placeholder. If you see this text in the output document,
+ then the eclass documentation is missing.
+ </warning>
+ EOF
+else
+ echo '<ul class="list-group">' >> "${OUTPUTDIR}"/text.xml
+ for i in $(find "${OUTPUTDIR}" -maxdepth 1 -mindepth 1 -type d | sort); do
+ echo "<li><uri link=\"$(basename $i)/index.html\">$(basename $i)</uri></li>" >> "${OUTPUTDIR}"/text.xml
+ done
+ echo '</ul>' >> "${OUTPUTDIR}"/text.xml
+fi
cat << EOF >> ${OUTPUTDIR}/text.xml
-</ul>
</body>
</section>
</chapter>