Gentoo Archives: gentoo-commits

From: "Göktürk Yüksek" <gokturk@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/devmanual:master commit in: eclass-writing/
Date: Mon, 31 Oct 2016 01:21:52
Message-Id: 1477876185.96238236a114e621cad58f6aa00580ec7f8345e0.gokturk@gentoo
1 commit: 96238236a114e621cad58f6aa00580ec7f8345e0
2 Author: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 30 00:33:15 2016 +0000
4 Commit: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
5 CommitDate: Mon Oct 31 01:09:45 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=96238236
7
8 eclass-writing: improve the eclass documentation sections #373145
9
10 Replace the eclass documentation text blobs from eclass-manpages with
11 tables. Add a section for eclass function variables.
12
13 Gentoo-Bug: https://bugs.gentoo.org/373145
14
15 eclass-writing/text.xml | 471 ++++++++++++++++++++++++++++++++++++++++++------
16 1 file changed, 418 insertions(+), 53 deletions(-)
17
18 diff --git a/eclass-writing/text.xml b/eclass-writing/text.xml
19 index 9329d88..1fe2ec1 100644
20 --- a/eclass-writing/text.xml
21 +++ b/eclass-writing/text.xml
22 @@ -125,24 +125,21 @@ adhere to the following process:</p>
23 <body>
24
25 <p>
26 -Eclasses are documented as any other bash project is, with code
27 -comments. We do however have a standard format for eclass, variable,
28 -and function headers. The <c>app-portage/eclass-manpages</c> package
29 -processes these headers to create documentation for the eclass. The
30 -result can be seen in our <uri link="::eclass-reference/">eclass
31 -reference</uri>, or by installing <c>app-portage/eclass-manpages</c>.
32 +Eclasses are documented with comment blocks that follow a special
33 +markup syntax. The comment blocks are separated by blank lines and
34 +each block documents an individual element of an eclass.
35 </p>
36 +
37 <p>
38 -The format for eclass, variable, and function headers are described
39 -below. Before committing your eclass, please ensure that the
40 -<c>eclass-to-manpage.sh</c> script (currently in <c>$FILESDIR</c> for
41 -<c>app-portage/eclass-manpages</c> in the <c>gentoo.git</c> repo) does
42 -not report any errors or serious warnings for your eclass.
43 +Documentation tags for various eclass elements are explained in their
44 +respective sections below. Common to all the tags that accept
45 +multiline freetext, the <c>@CODE</c> tag should be used when necessary
46 +to create unformatted code chunks (such as example code) by placing
47 +the tag at the beginning and the end.
48 </p>
49 </body>
50 </section>
51
52 -
53 <section>
54 <title>Basic Eclass Format</title>
55 <body>
56 @@ -157,26 +154,135 @@ underscores and dots. Eclasses are not intrinsically versioned.
57 <p>
58 Eclasses should start with the standard ebuild header, along with
59 comments explaining the maintainer and purpose of the eclass, and any
60 -other relevant documentation. The format supported by
61 -<c>app-portage/eclass-manpages</c> is as follows:
62 +other relevant documentation. Eclass documentation block should be the
63 +first documentation block to appear in the eclass. The following table
64 +summarizes the available documentation tags:
65 </p>
66
67 -<codesample lang="ebuild">
68 -# @ECLASS: foo.eclass
69 -# @MAINTAINER:
70 -# &lt;required; list of contacts, one per line&gt;
71 -# @AUTHOR:
72 -# &lt;optional; list of authors, one per line&gt;
73 -# @BUGREPORTS:
74 -# &lt;optional; description of how to report bugs;
75 -# default: tell people to use bugs.gentoo.org&gt;
76 -# @VCSURL: &lt;optional; url to vcs for this eclass; default: https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/@ECLASS@&gt;
77 -# @BLURB: &lt;required; short description&gt;
78 -# @DESCRIPTION:
79 -# &lt;optional; long description&gt;
80 -# @EXAMPLE:
81 -# &lt;optional; example usage&gt;
82 -</codesample>
83 +<table>
84 +<tr>
85 + <th>tag</th>
86 + <th>optional?</th>
87 + <th>arguments</th>
88 + <th>description</th>
89 +</tr>
90 +<tr>
91 + <ti>
92 + <c>@ECLASS:</c>
93 + </ti>
94 + <ti>
95 + NO
96 + </ti>
97 + <ti>
98 + Name of the eclass being documented.
99 + </ti>
100 + <ti>
101 + Documents various information about the eclass. Must appear as the
102 + first tag in the comment block.
103 + </ti>
104 +</tr>
105 +<tr>
106 + <ti>
107 + <c>@MAINTAINER:</c>
108 + </ti>
109 + <ti>
110 + NO
111 + </ti>
112 + <ti>
113 + One or more name and email pairs.
114 + </ti>
115 + <ti>
116 + List of maintainers for the eclass to be contacted. One line per
117 + maintainer. Must start on a newline after the tag.
118 + </ti>
119 +</tr>
120 +<tr>
121 + <ti>
122 + <c>@AUTHOR:</c>
123 + </ti>
124 + <ti>
125 + YES
126 + </ti>
127 + <ti>
128 + One or more name and email pairs.
129 + </ti>
130 + <ti>
131 + List of authors for the eclass. One line per author. Must start on
132 + a newline after the tag.
133 + </ti>
134 +</tr>
135 +<tr>
136 + <ti>
137 + <c>@BUGREPORTS:</c>
138 + </ti>
139 + <ti>
140 + YES
141 + </ti>
142 + <ti>
143 + Multiline freetext.
144 + </ti>
145 + <ti>
146 + Describes how bugs related to this eclass should be reported.
147 + </ti>
148 +</tr>
149 +<tr>
150 + <ti>
151 + <c>@VCSURL:</c>
152 + </ti>
153 + <ti>
154 + YES
155 + </ti>
156 + <ti>
157 + A URI string.
158 + </ti>
159 + <ti>
160 + Points to the URL of the VCS that contains the eclass source.
161 + </ti>
162 +</tr>
163 +<tr>
164 + <ti>
165 + <c>@BLURB:</c>
166 + </ti>
167 + <ti>
168 + NO
169 + </ti>
170 + <ti>
171 + Single line freetext.
172 + </ti>
173 + <ti>
174 + Contains a short description for the eclass. Must be on the same
175 + line with the tag.
176 + </ti>
177 +</tr>
178 +<tr>
179 + <ti>
180 + <c>@DESCRIPTION:</c>
181 + </ti>
182 + <ti>
183 + YES
184 + </ti>
185 + <ti>
186 + Multiline freetext.
187 + </ti>
188 + <ti>
189 + Long description for the eclass.
190 + </ti>
191 +</tr>
192 +<tr>
193 + <ti>
194 + <c>@EXAMPLE:</c>
195 + </ti>
196 + <ti>
197 + YES
198 + </ti>
199 + <ti>
200 + Multiline freetext.
201 + </ti>
202 + <ti>
203 + Examples that illustrate various uses of this eclass.
204 + </ti>
205 +</tr>
206 +</table>
207
208 </body>
209 </section>
210 @@ -190,21 +296,95 @@ Top level variables may be defined as for ebuilds. If any USE flags are
211 used, <c>IUSE</c> must be set. The <c>KEYWORDS</c> variable must <b>not</b> be set in an
212 eclass.
213 </p>
214 +
215 <p>
216 You should document the meaning, usage, and default value of every
217 -variable in your eclass. The standard format supported by
218 -<c>app-portage/eclass-manpages</c> is,
219 +variable in your eclass. The tags available for documenting eclass
220 +variables are as follows:
221 </p>
222
223 -<codesample lang="ebuild">
224 -# @ECLASS-VARIABLE: foo
225 -# [@DEFAULT_UNSET]
226 -# [@INTERNAL]
227 -# [@REQUIRED]
228 -# @DESCRIPTION:
229 -# &lt;required; blurb about this variable&gt;
230 -# foo=&quot;&lt;default value&gt;&quot;
231 -</codesample>
232 +<table>
233 +<tr>
234 + <th>tag</th>
235 + <th>optional?</th>
236 + <th>arguments</th>
237 + <th>description</th>
238 +</tr>
239 +<tr>
240 + <ti nowrap="nowrap">
241 + <c>@ECLASS-VARIABLE:</c>
242 + </ti>
243 + <ti>
244 + NO
245 + </ti>
246 + <ti>
247 + Name of the eclass variable to which the documentation applies.
248 + </ti>
249 + <ti>
250 + This tag applies to eclass specific variables that affect the
251 + default behavior of the eclass. Read-only variables, which are
252 + exported by the eclass for developer use, are also documented with
253 + this tag. Must appear as the first tag in the comment block.
254 + </ti>
255 +</tr>
256 +<tr>
257 + <ti>
258 + <c>@DEFAULT_UNSET</c>
259 + </ti>
260 + <ti>
261 + YES
262 + </ti>
263 + <ti>
264 + <d/>
265 + </ti>
266 + <ti>
267 + Indicates that this variable is unset by default if not set by the
268 + developer.
269 + </ti>
270 +</tr>
271 +<tr>
272 + <ti>
273 + <c>@INTERNAL</c>
274 + </ti>
275 + <ti>
276 + YES
277 + </ti>
278 + <ti>
279 + <d/>
280 + </ti>
281 + <ti>
282 + Indicates that the variable is internal to the eclass.
283 + </ti>
284 +</tr>
285 +<tr>
286 + <ti>
287 + <c>@REQUIRED</c>
288 + </ti>
289 + <ti>
290 + YES
291 + </ti>
292 + <ti>
293 + <d/>
294 + </ti>
295 + <ti>
296 + Indicates that this variable must be set by the developer.
297 + </ti>
298 +</tr>
299 +<tr>
300 + <ti>
301 + <c>@DESCRIPTION:</c>
302 + </ti>
303 + <ti>
304 + NO
305 + </ti>
306 + <ti>
307 + Multiline freetext.
308 + </ti>
309 + <ti>
310 + Long description for the eclass variable.
311 + </ti>
312 +</tr>
313 +</table>
314
315 </body>
316 </section>
317 @@ -217,22 +397,207 @@ variable in your eclass. The standard format supported by
318 Eclasses may define functions. These functions will be visible to anything which
319 inherits the eclass.
320 </p>
321 +
322 <p>
323 You should document the purpose, arguments, usage, and return value of
324 -every function in your eclass. The standard format supported by
325 -<c>app-portage/eclass-manpages</c> is,
326 +every function in your eclass. The standard tags available for
327 +documentation are:
328 </p>
329
330 -<codesample lang="ebuild">
331 -# @FUNCTION: foo
332 -# @USAGE: &lt;required arguments to foo&gt; [optional arguments to foo]
333 -# @RETURN: &lt;whatever foo returns&gt;
334 -# @MAINTAINER:
335 -# &lt;optional; list of contacts, one per line&gt;
336 -# [@INTERNAL]
337 -# @DESCRIPTION:
338 -# &lt;required if no @RETURN; blurb about this function&gt;
339 -</codesample>
340 +<table>
341 +<tr>
342 + <th>tag</th>
343 + <th>optional?</th>
344 + <th>arguments</th>
345 + <th>description</th>
346 +</tr>
347 +<tr>
348 + <ti>
349 + <c>@FUNCTION:</c>
350 + </ti>
351 + <ti>
352 + NO
353 + </ti>
354 + <ti>
355 + Name of the function to which the documentation block applies.
356 + </ti>
357 + <ti>
358 + Documents information about an eclass function such as its calling
359 + convention etc. Must appear as the first tag in the comment block.
360 + </ti>
361 +</tr>
362 +<tr>
363 + <ti>
364 + <c>@USAGE:</c>
365 + </ti>
366 + <ti>
367 + NO
368 + </ti>
369 + <ti>
370 + List of required and optional arguments to the function.
371 + </ti>
372 + <ti>
373 + List of arguments that the eclass function accepts, specified in
374 + the following syntax: <c>&lt;</c>Required arguments<c>&gt;</c>
375 + <c>[</c>Optional arguments<c>]</c>
376 + </ti>
377 +</tr>
378 +<tr>
379 + <ti>
380 + <c>@RETURN:</c>
381 + </ti>
382 + <ti>
383 + <b>*</b>
384 + </ti>
385 + <ti>
386 + Return value of the function.
387 + </ti>
388 + <ti>
389 + <p>Description for the value returned by the function.</p>
390 + <p><b>*</b>: Not optional for functions that return a value.</p>
391 + </ti>
392 +</tr>
393 +<tr>
394 + <ti>
395 + <c>@MAINTAINER:</c>
396 + </ti>
397 + <ti>
398 + YES
399 + </ti>
400 + <ti>
401 + Multiline freetext.
402 + </ti>
403 + <ti>
404 + List of contacts for the eclass function. One line per
405 + maintainer. Must start on a newline after the tag.
406 + </ti>
407 +</tr>
408 +<tr>
409 + <ti>
410 + <c>@INTERNAL</c>
411 + </ti>
412 + <ti>
413 + YES
414 + </ti>
415 + <ti>
416 + <d/>
417 + </ti>
418 + <ti>
419 + Indicates that the function is internal to the eclass and should
420 + not be called from outside.
421 + </ti>
422 +</tr>
423 +<tr>
424 + <ti>
425 + <c>@DESCRIPTION:</c>
426 + </ti>
427 + <ti>
428 + <b>*</b>
429 + </ti>
430 + <ti>
431 + Multiline freetext.
432 + </ti>
433 + <ti>
434 + <p>Long description for the eclass function.</p>
435 + <p><b>*:</b> Not optional if <c>RETURN:</c> is absent.</p>
436 + </ti>
437 +</tr>
438 +</table>
439 +
440 +</body>
441 +</section>
442 +<section>
443 +<title>Eclass Function Variables</title>
444 +<body>
445 +
446 +<p>
447 +Eclass functions may make use of variables just like any other bash
448 +function. Special function-specific variables should be documented
449 +using the following tags:
450 +</p>
451 +
452 +<table>
453 +<tr>
454 + <th>tag</th>
455 + <th>optional?</th>
456 + <th>arguments</th>
457 + <th>description</th>
458 +</tr>
459 +<tr>
460 + <ti>
461 + <c>@VARIABLE:</c>
462 + </ti>
463 + <ti>
464 + NO
465 + </ti>
466 + <ti>
467 + Name of the function-specific variable to which the documentation applies.
468 + </ti>
469 + <ti>
470 + This tag applies to variables consumed by specific functions of
471 + the eclass. They are in effect only when the specific function is
472 + called.
473 + </ti>
474 +</tr>
475 +<tr>
476 + <ti>
477 + <c>@DEFAULT_UNSET</c>
478 + </ti>
479 + <ti>
480 + YES
481 + </ti>
482 + <ti>
483 + <d/>
484 + </ti>
485 + <ti>
486 + Indicates that this variable is unset by default if not set by the
487 + developer.
488 + </ti>
489 +</tr>
490 +<tr>
491 + <ti>
492 + <c>@INTERNAL</c>
493 + </ti>
494 + <ti>
495 + YES
496 + </ti>
497 + <ti>
498 + <d/>
499 + </ti>
500 + <ti>
501 + Indicates that the variable is internal to the eclass function.
502 + </ti>
503 +</tr>
504 +<tr>
505 + <ti>
506 + <c>@REQUIRED</c>
507 + </ti>
508 + <ti>
509 + YES
510 + </ti>
511 + <ti>
512 + <d/>
513 + </ti>
514 + <ti>
515 + Indicates that this variable must be set by the developer.
516 + </ti>
517 +</tr>
518 +<tr>
519 + <ti>
520 + <c>@DESCRIPTION:</c>
521 + </ti>
522 + <ti>
523 + NO
524 + </ti>
525 + <ti>
526 + Multiline freetext.
527 + </ti>
528 + <ti>
529 + Long description for the function variable.
530 + </ti>
531 +</tr>
532 +</table>
533 +
534 </body>
535 </section>