Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 373145 | Differences between
and this patch

Collapse All | Expand All

(-)a/devbook.xsl (-2 / +4 lines)
Lines 104-109 Link Here
104
      <xsl:if test="@rowspan">
104
      <xsl:if test="@rowspan">
105
	<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>
105
	<xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute>
106
      </xsl:if>
106
      </xsl:if>
107
      <xsl:if test="@nowrap">
108
	<!-- Disable word wrapping for this table item. Usage: <ti nowrap="nowrap"> -->
109
	<xsl:attribute name="nowrap"><xsl:value-of select="@nowrap"/></xsl:attribute>
110
      </xsl:if>
107
      <xsl:apply-templates/>
111
      <xsl:apply-templates/>
108
    </td>
112
    </td>
109
  </xsl:template>
113
  </xsl:template>
110
- 
111
--
112
eclass-writing/text.xml | 469 ++++++++++++++++++++++++++++++++++++++++++------
114
eclass-writing/text.xml | 469 ++++++++++++++++++++++++++++++++++++++++++------
113
1 file changed, 417 insertions(+), 52 deletions(-)
115
1 file changed, 417 insertions(+), 52 deletions(-)
(-)a/eclass-writing/text.xml (-53 / +417 lines)
Lines 125-143 adhere to the following process:</p> Link Here
125
<body>
125
<body>
126
126
127
<p>
127
<p>
128
Eclasses are documented as any other bash project is, with code
128
Eclasses are documented with comment blocks which follow a special
129
comments. We do however have a standard format for eclass, variable,
129
markup syntax. The comment blocks are separated by empty new lines and
130
and function headers. The <c>app-portage/eclass-manpages</c> package
130
each block documents an individual entity of an eclass.
131
processes these headers to create documentation for the eclass. The
132
result can be seen in our <uri link="::eclass-reference/">eclass
133
reference</uri>, or by installing <c>app-portage/eclass-manpages</c>.
134
</p>
131
</p>
135
<p>
132
<p>
136
The format for eclass, variable, and function headers are described
133
Documentation tags for various eclass elements are explained in their
137
below. Before committing your eclass, please ensure that the
134
respective sections below. Common to all the tags which accept
138
<c>eclass-to-manpage.sh</c> script (currently in <c>$FILESDIR</c> for
135
multiline freetext, the <c>@CODE</c> tag should be used when necessary
139
<c>app-portage/eclass-manpages</c> in the <c>gentoo.git</c> repo) does
136
to create unformatted code chunks (such as example code) by placing
140
not report any errors or serious warnings for your eclass.
137
the tag at the beginning and the end.
141
</p>
138
</p>
142
</body>
139
</body>
143
</section>
140
</section>
Lines 157-182 underscores and dots. Eclasses are not intrinsically versioned. Link Here
157
<p>
154
<p>
158
Eclasses should start with the standard ebuild header, along with
155
Eclasses should start with the standard ebuild header, along with
159
comments explaining the maintainer and purpose of the eclass, and any
156
comments explaining the maintainer and purpose of the eclass, and any
160
other relevant documentation. The format supported by
157
other relevant documentation. Eclass documentation block should be the
161
<c>app-portage/eclass-manpages</c> is as follows:
158
first documentation block to appear in the eclass. The following table
159
summarizes the available documentation tags:
162
</p>
160
</p>
163
161
164
<codesample lang="ebuild">
162
<table>
165
# @ECLASS: foo.eclass
163
<tr>
166
# @MAINTAINER:
164
  <th>tag</th>
167
# &lt;required; list of contacts, one per line&gt;
165
  <th>optional?</th>
168
# @AUTHOR:
166
  <th>arguments</th>
169
# &lt;optional; list of authors, one per line&gt;
167
  <th>description</th>
170
# @BUGREPORTS:
168
</tr>
171
# &lt;optional; description of how to report bugs;
169
<tr>
172
#  default: tell people to use bugs.gentoo.org&gt;
170
  <ti>
173
# @VCSURL: &lt;optional; url to vcs for this eclass; default: https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/@ECLASS@&gt;
171
    <c>@ECLASS:</c>
174
# @BLURB: &lt;required; short description&gt;
172
  </ti>
