1 |
commit: e01ceaed422f53a782300feaebf252773e78c2e4 |
2 |
Author: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Feb 27 18:10:17 2020 +0000 |
4 |
Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Feb 28 06:17:47 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=e01ceaed |
7 |
|
8 |
bin/gen-eclass-html.sh: New option -n to create a placeholder file. |
9 |
|
10 |
The new strict dependencies will cause the build to fail if |
11 |
eclass-reference/text.xml is missing, because it is needed as |
12 |
a dependency for index.html of the previous and next documents. |
13 |
Add an option that makes it possible to create the file, even if |
14 |
the eclass documentation is missing. |
15 |
|
16 |
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org> |
17 |
|
18 |
bin/gen-eclass-html.sh | 50 +++++++++++++++++++++++++++++++++++++++++++------- |
19 |
1 file changed, 43 insertions(+), 7 deletions(-) |
20 |
|
21 |
diff --git a/bin/gen-eclass-html.sh b/bin/gen-eclass-html.sh |
22 |
index 10292eb..ed43090 100755 |
23 |
--- a/bin/gen-eclass-html.sh |
24 |
+++ b/bin/gen-eclass-html.sh |
25 |
@@ -100,8 +100,35 @@ guesscompress() { |
26 |
esac |
27 |
} |
28 |
|
29 |
-# We also need the ebuild man page |
30 |
-for i in $(/usr/bin/qlist eclass-manpages) /usr/share/man/man5/ebuild.5*; do |
31 |
+usage() { |
32 |
+ cat <<- EOF >&2 |
33 |
+ Usage: $0 [OPTION]... |
34 |
+ Convert eclass man pages to HTML. |
35 |
+ |
36 |
+ -n do not build anything, only create a placeholder index |
37 |
+ -h display this help and exit |
38 |
+ EOF |
39 |
+} |
40 |
+ |
41 |
+while getopts 'nh' opt; do |
42 |
+ case ${opt} in |
43 |
+ n) NOMAN=true ;; |
44 |
+ h) usage; exit 0 ;; |
45 |
+ *) usage; exit 1 ;; |
46 |
+ esac |
47 |
+done |
48 |
+shift $((OPTIND-1)) |
49 |
+ |
50 |
+MANPAGES=() |
51 |
+[[ -n ${NOMAN} ]] || MANPAGES=( |
52 |
+ $(/usr/bin/qlist eclass-manpages) |
53 |
+ # We also need the ebuild man page |
54 |
+ /usr/share/man/man5/ebuild.5* |
55 |
+) |
56 |
+ |
57 |
+[[ -d ${OUTPUTDIR} ]] || mkdir -p "${OUTPUTDIR}" || exit 1 |
58 |
+ |
59 |
+for i in "${MANPAGES[@]}"; do |
60 |
FILEBASE=${i##*/} |
61 |
BASENAME="${FILEBASE%.5*}" |
62 |
[[ ${BASENAME} != "${FILEBASE}" ]] || continue |
63 |
@@ -150,15 +177,24 @@ installed by emerging <c>app-doc/eclass-manpages</c>. |
64 |
<section> |
65 |
<title>Contents</title> |
66 |
<body> |
67 |
-<ul class="list-group"> |
68 |
EOF |
69 |
|
70 |
-for i in $(find $OUTPUTDIR/ -maxdepth 1 -mindepth 1 -type d | sort); do |
71 |
- echo "<li><uri link=\"$(basename $i)/index.html\">$(basename $i)</uri></li>" >> ${OUTPUTDIR}/text.xml |
72 |
-done |
73 |
+if [[ -n ${NOMAN} ]]; then |
74 |
+ cat <<- EOF >> "${OUTPUTDIR}"/text.xml |
75 |
+ <warning> |
76 |
+ This is only a placeholder. If you see this text in the output document, |
77 |
+ then the eclass documentation is missing. |
78 |
+ </warning> |
79 |
+ EOF |
80 |
+else |
81 |
+ echo '<ul class="list-group">' >> "${OUTPUTDIR}"/text.xml |
82 |
+ for i in $(find "${OUTPUTDIR}" -maxdepth 1 -mindepth 1 -type d | sort); do |
83 |
+ echo "<li><uri link=\"$(basename $i)/index.html\">$(basename $i)</uri></li>" >> "${OUTPUTDIR}"/text.xml |
84 |
+ done |
85 |
+ echo '</ul>' >> "${OUTPUTDIR}"/text.xml |
86 |
+fi |
87 |
|
88 |
cat << EOF >> ${OUTPUTDIR}/text.xml |
89 |
-</ul> |
90 |
</body> |
91 |
</section> |
92 |
</chapter> |