1 |
commit: fbf04e6b3afb7909cded6b5700513fd80ef0e5ed |
2 |
Author: André Erdmann <dywi <AT> mailerd <DOT> de> |
3 |
AuthorDate: Thu Aug 1 17:11:05 2013 +0000 |
4 |
Commit: André Erdmann <dywi <AT> mailerd <DOT> de> |
5 |
CommitDate: Thu Aug 1 17:11:05 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=fbf04e6b |
7 |
|
8 |
doc/rst, package rules: else-action block |
9 |
|
10 |
Other changes included in this commit: |
11 |
|
12 |
* --no-revbump, --dump-stats cmdline options |
13 |
* hook environment: $STATS_DB |
14 |
* hook event table |
15 |
* field definition file: update joinValues description + [License] field |
16 |
* Dependency Resolution: is a subsection of Roverlay Console now, |
17 |
TODO notes added |
18 |
* added doc stub for RemoteInterface |
19 |
|
20 |
--- |
21 |
doc/rst/usage.rst | 194 ++++++++++++++++++++++++++++++++++++++++++------------ |
22 |
1 file changed, 153 insertions(+), 41 deletions(-) |
23 |
|
24 |
diff --git a/doc/rst/usage.rst b/doc/rst/usage.rst |
25 |
index 204de09..68b8e40 100644 |
26 |
--- a/doc/rst/usage.rst |
27 |
+++ b/doc/rst/usage.rst |
28 |
@@ -439,6 +439,9 @@ to know in detail what *roverlay* does before running it. |
29 |
--no-incremental |
30 |
Force recreation of existing ebuilds |
31 |
|
32 |
+--no-revbump |
33 |
+ Disable revbump checks in incremental overlay creation mode |
34 |
+ |
35 |
--immediate-ebuild-writes |
36 |
Immediately write ebuilds when they are ready. |
37 |
|
38 |
@@ -481,6 +484,9 @@ For **testing** *roverlay*, these **options** may be convenient: |
39 |
--no-write |
40 |
Disable overlay writing |
41 |
|
42 |
+--dump-stats |
43 |
+ Print all stats |
44 |
+ |
45 |
--show |
46 |
Print all ebuilds and metadata to console |
47 |
|
48 |
@@ -1520,7 +1526,7 @@ Package Rules can be used to control both overlay and ebuild creation. |
49 |
Each package rule consists of conditions, e.g. *package name contains amd64*, |
50 |
and actions, e.g. *set KEYWORDS="-x86 amd64"*. |
51 |
The actions of a rule will only be applied if a package meets all conditions, |
52 |
-otherwise the rule does nothing. |
53 |
+otherwise the rule applies alternative actions (if defined) or does nothing. |
54 |
Moreover, rules can contain further rules which will only take effect if all |
55 |
enclosing rules match a given package. |
56 |
|
57 |
@@ -1531,11 +1537,14 @@ enclosing rules match a given package. |
58 |
As stated above, each rule has two parts, a *match block* that lists the |
59 |
rule's conditions and an *action block* that defines which actions and |
60 |
nested rules are applied to a package if the rule matches it, i.e. if all |
61 |
-conditions are met. |
62 |
+conditions are met. A rule can also contain an *alternative action block* |
63 |
+whose actions are applied to a package if the rule does not match it. |
64 |
|
65 |
A rule file contains zero or more package rules. |
66 |
-Each rule has to declare one *match* and one *action statement* at least. |
67 |
-The basic syntax for a rule with 1..m *match* and 1..n *action statements* is |
68 |
+Each rule has to declare one *match* and one |
69 |
+*[alternative] action statement* at least. |
70 |
+The basic syntax for a rule with 1..m *match*, 1..n *action statements* and |
71 |
+1..k *alternative action statements* is |
72 |
|
73 |
.. code:: |
74 |
|
75 |
@@ -1549,6 +1558,11 @@ The basic syntax for a rule with 1..m *match* and 1..n *action statements* is |
76 |
<action statement 2> |
77 |
... |
78 |
<action statement n> |
79 |
+ ELSE: |
80 |
+ <alternative action statement 1> |
81 |
+ <alternative action statement 2> |
82 |
+ ... |
83 |
+ <alternative action statement k> |
84 |
END; |
85 |
|
86 |
|
87 |
@@ -1556,7 +1570,9 @@ A rule is introduced by the ``MATCH:`` keyword, which starts the |
88 |
*match block* and is followed by one or more *match statements*, one per line. |
89 |
The *match block* ends with the ``ACTION:`` keyword, which also starts the |
90 |
*action block* and is followed by one or more *action statements* |
91 |
-(again, one per line). Finally, the rule is terminated by the ``END;`` keyword. |
92 |
+(again, one per line). The *alternative action block* introduced by the |
93 |
+``ELSE:`` keyword is optional and lists *action statements*. |
94 |
+Finally, the rule is terminated by the ``END;`` keyword. |
95 |
|
96 |
Indention is purely optional, leading and ending whitespace will be discarded. |
97 |
Lines starting with ``#`` or ``;`` are considered to be comments and will be |
98 |
@@ -1774,7 +1790,7 @@ control *where*) and the number of values they accept: |
99 |
+----------------+------------------+-------------+------------------------+ |
100 |
| trace | package rules | none | mark a package as | |
101 |
| | | | modified | |
102 |
- + + +-------------+------------------------+ |
103 |
+ | | +-------------+------------------------+ |
104 |
| | | 1 | add the stored string | |
105 |
| | | | to a package's | |
106 |
| | | | *modified* variable | |
107 |
@@ -1791,6 +1807,10 @@ control *where*) and the number of values they accept: |
108 |
| | | | *s/expr/repl/* | |
109 |
| | | | statements | |
110 |
+----------------+------------------+-------------+------------------------+ |
111 |
+ | null | *n/a* | none | does nothing | |
112 |
+ +----------------+ | | (can be used for | |
113 |
+ | pass | | | readability) | |
114 |
+ +----------------+------------------+-------------+------------------------+ |
115 |
|
116 |
The two-arg form of the set/rename keywords expect a <key> as first and |
117 |
a value / sed expression as second arg. The one-arg form expects the latter |
118 |
@@ -1851,6 +1871,19 @@ is exactly the same as for the normal package rules: |
119 |
END; |
120 |
# top-level rule, action block continues |
121 |
... |
122 |
+ ELSE: |
123 |
+ # top-level rule, alternative action block |
124 |
+ ... |
125 |
+ MATCH: |
126 |
+ # (alternative) nested rule, match block |
127 |
+ ... |
128 |
+ ACTION: |
129 |
+ # (alternative) nested rule, action block |
130 |
+ ... |
131 |
+ ELSE: |
132 |
+ # (alternative) nested rule, alternative action block |
133 |
+ ... |
134 |
+ END; |
135 |
END; |
136 |
|
137 |
Rules can be nested indefinitely, whitespace indention is optional. |
138 |
@@ -1863,15 +1896,21 @@ checks necessary for a given package. |
139 |
+++++++++++++++++++++++ |
140 |
|
141 |
A rule that ignores the 'yaqcaffy' package from CRAN, which is also available |
142 |
-from BIOC: |
143 |
+from BIOC. Additionally, it sets the category for all non-ignored packages |
144 |
+from CRAN to sci-CRAN: |
145 |
|
146 |
.. code:: |
147 |
|
148 |
MATCH: |
149 |
- repo == CRAN |
150 |
- package_name == yaqcaffy |
151 |
+ repo CRAN |
152 |
ACTION: |
153 |
- do-not-process |
154 |
+ MATCH: |
155 |
+ package_name == yaqcaffy |
156 |
+ ACTION: |
157 |
+ do-not-process |
158 |
+ ELSE: |
159 |
+ set category sci-CRAN |
160 |
+ END; |
161 |
END; |
162 |
|
163 |
|
164 |
@@ -1886,11 +1925,12 @@ if the package is from BIOC/experiment, and otherwise to ``-x86 amd64``: |
165 |
* package_name ~ x86_64 |
166 |
* package_name ~ amd64 |
167 |
ACTION: |
168 |
- keywords "-x86 amd64" |
169 |
MATCH: |
170 |
repo == BIOC/experiment |
171 |
ACTION: |
172 |
keywords "-x86 ~amd64" |
173 |
+ ELSE: |
174 |
+ keywords "-x86 amd64" |
175 |
END; |
176 |
END; |
177 |
|
178 |
@@ -1935,6 +1975,15 @@ Moving such packages to a "R-package" sub directory would be possible, too: |
179 |
END; |
180 |
|
181 |
|
182 |
+.. Hint:: |
183 |
+ |
184 |
+ ``roverlay [--nosync] [--dump-file <file>] apply_rules`` can be used to |
185 |
+ test rules. It applies the rules to all packages without running overlay |
186 |
+ creation. Furthermore, ``roverlay --ppr`` parses the package rules, |
187 |
+ prints them and exits afterwards. |
188 |
+ |
189 |
+ |
190 |
+ |
191 |
============= |
192 |
Event Hooks |
193 |
============= |
194 |
@@ -2108,6 +2157,9 @@ the config file. An empty string sets the policy to *deny all*. |
195 |
| | *$ROVERLAY\ | executable (which creates the overlay) | |
196 |
| | _HELPER_EXE* | | |
197 |
+----------------+-------------------+-----------------------------------------+ |
198 |
+ | STATS_DB | config | stats database file | |
199 |
+ | | | (optional, only set if configured) | |
200 |
+ +----------------+-------------------+-----------------------------------------+ |
201 |
| DEBUG | log level | *shbool* (``y`` or ``n``) that | |
202 |
| | | indicates whether debug messages should | |
203 |
| | | be printed | |
204 |
@@ -2281,6 +2333,23 @@ The template below illustrates how to write function files: |
205 |
|
206 |
Shell function files should be put into ``<ADDITIONS_DIR>/shlib``. |
207 |
|
208 |
+------------------ |
209 |
+ Hook event table |
210 |
+------------------ |
211 |
+ |
212 |
+The following table lists all known events: |
213 |
+ |
214 |
+.. table:: |
215 |
+ |
216 |
+ +-------------------+-------------+----------------------------------------+ |
217 |
+ | name | conditional | description | |
218 |
+ +===================+=============+========================================+ |
219 |
+ | overlay_success | yes | overlay creation succeeded | |
220 |
+ +-------------------+-------------+----------------------------------------+ |
221 |
+ | db_written | yes | stats database file written | |
222 |
+ +-------------------+-------------+----------------------------------------+ |
223 |
+ |
224 |
+ |
225 |
--------------------- |
226 |
Adding a hook event |
227 |
--------------------- |
228 |
@@ -3033,9 +3102,9 @@ Known field flags: |
229 |
|
230 |
joinValues |
231 |
Declares that a field's value is one string even if it spans over |
232 |
- multiple lines. |
233 |
- The lines will be joined with a single space character ' '. |
234 |
- The default behavior is to merge lines. |
235 |
+ multiple lines. The lines will be joined with a single space |
236 |
+ character ' '. The default behavior is to merge lines. |
237 |
+ This flag can be used in conjunction with any "is list" flag. |
238 |
|
239 |
.. _field flag\: isList: |
240 |
|
241 |
@@ -3120,19 +3189,42 @@ This is the default field definition file (without any ignored fields): |
242 |
alias_nocase = OS_TYPE |
243 |
allowed_values = unix |
244 |
|
245 |
+ [License] |
246 |
+ alias_nocase = License, Licence, Lisence |
247 |
+ isLicense |
248 |
+ |
249 |
+ |
250 |
+.. _Roverlay Console: |
251 |
+ |
252 |
+================== |
253 |
+ Roverlay Console |
254 |
+================== |
255 |
+ |
256 |
+<<section is TODO>> |
257 |
+ |
258 |
+<<links to depres console chapter may need to be fixed>> |
259 |
+ |
260 |
+<<basic commands, table>> |
261 |
+ |
262 |
+<<note regarding python -OO and missing help texts>> |
263 |
|
264 |
|
265 |
.. _DepRes Console: |
266 |
|
267 |
-=============================== |
268 |
+------------------------------- |
269 |
Dependency Resolution Console |
270 |
-=============================== |
271 |
+------------------------------- |
272 |
+ |
273 |
+.. Warning:: |
274 |
+ |
275 |
+ This section is out-of-date. |
276 |
+ |
277 |
|
278 |
As previously stated, the *DepRes Console* is only meant for **testing**. |
279 |
It is an interactive console with the following features: |
280 |
|
281 |
* resolve dependencies |
282 |
-* create new dependency rules (**only single line rules**) |
283 |
+* create new dependency rules |
284 |
* create dependency rules for each R package found in a directory |
285 |
* load rules from files |
286 |
* save rules to a file |
287 |
@@ -3146,14 +3238,13 @@ lists all available commands and a few usage hints. |
288 |
|
289 |
For reference, these commands are currently available: |
290 |
|
291 |
+<<TODO: rewrite/update command table, it's out-of-date>> |
292 |
+ |
293 |
+---------------------+----------------------------------------------------+ |
294 |
| command | description | |
295 |
+=====================+====================================================+ |
296 |
| help, | lists all commands | |
297 |
-| h | | |
298 |
-+---------------------+----------------------------------------------------+ |
299 |
-| help --list, | lists all help topics for which help is available | |
300 |
-| h --list | | |
301 |
+| h, ? | | |
302 |
+---------------------+----------------------------------------------------+ |
303 |
| help *<cmd>*, | prints a command-specific help message | |
304 |
| h *<cmd>* | | |
305 |
@@ -3164,46 +3255,58 @@ For reference, these commands are currently available: |
306 |
| load_conf, | loads the rule files listed in the config file | |
307 |
| lc | into a new *rule pool* | |
308 |
+---------------------+----------------------------------------------------+ |
309 |
-| addrule *<rule>* | creates a new rule and adds it to the topmost, | |
310 |
+| add_rule *<rule>* | creates a new rule and adds it to the topmost, | |
311 |
| + *<rule>* | i.e. latest *rule pool*. This command uses | |
312 |
-| | `Rule File Syntax`_, but multi line rules are | |
313 |
-| | not supported. | |
314 |
+| | `Rule File Syntax`_. Multi line rules are | |
315 |
+| | supported. | |
316 |
+---------------------+----------------------------------------------------+ |
317 |
| add_pool, | creates a new *rule pool* | |
318 |
| << | | |
319 |
+---------------------+----------------------------------------------------+ |
320 |
-| unwind, | removes the topmost *rule pool* and all of its | |
321 |
+| unwind_pool, | removes the topmost *rule pool* and all of its | |
322 |
| >> | rules | |
323 |
+---------------------+----------------------------------------------------+ |
324 |
| resolve *<dep>*, | tries to resolve the given dependency string and | |
325 |
-| ? *<dep>* | prints the result | |
326 |
+| ?? *<dep>* | prints the result | |
327 |
++---------------------+----------------------------------------------------+ |
328 |
+| ! | enter the resolve *command chroot* | |
329 |
+| | all input will be prefixed with "resolve" | |
330 |
++---------------------+----------------------------------------------------+ |
331 |
+| !! | leave any *command chroot* | |
332 |
+---------------------+----------------------------------------------------+ |
333 |
| print, p | prints the rules of the topmost *rule pool* | |
334 |
+---------------------+----------------------------------------------------+ |
335 |
-| print all, p all | prints the rules of all *rule pools* | |
336 |
+| print --all|-a | prints the rules of all *rule pools* | |
337 |
++---------------------+----------------------------------------------------+ |
338 |
+| print <id> [<id>..] | prints the rules of a specific *rule pool* | |
339 |
+---------------------+----------------------------------------------------+ |
340 |
| write *<file>*, | writes the rules of the topmost *rule pool* into | |
341 |
-| w *<file>* | *<file>* | |
342 |
+| w *<file>* | *<file>*. See write --help for advanced usage. | |
343 |
++---------------------+----------------------------------------------------+ |
344 |
+| cd *<dir>* | changes the working directory | |
345 |
+| | This is a virtual command. <<TODO:EXPLAIN>> | |
346 |
+---------------------+----------------------------------------------------+ |
347 |
-| cd *<dir>* | changes the working directory, also creates it if | |
348 |
-| | necessary | |
349 |
+| set VAR=VALUE | set variables | |
350 |
+---------------------+----------------------------------------------------+ |
351 |
-| scandir *<dir>*, | creates dependency rules for each R package found | |
352 |
-| sd *<dir>* | in *<dir>* | |
353 |
+| unset VAR | unset variables | |
354 |
+---------------------+----------------------------------------------------+ |
355 |
-| set, unset | prints the status of currently (in)active modes | |
356 |
+| declare | show declared variables | |
357 |
+---------------------+----------------------------------------------------+ |
358 |
-| set *<mode>*, | sets or unsets *<mode>*. There is only one mode to | |
359 |
-| unset *<mode>* | control, the *shlex mode* which controls how | |
360 |
-| | command arguments are parsed | |
361 |
+| alias | show command aliases | |
362 |
+---------------------+----------------------------------------------------+ |
363 |
-| mkhelp | verifies that each accessible command has a help | |
364 |
-| | message | |
365 |
+| unalias | reserved for future usage | |
366 |
+---------------------+----------------------------------------------------+ |
367 |
| exit, qq, q | exits the *DepRes Console* | |
368 |
+---------------------+----------------------------------------------------+ |
369 |
|
370 |
+.. Note:: |
371 |
+ |
372 |
+ Some commands also offer more detailed help via ``<command> --help``. |
373 |
+ |
374 |
|
375 |
+<<TODO>> |
376 |
+ |
377 |
+<<Example Session is out-of-date>> |
378 |
|
379 |
Example Session: |
380 |
.. code-block:: |
381 |
@@ -3277,6 +3380,8 @@ The table below lists all interfaces and where to find them: |
382 |
+-----------------+---------------------------+-----------------------------+ |
383 |
| DepresInterface | roverlay.interface.depres | dependency resolution | |
384 |
+-----------------+---------------------------+-----------------------------+ |
385 |
+ | RemoteInterface | roverlay.interface.remote | remote interaction (sync) | |
386 |
+ +-----------------+---------------------------+-----------------------------+ |
387 |
|
388 |
|
389 |
For extending the API, roverlay provides the abstract *RoverlayInterface* and |
390 |
@@ -3310,9 +3415,16 @@ The *DepResInterface* offers the following functionality: |
391 |
|
392 |
|
393 |
Refer to in-code documentation on how to use this interface. |
394 |
-See the dependency resolution test suite for a usage example |
395 |
-(``tests.depres``, not part of the roverlay installation). |
396 |
-(The depres console is also a candidate for using this interface in future.) |
397 |
+See the dependency resolution test suite (``tests.depres``, not part of the |
398 |
+roverlay installation) and the dependency resolution console |
399 |
+for usage examples. |
400 |
+ |
401 |
+------------------ |
402 |
+ Remote Interface |
403 |
+------------------ |
404 |
+ |
405 |
+<<TODO; this interface isn't mature enough yet (it will likely change in future)>> |
406 |
+ |
407 |
|
408 |
========================= |
409 |
Implementation Overview |