175
# @DESCRIPTION:
173
  <ti>
176
# &lt;optional; long description&gt;
174
    NO
177
# @EXAMPLE:
175
  </ti>
178
# &lt;optional; example usage&gt;
176
  <ti>
179
</codesample>
177
    Name of the eclass being documented.
178
  </ti>
179
  <ti>
180
    Documents various information about the eclass. Must appear as the
181
    first tag in the comment block.
182
  </ti>
183
</tr>
184
<tr>
185
  <ti>
186
    <c>@MAINTAINER:</c>
187
  </ti>
188
  <ti>
189
    NO
190
  </ti>
191
  <ti>
192
    One or more name and email pairs.
193
  </ti>
194
  <ti>
195
    List of maintainers for the eclass to be contacted. One line per
196
    maintainer. Must start on a newline after the tag.
197
  </ti>
198
</tr>
199
<tr>
200
  <ti>
201
    <c>@AUTHOR:</c>
202
  </ti>
203
  <ti>
204
    YES
205
  </ti>
206
  <ti>
207
    One or more name and email pairs.
208
  </ti>
209
  <ti>
210
    List of authors for the eclass. One line per author. Must start on
211
    a newline after the tag.
212
  </ti>
213
</tr>
214
<tr>
215
  <ti>
216
    <c>@BUGREPORTS:</c>
217
  </ti>
218
  <ti>
219
    YES
220
  </ti>
221
  <ti>
222
    Multiline freetext.
223
  </ti>
224
  <ti>
225
    Describes how bugs related to this eclass should be reported.
226
  </ti>
227
</tr>
228
<tr>
229
  <ti>
230
    <c>@VCSURL:</c>
231
  </ti>
232
  <ti>
233
    YES
234
  </ti>
235
  <ti>
236
    A URI string.
237
  </ti>
238
  <ti>
239
    Points to the URL of the VCS which contains the eclass source.
240
  </ti>
241
</tr>
242
<tr>
243
  <ti>
244
    <c>@BLURB:</c>
245
  </ti>
246
  <ti>
247
    NO
248
  </ti>
249
  <ti>
250
    Single line freetext.
251
  </ti>
252
  <ti>
253
    Contains a short description for the eclass. Must be on the same
254
    line with the tag.
255
  </ti>
256
</tr>
257
<tr>
258
  <ti>
259
    <c>@DESCRIPTION:</c>
260
  </ti>
261
  <ti>
262
    YES
263
  </ti>
264
  <ti>
265
    Multiline freetext.
266
  </ti>
267
  <ti>
268
    Long description for the eclass.
269
  </ti>
270
</tr>
271
<tr>
272
  <ti>
273
    <c>@EXAMPLE:</c>
274
  </ti>
275
  <ti>
276
    YES
277
  </ti>
278
  <ti>
279
    Multiline freetext.
280
  </ti>
281
  <ti>
282
    Examples which illustrate various uses of this eclass.
283
  </ti>
284
</tr>
285
</table>
180
286
181
</body>
287
</body>
182
</section>
288
</section>
Lines 190-210 Top level variables may be defined as for ebuilds. If any USE flags are Link Here
190
used, <c>IUSE</c> must be set. The <c>KEYWORDS</c> variable must <b>not</b> be set in an
296
used, <c>IUSE</c> must be set. The <c>KEYWORDS</c> variable must <b>not</b> be set in an
191
eclass.
297
eclass.
192
</p>
298
</p>
299
193
<p>
300
<p>
194
You should document the meaning, usage, and default value of every
301
You should document the meaning, usage, and default value of every
195
variable in your eclass. The standard format supported by
302
variable in your eclass. The tags available for documenting eclass
196
<c>app-portage/eclass-manpages</c> is,
303
variables are as follows:
197
</p>
304
</p>
198
305
199
<codesample lang="ebuild">
306
<table>
200
# @ECLASS-VARIABLE: foo
307
<tr>
201
# [@DEFAULT_UNSET]
308
  <th>tag</th>
202
# [@INTERNAL]
309
  <th>optional?</th>
203
# [@REQUIRED]
310
  <th>arguments</th>
204
# @DESCRIPTION:
311
  <th>description</th>
205
# &lt;required; blurb about this variable&gt;
312
</tr>
206
# foo=&quot;&lt;default value&gt;&quot;
313
<tr>
207
</codesample>
314
  <ti nowrap="nowrap">
315
    <c>@ECLASS-VARIABLE:</c>
316
  </ti>
317
  <ti>
318
    NO
319
  </ti>
320
  <ti>
321
    Name of the eclass variable to which the documentation applies.
322
  </ti>
323
  <ti>
324
    This tag applies to eclass specific variables that affect the
325
    default behavior of the eclass. Read-only variables, which are
326
    exported by the eclass for developer use, are also documented with
327
    this tag. Must appear as the first tag in the comment block.
328
  </ti>
329
</tr>
330
<tr>
331
  <ti>
332
    <c>@DEFAULT_UNSET</c>
333
  </ti>
334
  <ti>
335
    YES
336
  </ti>
337
  <ti>
338
    <d/>
339
  </ti>
340
  <ti>
341
    Indicates that this variable is unset by default if not set by the
342
    developer.
343
  </ti>
344
</tr>
345
<tr>
346
  <ti>
347
    <c>@INTERNAL</c>
348
  </ti>
349
  <ti>
350
    YES
351
  </ti>
352
  <ti>
353
    <d/>
354
  </ti>
355
  <ti>
356
    Indicates that the variable is internal to the eclass.
357
  </ti>
358
</tr>
359
<tr>
360
  <ti>
361
    <c>@REQUIRED</c>
362
  </ti>
363
  <ti>
364
    YES
365
  </ti>
366
  <ti>
367
    <d/>
368
  </ti>
369
  <ti>
370
    Indicates that this variable must be set by the developer.
371
  </ti>
372
</tr>
373
<tr>
374
  <ti>
375
    <c>@DESCRIPTION:</c>
376
  </ti>
377
  <ti>
378
    NO
379
  </ti>
380
  <ti>
381
    Multiline freetext.
382
  </ti>
383
  <ti>
384
    Long description for the eclass variable.
385
  </ti>
386
</tr>
387
</table>
208
388
209
</body>
389
</body>
210
</section>
390
</section>
Lines 217-238 variable in your eclass. The standard format supported by Link Here
217
Eclasses may define functions. These functions will be visible to anything which
397
Eclasses may define functions. These functions will be visible to anything which
218
inherits the eclass.
398
inherits the eclass.
219
</p>
399
</p>
400
220
<p>
401
<p>
221
You should document the purpose, arguments, usage, and return value of
402
You should document the purpose, arguments, usage, and return value of
222
every function in your eclass. The standard format supported by
403
every function in your eclass. The standard tags available for
223
<c>app-portage/eclass-manpages</c> is,
404
documentation are:
224
</p>
405
</p>
225
406
226
<codesample lang="ebuild">
407
<table>
227
# @FUNCTION: foo
408
<tr>
228
# @USAGE: &lt;required arguments to foo&gt; [optional arguments to foo]
409
  <th>tag</th>
229
# @RETURN: &lt;whatever foo returns&gt;
410
  <th>optional?</th>
230
# @MAINTAINER:
411
  <th>arguments</th>
231
# &lt;optional; list of contacts, one per line&gt;
412
  <th>description</th>
232
# [@INTERNAL]
413
</tr>
233
# @DESCRIPTION:
414
<tr>
234
# &lt;required if no @RETURN; blurb about this function&gt;
415
  <ti>
235
</codesample>
416
    <c>@FUNCTION:</c>
417
  </ti>
418
  <ti>
419
    NO
420
  </ti>
421
  <ti>
422
    Name of the function to which the documentation block applies.
423
  </ti>
424
  <ti>
425
    Documents information about an eclass function such as its calling
426
    convention etc. Must appear as the first tag in the comment block.
427
  </ti>
428
</tr>
429
<tr>
430
  <ti>
431
    <c>@USAGE:</c>
432
  </ti>
433
  <ti>
434
    NO
435
  </ti>
436
  <ti>
437
    List of required and optional arguments to the function.
438
  </ti>
439
  <ti>
440
    List of arguments that the eclass function accepts, specified in
441
    the following syntax: <c>&lt;</c>Required arguments<c>&gt;</c>
442
    <c>[</c>Optional arguments<c>]</c>
443
  </ti>
444
</tr>
445
<tr>
446
  <ti>
447
    <c>@RETURN:</c>
448
  </ti>
449
  <ti>
450
    <b>*</b>
451
  </ti>
452
  <ti>
453
    Return value of the function.
454
  </ti>
455
  <ti>
456
    <p>Description for the value returned by the function.</p>
457
    <p><b>*</b>: Not optional for functions that return a value.</p>
458
  </ti>
459
</tr>
460
<tr>
461
  <ti>
462
    <c>@MAINTAINER:</c>
463
  </ti>
464
  <ti>
465
    YES
466
  </ti>
467
  <ti>
468
    Multiline freetext.
469
  </ti>
470
  <ti>
471
    List of contacts for the eclass function. One line per
472
    maintainer. Must start on a newline after the tag.
473
  </ti>
474
</tr>
475
<tr>
476
  <ti>
477
    <c>@INTERNAL</c>
478
  </ti>
479
  <ti>
480
    YES
481
  </ti>
482
  <ti>
483
    <d/>
484
  </ti>
485
  <ti>
486
    Indicates that the function is internal to the eclass and should
487
    not be called from outside.
488
  </ti>
489
</tr>
490
<tr>
491
  <ti>
492
    <c>@DESCRIPTION:</c>
493
  </ti>
494
  <ti>
495
    <b>*</b>
496
  </ti>
497
  <ti>
498
    Multiline freetext.
499
  </ti>
500
  <ti>
501
    <p>Long description for the eclass function.</p>
502
    <p><b>*:</b> Not optional if <c>RETURN:</c> is absent.</p>
503
  </ti>
504
</tr>
505
</table>
506
507
</body>
508
</section>
509
<section>
510
<title>Eclass Function Variables</title>
511
<body>
512
513
<p>
514
Eclass functions may make use of variables just like any other bash
515
function. Special function-specific variables should be documented
516
using the following tags:
517
</p>
518
519
<table>
520
<tr>
521
  <th>tag</th>
522
  <th>optional?</th>
523
  <th>arguments</th>
524
  <th>description</th>
525
</tr>
526
<tr>
527
  <ti>
528
    <c>@VARIABLE:</c>
529
  </ti>
530
  <ti>
531
    NO
532
  </ti>
533
  <ti>
534
    Name of the function-specific variable to which the documentation applies.
535
  </ti>
536
  <ti>
537
    This tag applies to variables consumed by specific functions of
538
    the eclass. They are in effect only when the specific function is
539
    called.
540
  </ti>
541
</tr>
542
<tr>
543
  <ti>
544
    <c>@DEFAULT_UNSET</c>
545
  </ti>
546
  <ti>
547
    YES
548
  </ti>
549
  <ti>
550
    <d/>
551
  </ti>
552
  <ti>
553
    Indicates that this variable is unset by default if not set by the
554
    developer.
555
  </ti>
556
</tr>
557
<tr>
558
  <ti>
559
    <c>@INTERNAL</c>
560
  </ti>
561
  <ti>
562
    YES
563
  </ti>
564
  <ti>
565
    <d/>
566
  </ti>
567
  <ti>
568
    Indicates that the variable is internal to the eclass function.
569
  </ti>
570
</tr>
571
<tr>
572
  <ti>
573
    <c>@REQUIRED</c>
574
  </ti>
575
  <ti>
576
    YES
577
  </ti>
578
  <ti>
579
    <d/>
580
  </ti>
581
  <ti>
582
    Indicates that this variable must be set by the developer.
583
  </ti>
584
</tr>
585
<tr>
586
  <ti>
587
    <c>@DESCRIPTION:</c>
588
  </ti>
589
  <ti>
590
    NO
591
  </ti>
592
  <ti>
593
    Multiline freetext.
594
  </ti>
595
  <ti>
596
    Long description for the function variable.
597
  </ti>
598
</tr>
599
</table>
600
236
</body>
601
</body>
237
</section>
602
</section>
238
603
239
- 

Return to bug 373145