1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
|
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.10: http://docutils.sourceforge.net/" />
<title>Automatically Generated Overlay of R packages</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7514 2012-09-14 14:27:12Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document">
<div class="contents topic" id="contents">
<p class="topic-title first">Contents</p>
<ul class="auto-toc simple">
<li><a class="reference internal" href="#introduction" id="id6">1 Introduction</a></li>
<li><a class="reference internal" href="#installation" id="id7">2 Installation</a><ul class="auto-toc">
<li><a class="reference internal" href="#prerequisites" id="id8">2.1 Prerequisites</a></li>
<li><a class="reference internal" href="#via-emerge-gentoo" id="id9">2.2 via emerge (Gentoo)</a></li>
<li><a class="reference internal" href="#manual-installation" id="id10">2.3 Manual Installation</a></li>
<li><a class="reference internal" href="#using-roverlay-without-installation" id="id11">2.4 Using <em>roverlay</em> without installation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-roverlay" id="id12">3 Running Roverlay</a><ul class="auto-toc">
<li><a class="reference internal" href="#required-configuration-steps" id="id13">3.1 Required configuration steps</a><ul class="auto-toc">
<li><a class="reference internal" href="#automated-configuration-and-setup" id="id14">3.1.1 Automated configuration and setup</a></li>
<li><a class="reference internal" href="#manual-configuration" id="id15">3.1.2 Manual configuration</a></li>
<li><a class="reference internal" href="#extended-configuration-where-to-go-from-here" id="id16">3.1.3 Extended Configuration / Where to go from here?</a></li>
</ul>
</li>
<li><a class="reference internal" href="#running-it" id="id17">3.2 Running it</a></li>
<li><a class="reference internal" href="#providing-a-package-mirror" id="id18">3.3 Providing a package mirror</a></li>
<li><a class="reference internal" href="#roverlay-helpers" id="id19">3.4 roverlay helpers</a></li>
</ul>
</li>
<li><a class="reference internal" href="#basic-implementation-overview" id="id20">4 Basic Implementation Overview</a><ul class="auto-toc">
<li><a class="reference internal" href="#how-roverlay-works" id="id21">4.1 How <em>roverlay</em> works</a></li>
<li><a class="reference internal" href="#expected-overlay-result-structure-of-the-generated-overlay" id="id22">4.2 Expected Overlay Result / Structure of the generated overlay</a><ul class="auto-toc">
<li><a class="reference internal" href="#expected-ebuild-result" id="id23">4.2.1 Expected Ebuild Result</a></li>
<li><a class="reference internal" href="#expected-metadata-xml-result" id="id24">4.2.2 Expected <em>metadata.xml</em> Result</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#repositories-getting-packages" id="id25">5 Repositories / Getting Packages</a><ul class="auto-toc">
<li><a class="reference internal" href="#a-word-about-repo-config-files" id="id26">5.1 A word about repo config files</a></li>
<li><a class="reference internal" href="#rsync-repos" id="id27">5.2 Rsync repos</a></li>
<li><a class="reference internal" href="#getting-packages-from-a-repository-that-supports-http-only" id="id28">5.3 Getting packages from a repository that supports http only</a></li>
<li><a class="reference internal" href="#getting-packages-from-several-remotes-using-http-and-a-package-list" id="id29">5.4 Getting packages from several remotes using http and a package list</a></li>
<li><a class="reference internal" href="#using-local-directories" id="id30">5.5 Using local directories</a></li>
<li><a class="reference internal" href="#distmap" id="id31">5.6 Distmap</a></li>
</ul>
</li>
<li><a class="reference internal" href="#additions-directory" id="id32">6 Additions Directory</a><ul class="auto-toc">
<li><a class="reference internal" href="#patching-ebuilds" id="id33">6.1 Patching ebuilds</a></li>
<li><a class="reference internal" href="#importing-ebuilds" id="id34">6.2 Importing ebuilds</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dependency-rules" id="id35">7 Dependency Rules</a><ul class="auto-toc">
<li><a class="reference internal" href="#simple-dependency-rules" id="id36">7.1 Simple Dependency Rules</a><ul class="auto-toc">
<li><a class="reference internal" href="#rule-variants" id="id37">7.1.1 Rule Variants</a></li>
<li><a class="reference internal" href="#rule-types" id="id38">7.1.2 Rule types</a></li>
<li><a class="reference internal" href="#rule-file-examples" id="id39">7.1.3 Rule File Examples</a></li>
<li><a class="reference internal" href="#rule-file-syntax" id="id40">7.1.4 Rule File Syntax</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#package-rules" id="id41">8 Package Rules</a><ul class="auto-toc">
<li><a class="reference internal" href="#package-rule-file-syntax" id="id42">8.1 Package Rule File Syntax</a><ul class="auto-toc">
<li><a class="reference internal" href="#match-blocks" id="id43">8.1.1 Match Blocks</a><ul class="auto-toc">
<li><a class="reference internal" href="#extended-match-block-syntax" id="id44">8.1.1.1 Extended Match Block Syntax</a></li>
</ul>
</li>
<li><a class="reference internal" href="#action-blocks" id="id45">8.1.2 Action Blocks</a><ul class="auto-toc">
<li><a class="reference internal" href="#extended-action-block-syntax" id="id46">8.1.2.1 Extended Action Block Syntax</a></li>
</ul>
</li>
<li><a class="reference internal" href="#package-rule-examples" id="id47">8.1.3 Package Rule Examples</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#event-hooks" id="id48">9 Event Hooks</a><ul class="auto-toc">
<li><a class="reference internal" href="#default-event-script" id="id49">9.1 Default event script</a><ul class="auto-toc">
<li><a class="reference internal" href="#activating-a-hook-script" id="id50">9.1.1 Activating a hook script</a></li>
<li><a class="reference internal" href="#adding-a-new-hook-script" id="id51">9.1.2 Adding a new hook script</a></li>
</ul>
</li>
<li><a class="reference internal" href="#event-policy" id="id52">9.2 Event Policy</a></li>
<li><a class="reference internal" href="#hook-environment" id="id53">9.3 Hook Environment</a></li>
<li><a class="reference internal" href="#adding-a-function-file" id="id54">9.4 Adding a function file</a></li>
<li><a class="reference internal" href="#hook-event-table" id="id55">9.5 Hook event table</a></li>
<li><a class="reference internal" href="#adding-a-hook-event" id="id56">9.6 Adding a hook event</a></li>
</ul>
</li>
<li><a class="reference internal" href="#configuration-reference" id="id57">10 Configuration Reference</a><ul class="auto-toc">
<li><a class="reference internal" href="#misc-options" id="id58">10.1 misc options</a></li>
<li><a class="reference internal" href="#overlay-options" id="id59">10.2 overlay options</a></li>
<li><a class="reference internal" href="#other-config-files" id="id60">10.3 other config files</a></li>
<li><a class="reference internal" href="#shell-environment-hooks" id="id61">10.4 shell environment / hooks</a></li>
<li><a class="reference internal" href="#logging" id="id62">10.5 logging</a><ul class="auto-toc">
<li><a class="reference internal" href="#console-logging" id="id63">10.5.1 console logging</a></li>
<li><a class="reference internal" href="#file-logging" id="id64">10.5.2 file logging</a></li>
</ul>
</li>
<li><a class="reference internal" href="#license-map-options" id="id65">10.6 license map options</a></li>
<li><a class="reference internal" href="#options-for-debugging-manual-dependency-rule-creation-and-testing" id="id66">10.7 options for debugging, manual dependency rule creation and testing</a></li>
</ul>
</li>
<li><a class="reference internal" href="#id3" id="id67">11 Other config files</a><ul class="auto-toc">
<li><a class="reference internal" href="#use-expand-flag-rename-file" id="id68">11.1 USE_EXPAND flag rename file</a></li>
<li><a class="reference internal" href="#license-map-file" id="id69">11.2 License Map File</a></li>
<li><a class="reference internal" href="#field-definition-config" id="id70">11.3 Field Definition Config</a><ul class="auto-toc">
<li><a class="reference internal" href="#example-the-default-field-definition-file" id="id71">11.3.1 Example: The default field definition file</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#id5" id="id72">12 Roverlay Console</a><ul class="auto-toc">
<li><a class="reference internal" href="#dependency-resolution-console" id="id73">12.1 Dependency Resolution Console</a></li>
</ul>
</li>
<li><a class="reference internal" href="#roverlay-interface" id="id74">13 Roverlay Interface</a><ul class="auto-toc">
<li><a class="reference internal" href="#depres-interface" id="id75">13.1 DepRes Interface</a></li>
<li><a class="reference internal" href="#remote-interface" id="id76">13.2 Remote Interface</a></li>
</ul>
</li>
<li><a class="reference internal" href="#implementation-overview" id="id77">14 Implementation Overview</a><ul class="auto-toc">
<li><a class="reference internal" href="#packageinfo" id="id78">14.1 PackageInfo</a></li>
<li><a class="reference internal" href="#repository-management" id="id79">14.2 Repository Management</a><ul class="auto-toc">
<li><a class="reference internal" href="#repository" id="id80">14.2.1 Repository</a><ul class="auto-toc">
<li><a class="reference internal" href="#adding-new-repository-types" id="id81">14.2.1.1 Adding new repository types</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#overlay" id="id82">14.3 Overlay</a><ul class="auto-toc">
<li><a class="reference internal" href="#metadata-creation" id="id83">14.3.1 Metadata Creation</a></li>
<li><a class="reference internal" href="#manifest-creation" id="id84">14.3.2 Manifest Creation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#ebuild-creation" id="id85">14.4 Ebuild Creation</a><ul class="auto-toc">
<li><a class="reference internal" href="#ebuild-variables" id="id86">14.4.1 Ebuild Variables</a></li>
</ul>
</li>
<li><a class="reference internal" href="#overlay-creation" id="id87">14.5 Overlay Creation</a><ul class="auto-toc">
<li><a class="reference internal" href="#selfdep-validation" id="id88">14.5.1 Selfdep Validation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dependency-resolution" id="id89">14.6 Dependency Resolution</a><ul class="auto-toc">
<li><a class="reference internal" href="#dependency-types" id="id90">14.6.1 Dependency types</a><ul class="auto-toc">
<li><a class="reference internal" href="#description-file-dependency-fields" id="id91">14.6.1.1 DESCRIPTION file dependency fields</a></li>
</ul>
</li>
<li><a class="reference internal" href="#dependency-environments" id="id92">14.6.2 Dependency Environments</a></li>
<li><a class="reference internal" href="#ebuildjob-channel" id="id93">14.6.3 EbuildJob Channel</a></li>
<li><a class="reference internal" href="#dependency-rule-pools" id="id94">14.6.4 Dependency Rule Pools</a></li>
<li><a class="reference internal" href="#dependency-resolver-modules" id="id95">14.6.5 Dependency Resolver Modules</a></li>
<li><a class="reference internal" href="#dependency-resolver" id="id96">14.6.6 Dependency Resolver</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="introduction">
<h1><a class="toc-backref" href="#contents">1 Introduction</a></h1>
<p><em>roverlay</em> is an application that aims to provide integration of R packages
in Gentoo by creating a portage overlay for them.
Naturally, this also requires proper dependency resolution, especially on the
system level which cannot be done by <em>install.packages()</em> in R.</p>
<p>The project associated with <em>roverlay</em> is called
<em>Automatically generated overlay of R packages</em>, the initial work has been
done during the <em>Google Summer of Code 2012</em>.</p>
<p>At its current state, <em>roverlay</em> is capable of creating a complete overlay
with metadata and Manifest files by reading R packages.
It is also able to work incrementally, i.e. update an existing <em>R Overlay</em>.
Most aspects of overlay creation are configurable with text files.</p>
<p><em>roverlay</em> is written in python. A homepage is not available, only a
<a class="reference external" href="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary">git repository</a> that contains the source code.</p>
<p>This document is targeted at</p>
<blockquote>
<ul>
<li><p class="first">overlay maintainers who <strong>use roverlay</strong> to create the R Overlay</p>
<p>The most relevant chapters are <a class="reference internal" href="#installation">Installation</a> (2) and
<a class="reference internal" href="#running-roverlay">Running Roverlay</a> (3). Additionally, have a look at
<a class="reference internal" href="#basic-implementation-overview">Basic Implementation Overview</a> (4) if you want to know what <em>roverlay</em>
does and what to expect from the generated overlay.</p>
</li>
<li><p class="first"><em>roverlay</em> maintainers who <strong>control and test overlay creation</strong>,
e.g. configure which R packages will be part of the generated overlay</p>
<p>Depending on what you want to configure, chapters 5-11 are relevant,
namely <a class="reference internal" href="#repositories-getting-packages">Repositories / Getting Packages</a>, <cite>Additions Directory</cite>,
<a class="reference internal" href="#dependency-rules">Dependency Rules</a>, <a class="reference internal" href="#package-rules">Package Rules</a>, <a class="reference internal" href="#configuration-reference">Configuration Reference</a>
and <a class="reference internal" href="#field-definition-config">Field Definition Config</a>.</p>
<p>There is another chapter that is only interesting for testing, the
<a class="reference internal" href="#dependency-resolution-console">Dependency Resolution Console</a> (12.1), which can be used to
interactively test dependency rules.</p>
</li>
<li><p class="first"><em>roverlay</em> code maintainers who want to know <strong>how roverlay works</strong> for
code improvements etc.</p>
<p>The most important chapter is <a class="reference internal" href="#implementation-overview">Implementation Overview</a> (14) which has
references to other chapters (4-13) where required.</p>
</li>
<li><p class="first">developers who intend to <strong>use roverlay's functionality outside of roverlay</strong></p>
<p>The most important chapter is <a class="reference internal" href="#roverlay-interface">Roverlay Interface</a>, which gives an
overview of <em>roverlay's</em> API.
Reading the other chapters (4-14) is recommended.</p>
</li>
</ul>
</blockquote>
<p>Expected prior knowlegde:</p>
<blockquote>
<ul class="simple">
<li>a few <em>R package</em> basics</li>
<li>portage basics, e.g. <em>Depend Atoms</em> and what an overlay is</li>
</ul>
</blockquote>
</div>
<div class="section" id="installation">
<h1><a class="toc-backref" href="#contents">2 Installation</a></h1>
<div class="section" id="prerequisites">
<h2><a class="toc-backref" href="#contents">2.1 Prerequisites</a></h2>
<ul>
<li><p class="first">python >= 2.7 built with ssl support (tested with python 2.7 and 3.2)</p>
<blockquote>
<p>extra dependencies for python 2.7 (built-in since python 3.2)</p>
<ul class="simple">
<li>argparse (<a class="reference external" href="http://code.google.com/p/argparse">http://code.google.com/p/argparse</a>)</li>
<li>concurrent.futures (<a class="reference external" href="http://pypi.python.org/pypi/futures">http://pypi.python.org/pypi/futures</a>) (optional)</li>
</ul>
</blockquote>
</li>
<li><p class="first">setuptools for installing <em>roverlay</em> (<a class="reference external" href="http://pypi.python.org/pypi/setuptools">http://pypi.python.org/pypi/setuptools</a>)</p>
</li>
<li><p class="first">Bash for using <em>roverlay</em> standalone</p>
</li>
<li><p class="first">rsync (for using rsync repositories)</p>
</li>
<li><p class="first">portage (<em>ebuild</em>) for Manifest creation and downloading source files for
imported ebuilds</p>
</li>
<li><p class="first"><em>true</em> or <em>echo</em> from coreutils or busybox for preventing
package downloads during Manifest creation (optional)</p>
</li>
<li><p class="first">for generating documentation files: python docutils >= 0.9</p>
</li>
<li><p class="first">hardware requirements (when using the default configuration):</p>
<blockquote>
<p>disk</p>
<ul class="simple">
<li>50-55GB disk space for the R packages</li>
<li>a filesystem that supports symbolic or hard links</li>
<li>there will be many small-sized files (ebuilds),
so a filesystem with lots of inodes and a small block size
may be advantageous</li>
</ul>
<p>memory</p>
<blockquote>
<p>up to 600MB which depends on the amount of processed packages and the
write mechanism in use. The amount can be halved (approximately) when
using a slower one.</p>
</blockquote>
<p>time</p>
<blockquote>
<p>Expect 1h execution time for the first run, depending on computing
and I/O speed. <em>roverlay</em> is able to work in incremental mode,
thus making subsequent runs need a lot less time.</p>
</blockquote>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="via-emerge-gentoo">
<h2><a class="toc-backref" href="#contents">2.2 via emerge (Gentoo)</a></h2>
<p>A live ebuild is available, <a class="reference external" href="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=blob;f=roverlay-9999.ebuild;hb=refs/heads/master">roverlay-9999.ebuild</a>.
Add it to your local overlay and run <tt class="docutils literal">emerge roverlay</tt>, which also installs
all necessary config files into <em>/etc/roverlay</em>.</p>
</div>
<div class="section" id="manual-installation">
<h2><a class="toc-backref" href="#contents">2.3 Manual Installation</a></h2>
<p>After installing the dependencies as listed in <a class="reference internal" href="#prerequisites">Prerequisites</a>, clone the
<a class="reference external" href="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary">roverlay git repo</a> and then install <em>roverlay</em> and its python modules:</p>
<pre class="code sh literal-block">
git clone git://git.overlays.gentoo.org/proj/R_overlay.git
<span class="name builtin">cd </span>R_overlay <span class="operator">&&</span> make install
</pre>
<p><tt class="docutils literal">make install</tt> also accepts some variables, namely:</p>
<ul class="simple">
<li><em>DESTDIR</em></li>
<li><em>BINDIR</em>, defaults to <em>DESTDIR</em>/usr/local/bin</li>
<li><em>PYMOD_FILE_LIST</em>, which lists the installed python module files
and defaults to './roverlay_files.list'</li>
<li><em>PYTHON</em>, name or path of the python interpreter that is used to run
'setup.py', defaults to 'python'</li>
</ul>
<p><em>roverlay</em> can later be uninstalled with <tt class="docutils literal">make uninstall</tt>.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Make sure to include <tt class="docutils literal"><span class="pre">--record</span> <span class="pre"><somewhere>/roverlay_files.list</span></tt>
when running <tt class="docutils literal">./setup.py install</tt> manually,
which can later be used to safely remove the python module files with
<tt class="docutils literal">xargs rm <span class="pre">-vrf</span> < <span class="pre"><somewhere>/roverlay_files.list</span></tt>.
The <em>make</em> targets take care of this.</p>
</div>
<div class="warning">
<p class="first admonition-title">Warning</p>
<p class="last">Support for this installation type is limited - no config files will be
installed!</p>
</div>
</div>
<div class="section" id="using-roverlay-without-installation">
<h2><a class="toc-backref" href="#contents">2.4 Using <em>roverlay</em> without installation</a></h2>
<p>This is possible, too.
Make sure to meet the dependencies as listed in <a class="reference internal" href="#prerequisites">Prerequisites</a>.
Then, simply clone the git repository to a local directory that is referenced
as the <em>R Overlay src directory</em> from now on.</p>
<p>The <em>R Overlay src directory</em> provides a wrapper script (<tt class="docutils literal">roverlay.py</tt> or
<tt class="docutils literal">bin/roverlay</tt>) which changes the working directory and adjusts the
<tt class="docutils literal">PYTHONPATH</tt> variable so that <em>roverlay</em> can be run from anywhere.</p>
</div>
</div>
<div class="section" id="running-roverlay">
<h1><a class="toc-backref" href="#contents">3 Running Roverlay</a></h1>
<div class="section" id="required-configuration-steps">
<h2><a class="toc-backref" href="#contents">3.1 Required configuration steps</a></h2>
<p><em>roverlay</em> needs a configuration file to run.
If roverlay has been installed with <em>emerge</em>,
it will look for the config file in that order:</p>
<ol class="arabic simple">
<li><em>~/roverlay/R-overlay.conf</em></li>
<li><em>/etc/roverlay/R-overlay.conf</em>,
which is part of the installation but has to be modified.</li>
</ol>
<p>Otherwise, <em>roverlay</em> uses <em>R-overlay.conf.local</em> or <em>R-overlay.conf</em>
in the current directory.
An example config file is available in the <em>R Overlay src directory</em>.</p>
<p>Overall, the following steps have to be taken before running <em>roverlay</em>:</p>
<ul class="simple">
<li>create/adjust the main config file</li>
<li>provide additional files (dependency rule files, hook event script etc.)
at the locations pointed out in the main config file</li>
<li>optional: create directories in advance with proper permissions, e.g.
a shared package files directory</li>
</ul>
<p>These steps can be automated by using <em>roverlay-setup</em>.
See <cite>Automated configuration and setup</cite> for details.
<cite>Manual configuration</cite> covers how to configure <em>roverlay</em> by hand.</p>
<div class="section" id="automated-configuration-and-setup">
<h3><a class="toc-backref" href="#contents">3.1.1 Automated configuration and setup</a></h3>
<p><tt class="docutils literal"><span class="pre">roverlay-setup</span></tt> (<tt class="docutils literal"><span class="pre">bin/roverlay-setup</span></tt> in the <em>R overlay src directory</em>)
is a script that is able to generate <em>roverlay's</em> main config file, import
other config files, create essential directories and activate/manage
<em>event hooks</em>.</p>
<p>It accepts a number of options, in particular:</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--pretend</span>, <span class="option">-p</span></kbd></td>
<td>Show what would be done. <strong>Recommended</strong> (prior to running the command
without --pretend).</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--ask</span>, <span class="option">-a</span></kbd></td>
<td>Ask for confirmation before each action. This allows to skip certain
actions by answering with <em>n</em>, <em>no</em> or <em>skip</em>.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--work-root <var><dir></var></span>, <span class="option">-W <var><dir></var></span></kbd></td>
</tr>
<tr><td> </td><td>The user's root directory for work data (distfiles, overlay, ...).
Defaults to <tt class="docutils literal"><span class="pre">${HOME}/roverlay</span></tt>.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--conf-dir <var><dir></var></span>, <span class="option">--my-conf-root <var><dir></var></span>, <span class="option">-C <var><dir></var></span></kbd></td>
</tr>
<tr><td> </td><td>Directory for the user's private config.
Defaults to <tt class="docutils literal"><span class="pre">${HOME}/roverlay/config</span></tt>.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--variable <var><name=value></var></span>, <span class="option">-v <var><name=value></var></span></kbd></td>
</tr>
<tr><td> </td><td><p class="first">This can be used to set config options.</p>
<p class="last">Example: <tt class="docutils literal"><span class="pre">--variable</span> <span class="pre">DISTFILES=/nfs/roverlay/distfiles</span></tt> for setting
up a shared package files directory.</p>
</td></tr>
</tbody>
</table>
<p>See <tt class="docutils literal"><span class="pre">roverlay-setup</span> <span class="pre">--help</span></tt> for a full listing.</p>
<p><tt class="docutils literal"><span class="pre">roverlay-setup-interactive</span></tt> (<tt class="docutils literal"><span class="pre">bin/roverlay-setup-interactive</span></tt>) is a
script that asks a few questions and then calls <tt class="docutils literal"><span class="pre">roverlay-setup</span></tt> based on
the answers.
It's also accessible via <tt class="docutils literal">emerge <span class="pre">--config</span> roverlay</tt> if roverlay
has been installed.</p>
<div class="important">
<p class="first admonition-title">Important</p>
<p class="last"><tt class="docutils literal"><span class="pre">roverlay-setup[-interactive]</span></tt> overwrites the user's config.</p>
</div>
</div>
<div class="section" id="manual-configuration">
<h3><a class="toc-backref" href="#contents">3.1.2 Manual configuration</a></h3>
<p>The config file is a text file with '<option> = <value>' syntax. Some options
accept multiple values (e.g. <option> = file1, file2), in which case the
values have to be enclosed with quotes (-> <tt class="docutils literal"><option> = "file1 file2"</tt>).</p>
<p>The following options should be set before running <em>roverlay</em>:</p>
<blockquote>
<dl class="docutils">
<dt>OVERLAY_DIR</dt>
<dd><p class="first">This sets the directory of the overlay that will be created.
This option is <strong>required</strong> and can be overridden on the command line
via <tt class="docutils literal"><span class="pre">--overlay</span> <directory></tt>.</p>
<p class="last">Example: OVERLAY_DIR = ~/roverlay/overlay</p>
</dd>
<dt>DISTFILES</dt>
<dd><p class="first">This sets the root directory of all per-repo package directories.
This option is <strong>required</strong> and can be overridden on the command line
via <tt class="docutils literal"><span class="pre">--distroot</span> <directory></tt>.</p>
<p class="last">Example: DISTFILES = ~/roverlay/distfiles</p>
</dd>
<dt>DISTDIR</dt>
<dd><p class="first">This sets the directory that contains symbolic or hard links to
all package files for which an ebuild could be created. It is used
for Manifest file creation and can serve as package mirror directory.</p>
<p class="last">Example: DISTDIR = ~/roverlay/distdir</p>
</dd>
<dt>LOG_FILE</dt>
<dd><p class="first">This sets the log file. An empty value disables file logging.</p>
<p class="last">Example: LOG_FILE = ~/roverlay/log/roverlay.log</p>
</dd>
<dt>LOG_LEVEL</dt>
<dd><p class="first">This sets the global log level, which is used for all log formats
without an own log level. Valid log levels are <tt class="docutils literal">DEBUG</tt>, <tt class="docutils literal">INFO</tt>,
<tt class="docutils literal">WARN</tt>/<tt class="docutils literal">WARNING</tt>, <tt class="docutils literal">ERROR</tt> and <tt class="docutils literal">CRITICAL</tt>.</p>
<p>Example: LOG_LEVEL = WARNING</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">Be careful with low log levels, especially <em>DEBUG</em>.
They produce a lot of messages that help to track ebuild creation of
the R packages, but increase the log file size dramatically.</p>
</div>
</dd>
<dt>LOG_LEVEL_CONSOLE</dt>
<dd><p class="first">This sets the console log level.</p>
<p class="last">Example: LOG_LEVEL_CONSOLE = INFO</p>
</dd>
<dt>LOG_LEVEL_FILE</dt>
<dd><p class="first">This sets the log level for file logging.</p>
<p class="last">Example: LOG_LEVEL_FILE = ERROR</p>
</dd>
</dl>
</blockquote>
<p>The following options should also be set (most of them are required), but
have reasonable defaults if <em>roverlay</em> has been installed using <em>emerge</em>:</p>
<blockquote>
<dl class="docutils">
<dt>SIMPLE_RULES_FILE</dt>
<dd><p class="first">This option lists dependency rule files and/or directories with
such files that should be used for dependency resolution.
Although not required, this option is <strong>recommended</strong> since ebuild
creation without dependency rules fails for most R packages.</p>
<p class="last">Example: SIMPLE_RULES_FILE = ~/roverlay/config/simple-deprules.d</p>
</dd>
<dt>REPO_CONFIG</dt>
<dd><p class="first">A list with one or more files that list repositories.
This option is <strong>required</strong> and can be overridden on the command line
via one or more <tt class="docutils literal"><span class="pre">--repo-config</span> <file></tt> statements.</p>
<p class="last">Example: REPO_CONFIG = ~/roverlay/config/repo.list</p>
</dd>
<dt>PACKAGE_RULES</dt>
<dd><p class="first">A list of files and/or directories with package rules.
Package rules can be used to control overlay/ebuild creation.
This option is not required.</p>
<p class="last">Example: PACKAGE_RULES = ~/roverlay/config/packagerules.d</p>
</dd>
<dt>ADDITIONS_DIR</dt>
<dd><p class="first">Directory with an overlay-like structure that contains extra files, e.g.
ebuild patches and hand-written ebuilds.</p>
<p class="last">Example: ADDITIONS_DIR = ~/roverlay/additions</p>
</dd>
<dt>FIELD_DEFINITION</dt>
<dd><p class="first">The value of this option should point to a field definition file which
controls how an R package's DESCRIPTION file is read.
The file supplied by default should be fine.
This option is <strong>required</strong> and can be overridden on the command line
via <tt class="docutils literal"><span class="pre">--field-definition</span> <file></tt>.</p>
<p class="last">Example: FIELD_DEFINITION = ~/roverlay/config/description_fields.conf</p>
</dd>
<dt>USE_EXPAND_DESC</dt>
<dd><p class="first">A file that contains USE_EXPAND flag descriptions. This option is not
required.</p>
<p class="last">Example: USE_EXPAND_DESC = ~/roverlay/config/useflag/useflag_desc</p>
</dd>
<dt>USE_EXPAND_RENAME</dt>
<dd><p class="first">The value of this option should point to a USE flag remap file which
can be used to rename USE_EXPAND flags. This option is not required.</p>
<p class="last">Example: USE_EXPAND_RENAME = ~/roverlay/config/useflag_rename</p>
</dd>
<dt>CACHEDIR</dt>
<dd><p class="first">Directory for generated files that do not belong to the overlay, e.g.
the <em>distmap</em> file. This option is <strong>required</strong>.</p>
<p class="last">Example: CACHEDIR = ~/roverlay/workdir/cache</p>
</dd>
<dt>OVERLAY_ECLASS</dt>
<dd><p class="first">This option lists eclass files that should be imported into the overlay
(into <em>OVERLAY_DIR</em>/eclass/) and inherited in all ebuilds.
Specifying an eclass file that implements the ebuild phase functions
(e.g. <em>src_install()</em>) is highly <strong>recommended</strong>. A default file
named <em>R-packages.eclass</em> should be part of your installation.</p>
<p class="last">Example: OVERLAY_ECLASS = ~/roverlay/eclass/R-packages.eclass</p>
</dd>
<dt>DISTDIR_STRATEGY</dt>
<dd><p class="first">A list of methods that define how to create the DISTDIR. The methods
will be tried in the specified order, until the first one succeeds.
The available methods are <em>symlink</em>, <em>hardlink</em>, <em>copy</em> and <em>tmpdir</em>.
This option is <strong>required</strong>.</p>
<p>Example: DISTDIR_STRATEGY = "hardlink symlink"</p>
<p class="last">Try hard links first, then fall back to symbolic ones. This is the
default value for this option.</p>
</dd>
<dt>DISTDIR_FLAT</dt>
<dd><p class="first">This option controls whether DISTDIR will contain per-package
subdirectories with links to the package files ("not flat") or all
links/files in a single directory ("flat"). This option is ignored
if DISTDIR_STRATEGY is <em>tmpdir</em>.
Leaving this option as-is (<em>enabled</em>) is recommended if you want to use
DISTDIR as package mirror.</p>
<p class="last">Example: DISTDIR_FLAT = yes</p>
</dd>
<dt>PORTDIR</dt>
<dd><p class="first">Portage directory, which is used to scan for valid licenses.</p>
<p class="last">Example: PORTDIR = /usr/portage</p>
</dd>
</dl>
</blockquote>
<p>There is another option that is useful for creating new dependency rules,
<a class="reference internal" href="#log-file-unresolvable">LOG_FILE_UNRESOLVABLE</a>, which will write all unresolvable dependencies
to the specified file (one dependency string per line).</p>
</div>
<div class="section" id="extended-configuration-where-to-go-from-here">
<h3><a class="toc-backref" href="#contents">3.1.3 Extended Configuration / Where to go from here?</a></h3>
<p>Proceed with <a class="reference internal" href="#running-it">Running it</a> if the default configuration and the changes already
made are fine, otherwise the following chapters are relevant and should
provide you with the knowledge to determine the ideal configuration.</p>
<dl class="docutils">
<dt>Repositories</dt>
<dd>See <a class="reference internal" href="#repositories-getting-packages">Repositories / Getting Packages</a>, which describes how repositories
can be configured.</dd>
<dt>Dependency Rules</dt>
<dd>See <a class="reference internal" href="#dependency-rules">Dependency Rules</a>, which explains the dependency rule syntax amd how
they work.</dd>
<dt>Package Rules</dt>
<dd>See <a class="reference internal" href="#package-rules">Package Rules</a>, which explains how to control <em>ebuild creation</em>.</dd>
<dt>Main Config</dt>
<dd>See <a class="reference internal" href="#configuration-reference">Configuration Reference</a> for all main config options like log file
rotation and assistance for writing new <em>dependency rules</em>.</dd>
<dt>Patching generated ebuilds / Importing ebuilds</dt>
<dd>See <a class="reference internal" href="#additions-directory">Additions Directory</a>.</dd>
<dt>R_SUGGESTS</dt>
<dd>See <a class="reference internal" href="#use-expand-flag-rename-file">USE_EXPAND flag rename file</a>, which describes how R_SUGGESTS
USE_EXPAND flags can be renamed.</dd>
<dt>Field Definition</dt>
<dd>Refer to <a class="reference internal" href="#id4">Field Definition</a> in case you want to change <em>how</em> R packages
are being read, e.g. if you want the 'Depents' information field (obviously
a typo) to be understood as 'Depends'. Also see <a class="reference internal" href="#license-map-file">License Map file</a> for
translating <em>license strings</em> into valid portage licenses.</dd>
</dl>
</div>
</div>
<div class="section" id="running-it">
<h2><a class="toc-backref" href="#contents">3.2 Running it</a></h2>
<p>If <em>roverlay</em> has been installed, you can run it with <tt class="docutils literal">roverlay</tt>, otherwise
cd into the <em>R overlay src directory</em> and run <tt class="docutils literal">./roverlay.py</tt>.</p>
<p>In any case, the basic <em>roverlay</em> script usage is</p>
<pre class="code literal-block">
roverlay --config <config file> [<options>] [<commands>]
</pre>
<p>or</p>
<pre class="code literal-block">
roverlay [<options>] [<commands>]
</pre>
<p>which will search for the config file as described in
<a class="reference internal" href="#required-configuration-steps">Required configuration steps</a>. The default command is <em>create</em>, which
downloads the R packages (unless explicitly forbidden to do so) and generates
the overlay. This is the desired behavior in most cases, so simply running
<tt class="docutils literal">roverlay</tt> should be fine. See <a class="reference internal" href="#basic-implementation-overview">Basic Implementation Overview</a> if you want
to know in detail what <em>roverlay</em> does before running it.</p>
<p><em>roverlay</em> also accepts some <strong>options</strong>, most notably:</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--no-sync</span></kbd></td>
<td>Disable downloading of R packages.</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--strict</span></kbd></td>
<td>Enable strict behavior.
For example, this causes <em>roverlay</em> to exit if any repo cannot be synced.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--distmap-verify</span></kbd></td>
</tr>
<tr><td> </td><td>Enforce verification of R packages in the package mirror directory.
This also tries to recreate the distmap.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--no-incremental</span></kbd></td>
</tr>
<tr><td> </td><td>Force recreation of existing ebuilds</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--no-revbump</span></kbd></td>
<td>Disable revbump checks in incremental overlay creation mode</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--immediate-ebuild-writes</span></kbd></td>
</tr>
<tr><td> </td><td><p class="first">Immediately write ebuilds when they are ready.</p>
<p>The default behavior is to wait for all ebuilds and then write them using
ebuild write threads. The latter one is faster, but consumes more memory
since ebuilds must be kept until all packages have been processed.
Test results show that memory consumption increases by factor 2 when using
the faster write mechanism (at ca. 95% ebuild creation success rate),
<<while ebuild write time decreases by ???>>.</p>
<p class="last">Summary: Expect 300 (slow) or 600MB (fast) memory consumption when using
the default package repositories.</p>
</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--fixup-category-move</span>, <span class="option">--fixup-category-move-reverse</span></kbd></td>
</tr>
<tr><td> </td><td>Remove ebuilds that have been moved to a different category.
See <a class="reference internal" href="#action-blocks">Action Blocks</a> in <a class="reference internal" href="#package-rules">Package Rules</a> for details.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--config <var>file</var></span>, <span class="option">-c <var>file</var></span></kbd></td>
</tr>
<tr><td> </td><td>Path to the config file</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--help</span>, <span class="option">-h</span></kbd></td>
<td>Show all options</td></tr>
</tbody>
</table>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last"><em>--no-incremental</em> does not delete an existing overlay, it merely ignores
and, potentially, overwrites existing ebuilds.
Use <em>rm -rf <overlay></em> to do that.</p>
</div>
<p>For <strong>testing</strong> <em>roverlay</em>, these <strong>options</strong> may be convenient:</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group">
<kbd><span class="option">--no-manifest</span></kbd></td>
<td><p class="first">Skip Manifest file creation.</p>
<p class="last">This saves a considerable amount of time
(>100min when using the default package repositories) at the expense of
an overlay that is not suitable for production usage.</p>
</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--no-write</span></kbd></td>
<td>Disable overlay writing</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--dump-stats</span></kbd></td>
<td>Print all stats</td></tr>
<tr><td class="option-group">
<kbd><span class="option">--show</span></kbd></td>
<td>Print all ebuilds and metadata to console</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--repo-config <var>file</var></span>, <span class="option">-R <var>file</var></span></kbd></td>
</tr>
<tr><td> </td><td>Repo config file to use. Can be specified more than once.
This disables all repo files configured in the main config file.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--local-distdir <var>directory</var></span>, <span class="option">--from <var>directory</var></span></kbd></td>
</tr>
<tr><td> </td><td>Create an overlay using the packages found in <em>directory</em>. This disables
all other repositories. The <em>SRC_URI</em> ebuild variable will be invalid!</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--print-package-rules</span>, <span class="option">--ppr</span></kbd></td>
</tr>
<tr><td> </td><td>Print package rules to stdout after parsing them and exit.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--overlay <var>directory</var></span>, <span class="option">-O <var>directory</var></span></kbd></td>
</tr>
<tr><td> </td><td>Create the overlay at the given position.</td></tr>
</tbody>
</table>
<p>For reference, these <strong>commands</strong> are accepted by <em>roverlay</em>:</p>
<dl class="docutils">
<dt>create</dt>
<dd>As described above, this will run ebuild, metadata creation, including
overlay and Manifest file writing.
This command implies the <strong>sync</strong> command unless the <em>--no-sync</em> option
is specified.</dd>
<dt>sync</dt>
<dd>This will download all packages from the configured remotes.</dd>
<dt>depres_console, depres</dt>
<dd><p class="first">Starts an interactive dependency resolution console that supports rule
creation/deletion, loading rules from files, writing rules to files
and resolving dependencies.</p>
<p>Meant for <strong>testing only</strong>.</p>
<p class="last">More information can be found in the <a class="reference internal" href="#depres-console">DepRes Console</a> section.</p>
</dd>
<dt>apply_rules</dt>
<dd><p class="first">Applies the package rules to all available packages and reports what has
been done, either to stdout or to <tt class="docutils literal"><span class="pre">--dump-file</span> <file></tt>.</p>
<p>Meant for testing.</p>
<p class="last">This command implies the <strong>sync</strong> command unless the <em>--no-sync</em> option
is specified.</p>
</dd>
</dl>
</div>
<div class="section" id="providing-a-package-mirror">
<h2><a class="toc-backref" href="#contents">3.3 Providing a package mirror</a></h2>
<p><a class="reference internal" href="#distdir">DISTDIR</a> with a non-temporary strategy can be used to create a directory
containing all package files (as symbolic/hard links or as files).
You have to set up a <em>data service</em>, e.g. an http server, that makes this
directory accessible.</p>
<p>The default configuration will create hard links to all package files for
which an ebuild could be created in a single directory. It will fall back
to symbolic links if hard links are not supported. This should be fine in
most cases, but fine-tuning can be done via <a class="reference internal" href="#overlay-distdir-strategy">OVERLAY_DISTDIR_STRATEGY</a> and
<a class="reference internal" href="#overlay-distdir-flat">OVERLAY_DISTDIR_FLAT</a>.</p>
</div>
<div class="section" id="roverlay-helpers">
<h2><a class="toc-backref" href="#contents">3.4 roverlay helpers</a></h2>
<p>An installation of roverlay includes some helper programs, most of them
can also be found in <tt class="docutils literal"><R overlay src <span class="pre">directory>/bin/</span></tt>:</p>
<dl class="docutils">
<dt><em>roverlay-sh</em></dt>
<dd><p class="first">a wrapper around /bin/sh that runs a shell or shell script in roverlay's
<a class="reference internal" href="#hook-environment">hook environment</a>.</p>
<p>roverlay-related scripts can use it to automatically inherit roverlay's
config and get access to its <tt class="docutils literal">$FUNCTIONS</tt> file:</p>
<pre class="code sh literal-block">
<span class="comment">#!/usr/bin/roverlay-sh
</span>
<span class="comment"># load the functions file (optional)
</span>. <span class="literal string double">"${FUNCTIONS?}"</span> <span class="operator">||</span> <span class="name builtin">exit</span>
<span class="comment"># script body
</span><span class="name builtin">true</span>
</pre>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last"><em>roverlay-sh</em> requires a valid config file.</p>
</div>
</dd>
<dt><em>roverlay-setup</em></dt>
<dd><p class="first">A script with various subcommands for setting up roverlay:</p>
<ul class="last simple">
<li><tt class="docutils literal">init</tt> for initial setup as described in
<a class="reference internal" href="#automated-configuration-and-setup">Automated Configuration and Setup</a></li>
<li><tt class="docutils literal">mkconfig</tt> for generating the main config file</li>
<li><tt class="docutils literal">hooks</tt> for managings hooks<ul>
<li><tt class="docutils literal"><span class="pre">roverlay-setup</span> hooks [show]</tt> prints information</li>
<li><tt class="docutils literal"><span class="pre">roverlay-setup</span> hooks add <hook> <event> <span class="pre">[<event>...]</span></tt> adds a hook
(referenced by name) to one or more <em>events</em></li>
<li><tt class="docutils literal"><span class="pre">roverlay-setup</span> hooks del <hook> <span class="pre"><event|"all"></span> <span class="pre">[<event|"all">...]</span></tt>
removes a hook (referenced by name) from one or more (or all) <em>events</em></li>
</ul>
</li>
</ul>
</dd>
<dt><em>roverlay-status</em></dt>
<dd><p class="first">A script that generates status reports based on <a class="reference external" href="http://www.makotemplates.org/">mako templates</a>
and roverlay's stats (<a class="reference internal" href="#stats-db-file">STATS_DB_FILE</a>). Supported output formats include
html, cgi (html with cgi header) and plain text.</p>
<p>Notable options accepted by <em>roverlay-status</em>:</p>
<table class="docutils option-list" frame="void" rules="none">
<col class="option" />
<col class="description" />
<tbody valign="top">
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--output <var><file|"-"></var></span>, <span class="option">-O <var><file|"-"></var></span></kbd></td>
</tr>
<tr><td> </td><td>output file/stream, defaults to stdout ("-")</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--template <var><file|name></var></span>, <span class="option">-t <var><file|name></var></span></kbd></td>
</tr>
<tr><td> </td><td>name of or path to the mako template file. A <tt class="docutils literal"><span class="pre">--mode</span></tt> specific
file extension is automatically appended when searching for the template
file.</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--mode <var><"cli"|"cgi"|"html"></var></span></kbd></td>
</tr>
<tr><td> </td><td>Sets the output format. Defaults to <em>cli</em> (plain text).</td></tr>
<tr><td class="option-group" colspan="2">
<kbd><span class="option">--config <var><file></var></span>, <span class="option">-c <var><file></var></span></kbd></td>
</tr>
<tr><td> </td><td>Path to roverlay's main config file.</td></tr>
</tbody>
</table>
<p class="last">See <tt class="docutils literal"><span class="pre">roverlay-status</span> <span class="pre">--help</span></tt> for a full listing.</p>
</dd>
<dt><em>run-roverlay.sh</em></dt>
<dd><p class="first">A script that safely runs overlay creation and repoman afterwards.
Uses filesystem locks to ensure that it is run at most once at a time.
Suitable for being run as cron job.</p>
<p class="last">This file is not part of the roverlay installation. It can be found
at <tt class="docutils literal"><span class="pre">files/scripts/run-roverlay.sh</span></tt> in the <a class="reference external" href="http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=summary">roverlay git repo</a>.</p>
</dd>
</dl>
</div>
</div>
<div class="section" id="basic-implementation-overview">
<h1><a class="toc-backref" href="#contents">4 Basic Implementation Overview</a></h1>
<div class="section" id="how-roverlay-works">
<h2><a class="toc-backref" href="#contents">4.1 How <em>roverlay</em> works</a></h2>
<p>These are the steps that <em>roverlay</em> performs:</p>
<ol class="arabic">
<li><p class="first"><strong>sync</strong> - get R packages using various methods
(rsync, http, local directory)</p>
</li>
<li><p class="first">scan the R Overlay directory (if it exists) for valid ebuilds</p>
</li>
<li><p class="first">import ebuilds from the additions dir</p>
</li>
<li><p class="first"><strong>add</strong> - queue all R packages for ebuild creation</p>
<ul>
<li><p class="first">all repositories are asked to list their packages which are then added
to a queue</p>
</li>
<li><p class="first">packages may be declined or manipulated by package rules</p>
<p>See also: <a class="reference internal" href="#package-rules">Package Rules</a></p>
</li>
<li><p class="first">packages may be declined by the overlay creator if they already have
an ebuild</p>
<p>The overlay is able to detect changes to the package file, e.g. when
upstream modified a package without renaming it. To realize this,
the package file's checksum (sha256) is compared with the ebuild's
entry in the <a class="reference internal" href="#distmap">distmap</a>. If they do match, then the package is declined
as it already exists. Otherwise, a revision bump is triggered.</p>
</li>
</ul>
</li>
<li><p class="first"><strong>create</strong> - process each package <em>p</em> from the package queue
(thread-able on a per package basis)</p>
<ul>
<li><p class="first">read <em>p</em>'s DESCRIPTION file that contains information fields
like 'Depends', 'Description' and 'Suggests'</p>
</li>
<li><p class="first">resolve <em>p</em>'s dependencies</p>
<ul>
<li><p class="first">differentiate between <em>required</em> and <em>optional</em> dependencies
(for example, dependencies from the 'Depends' field are required,
while those from 'Suggests' are optional)</p>
</li>
<li><p class="first"><strong>immediately stop</strong> processing <em>p</em> if a <em>required</em> dependency
cannot be resolved in which case a valid ebuild cannot be created</p>
</li>
<li><p class="first">verify dependencies on packages found in the overlay, whether their
ebuilds already exist or not (<em>selfdep validation</em>)</p>
<ul class="simple">
<li>drop unsatisfiable <em>selfdeps</em></li>
<li><strong>stop</strong> processing <em>p</em> if a <em>required selfdep</em> is missing</li>
</ul>
<p>See also: <a class="reference internal" href="#dependency-resolution">Dependency Resolution</a></p>
</li>
</ul>
</li>
<li><p class="first">create an ebuild for <em>p</em> by using the dependency resolution results
and a few information fields like 'Description'</p>
</li>
<li><p class="first"><strong>done</strong> with <em>p</em> - the overlay creator takes control over <em>p</em>
and may decide to write <em>p</em>'s ebuild now (or later)</p>
</li>
</ul>
</li>
<li><p class="first">write the overlay</p>
<ul class="simple">
<li>write/update the profiles dir and metadata/layout.conf<ul>
<li><em>roverlay</em> respects manual changes to USE_EXPAND description files</li>
</ul>
</li>
<li>write all ebuilds and apply patches to them</li>
<li>write the <em>metadata.xml</em> files<ul>
<li>this uses the latest created ebuild available for a package</li>
</ul>
</li>
<li>write the <em>Manifest</em> files<ul>
<li>this uses all ebuilds availabe for a package</li>
</ul>
</li>
</ul>
<p>Most write operations support threading.</p>
</li>
<li><p class="first">call the <em>overlay_success</em> hook</p>
</li>
<li><p class="first">write the stats database file (optional)</p>
<ul class="simple">
<li>call the <em>db_written</em> hook</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="expected-overlay-result-structure-of-the-generated-overlay">
<h2><a class="toc-backref" href="#contents">4.2 Expected Overlay Result / Structure of the generated overlay</a></h2>
<p>Assuming that the default configuration (where possible) and the <em>R-packages</em>
eclass file are used, the result should look like:</p>
<pre class="code text literal-block">
<overlay root>/
<overlay root>/eclass
<overlay root>/eclass/R-packages.eclass
<overlay root>/metadata/layout.conf
<overlay root>/profiles
<overlay root>/profiles/categories
<overlay root>/profiles/repo_name
<overlay root>/profiles/use.desc
<overlay root>/profiles/desc
<overlay root>/profiles/desc/r_suggests.desc
<overlay root>/sci-R/<many directories per R package>
<overlay root>/sci-R/seewave/
<overlay root>/sci-R/seewave/Manifest
<overlay root>/sci-R/seewave/metadata.xml
<overlay root>/sci-R/seewave/seewave-1.5.9.ebuild
<overlay root>/sci-R/seewave/seewave-1.6.4.ebuild
</pre>
<div class="section" id="expected-ebuild-result">
<h3><a class="toc-backref" href="#contents">4.2.1 Expected Ebuild Result</a></h3>
<dl class="docutils">
<dt>Ebuild Template</dt>
<dd><pre class="code text first literal-block">
<ebuild header>
EAPI=<EAPI>
inherit <eclass(es)>
DESCRIPTION="<the R package's description>"
SRC_URI="<src uri for the R package>"
IUSE="${IUSE-}
r_suggests_<flag> r_suggests_<another flag> ...
"
R_SUGGESTS="r_suggests_<flag>? ( <optional dependency> ) ..."
DEPEND="<build time dependencies for the R package>"
RDEPEND="${DEPEND-}
<runtime dependencies>
${R_SUGGESTS-}
"
_UNRESOLVED_PACKAGES=(<unresolvable, but optional dependencies>)
</pre>
<p>Some of the variables may be missing if they are not needed.</p>
<p>A really minimal ebuild would look like:</p>
<pre class="code text last literal-block">
<ebuild header>
EAPI=<EAPI>
inherit <eclass(es)>
SRC_URI="<src uri for the R package>"
</pre>
</dd>
<dt>Example: seewave 1.6.4 from CRAN:</dt>
<dd><p class="first">The default ebuild header (which cannot be changed) automatically sets
the ebuild's copyright year to 1999-<em><current year></em>.</p>
<pre class="code sh last literal-block">
<span class="comment"># Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
</span>
<span class="name variable">EAPI</span><span class="operator">=</span>4
inherit R-packages
<span class="name variable">DESCRIPTION</span><span class="operator">=</span><span class="literal string double">"Time wave analysis and graphical representation"</span>
<span class="name variable">SRC_URI</span><span class="operator">=</span><span class="literal string double">"http://cran.r-project.org/src/contrib/seewave_1.6.4.tar.gz"</span>
<span class="name variable">IUSE</span><span class="operator">=</span><span class="literal string double">"${IUSE-}
r_suggests_sound
r_suggests_audio
"</span>
<span class="name variable">R_SUGGESTS</span><span class="operator">=</span><span class="literal string double">"
r_suggests_sound? ( sci-R/sound )
r_suggests_audio? ( sci-R/audio )
"</span>
<span class="name variable">DEPEND</span><span class="operator">=</span><span class="literal string double">"sci-R/fftw
sci-R/tuneR
>=dev-lang/R-2.15.0
sci-R/rpanel
sci-R/rgl
"</span>
<span class="name variable">RDEPEND</span><span class="operator">=</span><span class="literal string double">"${DEPEND-}
media-libs/flac
sci-libs/fftw
media-libs/libsndfile
${R_SUGGESTS-}
"</span>
</pre>
</dd>
<dt>Example: MetaPCA 0.1.3 from CRAN's archive:</dt>
<dd><p class="first">Note the shortened <em>DESCRIPTION</em> variable that points to the <em>metadata.xml</em>
file. This happens if the description is too long.</p>
<pre class="code sh last literal-block">
<span class="comment"># Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
</span>
<span class="name variable">EAPI</span><span class="operator">=</span>4
inherit R-packages
<span class="name variable">DESCRIPTION</span><span class="operator">=</span><span class="literal string double">"MetaPCA: Meta-analysis in the Di... (see metadata)"</span>
<span class="name variable">SRC_URI</span><span class="operator">=</span><span class="literal string double">"http://cran.r-project.org/src/contrib/Archive/MetaPCA/MetaPCA_0.1.3.tar.gz"</span>
<span class="name variable">IUSE</span><span class="operator">=</span><span class="literal string double">"${IUSE-}
r_suggests_domc
r_suggests_affy
r_suggests_ellipse
r_suggests_pcapp
r_suggests_mass
r_suggests_impute
r_suggests_dosmp
r_suggests_geoquery
"</span>
<span class="name variable">R_SUGGESTS</span><span class="operator">=</span><span class="literal string double">"
r_suggests_domc? ( sci-R/doMC )
r_suggests_affy? ( sci-R/affy )
r_suggests_ellipse? ( sci-R/ellipse )
r_suggests_pcapp? ( sci-R/pcaPP )
r_suggests_mass? ( sci-R/MASS )
r_suggests_impute? ( sci-R/impute )
r_suggests_dosmp? ( sci-R/doSMP )
r_suggests_geoquery? ( sci-R/GEOquery )
"</span>
<span class="name variable">DEPEND</span><span class="operator">=</span><span class="literal string double">"sci-R/foreach"</span>
<span class="name variable">RDEPEND</span><span class="operator">=</span><span class="literal string double">"${DEPEND-}
${R_SUGGESTS-}
"</span>
<span class="name variable">_UNRESOLVED_PACKAGES</span><span class="operator">=(</span><span class="literal string single">'hgu133plus2.db'</span><span class="operator">)</span>
</pre>
</dd>
</dl>
</div>
<div class="section" id="expected-metadata-xml-result">
<h3><a class="toc-backref" href="#contents">4.2.2 Expected <em>metadata.xml</em> Result</a></h3>
<p>The <em>metadata.xml</em> will contain the full description for the latest version
of a package.</p>
<dl class="docutils">
<dt>Example: seewave from CRAN</dt>
<dd><p class="first">Note the ' // ' delimiter. It will be used to separate description strings
if a package has more than one, e.g. one in its <em>Title</em> and one in its
<em>Description</em> information field.</p>
<pre class="code xml last literal-block">
<span class="comment preproc"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="comment preproc"><!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"></span>
<span class="name tag"><pkgmetadata></span>
<span class="name tag"><longdescription></span>
Time wave analysis and graphical representation // seewave
provides functions for analysing, manipulating, displaying,
editing and synthesizing time waves (particularly sound). This
package processes time analysis (oscillograms and envelopes),
spectral content, resonance quality factor, entropy, cross
correlation and autocorrelation, zero-crossing, dominant
frequency, analytic signal, frequency coherence, 2D and 3D
spectrograms and many other analyses.
<span class="name tag"></longdescription></span>
<span class="name tag"></pkgmetadata></span>
</pre>
</dd>
</dl>
</div>
</div>
</div>
<div class="section" id="repositories-getting-packages">
<span id="repositories"></span><h1><a class="toc-backref" href="#contents">5 Repositories / Getting Packages</a></h1>
<p><em>roverlay</em> is capable of downloading R packages via rsync and http,
and is able to use any packages locally available. The method used to get and
use the packages is determined by the concrete <strong>type of a repository</strong>,
which is the topic of this section. It also covers repository configuration.</p>
<div class="section" id="a-word-about-repo-config-files">
<span id="repo-config"></span><h2><a class="toc-backref" href="#contents">5.1 A word about repo config files</a></h2>
<p>Repo config files use <a class="reference external" href="http://docs.python.org/library/configparser.html">ConfigParser</a> syntax (known from ini files).</p>
<p>Each repo entry section is introduced with <tt class="docutils literal">[<repo name>]</tt> and defines</p>
<ul class="simple">
<li>how <em>roverlay</em> can download the R packages from a repo
and where they should be stored</li>
<li>how ebuilds can download the packages (-> <em>SRC_URI</em>)</li>
<li>repo type specific options, e.g. whether the repo supports package file
verification</li>
</ul>
<p>Such options are declared with <tt class="docutils literal"><option> = <value></tt> in the repo entry.</p>
<p id="repo-config-options">The common options for repository entries are:</p>
<ul>
<li><p class="first"><em>type</em> (optional), which declares the repository type.
Available types are:</p>
<ul class="simple">
<li><a class="reference internal" href="#rsync">rsync</a></li>
<li><a class="reference internal" href="#websync-repo">websync_repo</a></li>
<li><a class="reference internal" href="#websync-pkglist">websync_pkglist</a></li>
<li><a class="reference internal" href="#local">local</a></li>
</ul>
<p>Defaults to <em>rsync</em>.</p>
</li>
<li><p class="first"><em>src_uri</em> (<strong>required</strong>),
which declares how ebuilds can download the packages.
Some repo types use this for downloading, too.</p>
</li>
<li><p class="first"><em>directory</em> (optional),
which explicitly sets the package directory to use.
The default behavior is to use <a class="reference internal" href="#distfiles-root">DISTFILES_ROOT</a>/<repo name></p>
</li>
</ul>
<div class="hint">
<p class="first admonition-title">Hint</p>
<p class="last">Repo names are allowed contain slashes, which will be respected when
creating the default directory.</p>
</div>
</div>
<div class="section" id="rsync-repos">
<span id="rsync"></span><h2><a class="toc-backref" href="#contents">5.2 Rsync repos</a></h2>
<p>Runs <em>rsync</em> to download packages. Automatic sync retries are supported if
<em>rsync</em>'s exit code indicates chances of success.
For example, up to 3 retries are granted if <em>rsync</em> returns
<em>Partial transfer due to vanished source files</em> which likely happens when
syncing big repositories like CRAN.</p>
<p>This repo type extends the default options by:</p>
<ul class="simple">
<li><em>rsync_uri</em> (<strong>required</strong>), which specifies the uri used for syncing</li>
<li><em>recursive</em> (optional), which passes <tt class="docutils literal"><span class="pre">--recursive</span></tt> to <em>rsync</em> if set to
'yes'</li>
<li><em>extra_rsync_opts</em> (optional), which passes arbitrary options to <em>rsync</em>.
This can be used include/exclude files or to show progress during transfer.
Options with whitespace are not supported.</li>
</ul>
<p>Examples:</p>
<ul>
<li><p class="first">CRAN</p>
<blockquote>
<pre class="code ini literal-block">
<span class="keyword">[CRAN]</span>
<span class="name attribute">type</span> <span class="operator">=</span> <span class="literal string">rsync</span>
<span class="name attribute">rsync_uri</span> <span class="operator">=</span> <span class="literal string">cran.r-project.org::CRAN/src/contrib</span>
<span class="name attribute">src_uri</span> <span class="operator">=</span> <span class="literal string">http://cran.r-project.org/src/contrib</span>
<span class="name attribute">extra_rsync_opts</span> <span class="operator">=</span> <span class="literal string">--progress --exclude=PACKAGES --exclude=PACKAGES.gz</span>
</pre>
</blockquote>
</li>
<li><p class="first">CRAN's archive:</p>
<blockquote>
<pre class="code ini literal-block">
<span class="keyword">[CRAN-Archive]</span>
<span class="name attribute">type</span> <span class="operator">=</span> <span class="literal string">rsync</span>
<span class="name attribute">rsync_uri</span> <span class="operator">=</span> <span class="literal string">cran.r-project.org::CRAN/src/contrib/Archive</span>
<span class="name attribute">src_uri</span> <span class="operator">=</span> <span class="literal string">http://cran.r-project.org/src/contrib/Archive</span>
<span class="name attribute">extra_rsync_opts</span> <span class="operator">=</span> <span class="literal string">--progress</span>
<span class="name attribute">recursive</span> <span class="operator">=</span> <span class="literal string">yes</span>
</pre>
</blockquote>
</li>
</ul>
</div>
<div class="section" id="getting-packages-from-a-repository-that-supports-http-only">
<span id="websync-repo"></span><h2><a class="toc-backref" href="#contents">5.3 Getting packages from a repository that supports http only</a></h2>
<p>This is your best bet if the remote is a repository but does not offer rsync
access. Basic digest verification is supported (MD5). The remote has to have
a package list file, typically named <em>PACKAGES</em>,
with a special syntax (debian control file syntax). Syncing is retried up to
3 times, for example if a connection timeout occurs or a remote file
disappears after reading the package list file.</p>
<p>A package list example,
excerpt from <a class="reference external" href="http://www.omegahat.org/R/src/contrib/PACKAGES">omegahat's PACKAGES file</a> (as of Aug 2012):</p>
<pre class="code control literal-block">
<span class="error">...</span>
<span class="keyword">Package</span><span class="whitespace">: </span><span class="literal string">CGIwithR</span>
<span class="keyword">Version</span>: <span class="literal number">0.73-0</span>
<span class="keyword">Suggests</span><span class="whitespace">: </span><span class="literal string">GDD</span>
<span class="keyword">License</span><span class="whitespace">: </span><span class="literal string">GPL (>= 2)</span>
<span class="keyword">MD5sum</span><span class="whitespace">: </span><span class="literal string">50b1f48209c9e66909c7afb3a4b8af5e</span>
<span class="keyword">Package</span><span class="whitespace">: </span><span class="literal string">CodeDepends</span>
<span class="keyword">Version</span>: <span class="literal number">0.2-1</span>
<span class="keyword">Depends</span>: <span class="name function">methods</span>
<span class="keyword">Imports</span><span class="whitespace">: </span><span class="literal string">codetools, XML</span>
<span class="keyword">Suggests</span><span class="whitespace">: </span><span class="literal string">graph, Rgraphviz</span>
<span class="keyword">License</span><span class="whitespace">: </span><span class="literal string">GPL</span>
<span class="keyword">MD5sum</span><span class="whitespace">: </span><span class="literal string">e2ec3505f9db1a96919a72f07673a2d8</span>
<span class="error">...</span>
</pre>
<p>An example repo config entry for omegahat:</p>
<pre class="code ini literal-block">
<span class="keyword">[omegahat]</span>
<span class="name attribute">type</span> <span class="operator">=</span> <span class="literal string">websync_repo</span>
<span class="name attribute">src_uri</span> <span class="operator">=</span> <span class="literal string">http://www.omegahat.org/R/src/contrib</span>
<span class="name attribute">digest</span> <span class="operator">=</span> <span class="literal string">md5</span>
<span class="comment single">#digest = none</span>
</pre>
<p>This repo type extends the default options by:</p>
<ul class="simple">
<li><em>digest</em>, which declares that the remote supports digest based package file
verification. Accepted values are 'md5' and 'none'. Defaults to 'none',
which disables verification.</li>
<li><em>pkglist_file</em>, which sets the name of the package list file and defaults
to PACKAGES</li>
<li><em>pkglist_uri</em>, which explicitly sets the uri of the package list file.
Defaults to <em>src_uri</em>/<em>pkglist_file</em></li>
</ul>
<p>None of these options are required.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">The content type of the remote's package list file has to be exactly
<em>text/plain</em>, compressed files are not supported.</p>
</div>
</div>
<div class="section" id="getting-packages-from-several-remotes-using-http-and-a-package-list">
<span id="websync-pkglist"></span><h2><a class="toc-backref" href="#contents">5.4 Getting packages from several remotes using http and a package list</a></h2>
<p>This is not a real repository type, instead it creates a <em>local</em> repository
by downloading single R packages from different remotes.
Its only requirement is that a package is downloadable via http.
Apart from an entry in the repo config file, it also needs a file that lists
one package uri per line:</p>
<pre class="code text literal-block">
...
http://cran.r-project.org/src/contrib/seewave_1.6.4.tar.gz
http://download.r-forge.r-project.org/src/contrib/zoo_1.7-7.tar.gz
http://www.omegahat.org/R/src/contrib/Aspell_0.2-0.tar.gz
...
</pre>
<p>Comments are not supported. Assuming that such a package list exists at
<em>~/roverlay/config/http_packages.list</em>, an example entry in the repo config
file would be:</p>
<pre class="code ini literal-block">
<span class="keyword">[http-packages]</span>
<span class="name attribute">type</span> <span class="operator">=</span> <span class="literal string">websync_pkglist</span>
<span class="name attribute">pkglist</span> <span class="operator">=</span> <span class="literal string">~/roverlay/config/http_packages.list</span>
</pre>
<p>This repo type extends the default options by:</p>
<ul class="simple">
<li><em>pkglist</em>, which sets the package list file. This option is <strong>required</strong>.</li>
</ul>
</div>
<div class="section" id="using-local-directories">
<span id="local"></span><h2><a class="toc-backref" href="#contents">5.5 Using local directories</a></h2>
<p>Using local package directories is possible, too.</p>
<p>Example:</p>
<pre class="code ini literal-block">
<span class="keyword">[local-packages]</span>
<span class="name attribute">type</span> <span class="operator">=</span> <span class="literal string">local</span>
<span class="name attribute">directory</span> <span class="operator">=</span> <span class="literal string">/var/local/R-packages</span>
<span class="name attribute">src_uri</span> <span class="operator">=</span> <span class="literal string">http://localhost/R-packages</span>
</pre>
<p>This will use all packages from <em>/var/local/R-packages</em> and assumes
that they are available via <em>http://localhost/R-packages</em>.</p>
<p>A local directory will never be modified.</p>
<div class="important">
<p class="first admonition-title">Important</p>
<p class="last">Using this repo type is <strong>not recommended for production usage</strong> because
the <em>SRC_URI</em> variable in created ebuilds will be invalid unless you have
downloaded all packages from the same remote in which case you should
consider using one of the <strong>websync</strong> repo types, <a class="reference internal" href="#websync-repo">websync_repo</a> and
<a class="reference internal" href="#websync-pkglist">websync_pkglist</a>.</p>
</div>
</div>
<div class="section" id="distmap">
<h2><a class="toc-backref" href="#contents">5.6 Distmap</a></h2>
<p><em>roverlay</em> uses a text file to store information about files in the package
mirror directory (<a class="reference internal" href="#overlay-distdir-root">OVERLAY_DISTDIR_ROOT</a>). This is necessary for comparing
package files from repos with files for which an ebuild has already been
created (in previous runs).</p>
<p>With the help of the <em>distmap file</em>, <em>roverlay</em> is able to determine whether
upstream has changed a package file silently and creates a revision-bumped
ebuild for the <em>new</em> package file. A revision-bump is triggered if the
package files (new/old) originate from the same repository,
but their checksums differ. Otherwise, the new package is discarded.</p>
<p>The <em>distmap file</em> can optionally be compressed (bzip2 or gzip), which
reduces its size considerably.</p>
<p>The first line of the <em>distmap file</em> specifies its field separator and version:</p>
<pre class="code text literal-block">
<FIELD_SEPARATOR<DISTMAP_VERSION
</pre>
<p>It is followed by zero or more entries whose format is version-dependent:</p>
<pre class="code text literal-block">
# version 0 (field separator = "|")
<package mirror file>|<repo name>|<repo file>|<sha256>
</pre>
<p>Description of these fields:</p>
<blockquote>
<dl class="docutils">
<dt>package mirror file</dt>
<dd><p class="first">Path of the package file relative to the package mirror dir.
Usually the name of the package file.</p>
<p class="last">Special values: <em><none></em></p>
</dd>
<dt>repo name</dt>
<dd><p class="first">Name of the package's repository.</p>
<p>Special values:</p>
<ul class="simple">
<li><tt class="docutils literal">U</tt> if unknown</li>
</ul>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">"U" is reserved and should not be used as name in the repo
config file.</p>
</div>
</dd>
<dt>repo file</dt>
<dd><p class="first">Path of the package file relative to the repository's directory.
Differs from <em>package mirror file</em> if the file had to be renamed in
order to avoid collisions.</p>
<p>Special values:</p>
<ul class="last simple">
<li><tt class="docutils literal">U</tt> if unknown (<em>repo file</em> is assumed to equal <em>package mirror file</em>)</li>
<li><tt class="docutils literal">_</tt> if <em>repo file</em> equals <em>package mirror file</em></li>
</ul>
</dd>
<dt>sha256</dt>
<dd>Checksum of the package file.</dd>
</dl>
</blockquote>
</div>
</div>
<div class="section" id="additions-directory">
<h1><a class="toc-backref" href="#contents">6 Additions Directory</a></h1>
<p>The <em>additions directory</em> is a directory with overlay-like structure that
contains extra files for overlay creation. Currently, ebuild patches and
ebuild files are supported.</p>
<div class="section" id="patching-ebuilds">
<h2><a class="toc-backref" href="#contents">6.1 Patching ebuilds</a></h2>
<p>Patches can apply to a <strong>specific version</strong> or to <strong>all versions</strong> of a
package.</p>
<p>The naming convention for patches is (full filesystem paths relative to the
additions dir):</p>
<pre class="code text literal-block">
# version-specific patches
${CATEGORY}/${PN}/${PF}[-dddd].patch
# version-agnostic patches
${CATEGORY}/${PN}/${PN}[-dddd].patch
</pre>
<p>The <em>-dddd</em> part is optional and can be used to apply more than one patch to
an ebuild in the specified order. <em>d</em> should be a digit (0..9) and exactly
4 digits are expected. The not-numbered patch is always applied first.
So, in theory, up to 10001 patches per ebuild are supported.</p>
<p>The <em>default</em> (version-agnostic) patches are only applied to ebuilds for
which no version-specific patches exist.</p>
<p>Exempting a specific ebuild from being patched can be achieved by creating
an empty patch file (or a symlink to /dev/null). This is only necessary
if <em>default</em> patches are available, else it adds some overhead.</p>
<div class="caution">
<p class="first admonition-title">Caution!</p>
<p class="last">Don't try to patch the (R)DEPEND variables of an ebuild.
It will <em>randomly</em> break because <em>roverlay</em> uses unordered data structures
for collecting dependencies.</p>
</div>
<p>Example:</p>
<pre class="code text literal-block">
<additions dir>/sci-CRAN/R_oo/R_oo-1.9.8.patch
<additions dir>/sci-CRAN/R_oo/R_oo-1.9.8-0000.patch
<additions dir>/sci-CRAN/R_oo/R_oo-1.9.8-0001.patch
<additions dir>/sci-R/seewave/seewave-1.6.7.patch
<additions dir>/sci-R/seewave/seewave.patch
</pre>
</div>
<div class="section" id="importing-ebuilds">
<h2><a class="toc-backref" href="#contents">6.2 Importing ebuilds</a></h2>
<p>Foreign ebuilds can be imported into the overlay by simple putting them into
the additions directory.</p>
<p>The naming convention is similar to ebuild patches and identical to the
portage tree, <tt class="docutils literal"><span class="pre">${CATEGORY}/${PN}/${PF}.ebuild</span></tt>.</p>
<p>Ebuilds imported that way cannot be overwritten by generated ebuilds and
benefit from most overlay creation features, e.g. Manifest file creation.
However, they cannot be used for metadata creation.</p>
<p>The <tt class="docutils literal"><span class="pre">${CATEGORY}/${PN}/metadata.xml</span></tt> file will be imported if it exists and
if <tt class="docutils literal">${PN}</tt> in the overlay (a) has no metadata.xml file or (b) has no
generated ebuilds (only imports).</p>
</div>
</div>
<div class="section" id="dependency-rules">
<h1><a class="toc-backref" href="#contents">7 Dependency Rules</a></h1>
<div class="section" id="simple-dependency-rules">
<h2><a class="toc-backref" href="#contents">7.1 Simple Dependency Rules</a></h2>
<p><em>Simple dependency rules</em> use a dictionary and string transformations
to resolve dependencies. <em>Fuzzy simple dependency rules</em> extend these by
a set of regular expressions, which allows to resolve many dependency strings
that minimally differ (e.g. only in the required version and/or comments:
<cite>R (>= 2.10)</cite> and <cite>R [2.14] from http://www.r-project.org/</cite>) with a single
dictionary entry.</p>
<p>This is the only rule implementation currently available.</p>
<div class="section" id="rule-variants">
<h3><a class="toc-backref" href="#contents">7.1.1 Rule Variants</a></h3>
<dl class="docutils">
<dt>default</dt>
<dd>The expected behavior of a dictionary-based rule: It matches one or more
<em>dependency string(s)</em> and resolves them as a <em>dependency</em>.</dd>
<dt>ignore</dt>
<dd>This variant will ignore <em>dependency strings</em>. Technically, it will
resolve them as <strong>nothing</strong>.</dd>
</dl>
</div>
<div class="section" id="rule-types">
<h3><a class="toc-backref" href="#contents">7.1.2 Rule types</a></h3>
<dl class="docutils">
<dt>Simple Rules</dt>
<dd><p class="first">A simple rule resolves <strong>exact string matches</strong> (case-insensitive).</p>
<p>Example:
Given a rule <em>R</em> that says "resolve 'R' and 'the R programming language'
as 'dev-lang/R'", any of these <em>dependency strings</em> will be resolved
as dev-lang/R:</p>
<ul class="last simple">
<li>r</li>
<li>THE R PROGRAMMING LanGuAgE</li>
<li>R</li>
</ul>
</dd>
<dt>Fuzzy Rules</dt>
<dd><p class="first">Fuzzy Rules are <strong>extended Simple Rules</strong>. If the basic lookup
as described above fails for a <em>dependency string</em>,
they will <em>try</em> to resolve it as a <strong>version-relative</strong>,
<strong>slot-relative</strong> or <strong>version,slot-relative match</strong>.</p>
<p>To do this, the <em>dependency string</em> will be split into components like
<em>dependency name</em>, <em>dependency version</em> and useless comments, which are
discarded.
Then, if the <em>dependency name</em> matches a dictionary entry, a resolving
<em>dependency</em> will be created.</p>
<dl class="last docutils">
<dt>Example:</dt>
<dd><p class="first">Given the same rule as in the Simple Rules example, but as fuzzy rule
"fuzzy-resolve 'R' and 'the R programming language' as 'dev-lang/R'",
it will resolve any of these <em>dependency strings</em>:</p>
<ul class="last simple">
<li>"r" as "dev-lang/R"</li>
<li>"R 2.12" as ">=dev-lang/R-2.12"</li>
<li>"The R PROGRAMMING LANGUAGE [<2.14] from <a class="reference external" href="http://www.r-project.org/">http://www.r-project.org/</a>"
as "<dev-lang/R-2.14"</li>
<li>"R ( !=2.10 )" as "( !=dev-lang/R-2.10 dev-lang/R )"</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</div>
<div class="section" id="rule-file-examples">
<h3><a class="toc-backref" href="#contents">7.1.3 Rule File Examples</a></h3>
<p>This sections lists some rule file examples.
See <a class="reference internal" href="#rule-file-syntax">Rule File Syntax</a> for a formal description.</p>
<dl class="docutils">
<dt>Example 1 - <em>default</em> fuzzy rule</dt>
<dd><p class="first">A rule that matches many dependencies on dev-lang/R, for example
"r 2.12", "R(>= 2.14)", "R [<2.10]", "r{ !=2.12 }", and "R", and
resolves them as '>=dev-lang/R-2.12', '>=dev-lang/R-2.14',
'<dev-lang/R-2.10', etc.:</p>
<pre class="code text last literal-block">
~dev-lang/R :: R
</pre>
</dd>
<dt>Example 2 - <em>default</em> simple rule stub</dt>
<dd><p class="first">A rule that case-insensitively matches 'zoo' and resolves it as 'sci-R/zoo',
assuming the OVERLAY_CATEGORY is set to 'sci-R':</p>
<pre class="code text literal-block">
zoo
</pre>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">R Package rules are dynamically created at runtime and therefore not
needed. Write them only if certain R package dependencies cannot
be resolved. See <em>Selfdep</em> in <a class="reference internal" href="#rule-file-syntax">Rule File Syntax</a> for details.</p>
</div>
</dd>
<dt>Example 3 - <em>default</em> simple rule</dt>
<dd><p class="first">A rule that matches a <em>dependency string</em> and resolves it
as "virtual/blas and virtual/lapack":</p>
<pre class="code text last literal-block">
( virtual/blas virtual/lapack ) {
BLAS/LAPACK libraries
}
</pre>
</dd>
<dt>Example 4 - <em>ignore</em> simple rule</dt>
<dd><p class="first">A rule that matches text that should be ignored.
This is a good way to deal with free-style text found
in some R package DESCRIPTION files.</p>
<pre class="code text last literal-block">
! {
see README
read INSTALL
Will use djmrgl or rgl packages for rendering if present
}
</pre>
</dd>
<dt>Example 5 - fuzzy slot rule</dt>
<dd><p class="first">A rule that matches many dependencies on sci-libs/fftw and resolves them
as slotted depencency. The <tt class="docutils literal"><span class="pre">s=<range></span></tt> option controls which parts of the
version (from the dependency string) are relevant for calculating the
slot. The following example resolves "fftw 2.1", "fftw 2.1.2" and
"fftw 2.1.3" as "sci-libs/fftw:2.1", "fftw 3.0" as "sci-libs/fftw:3.0"
and so on:</p>
<pre class="code text last literal-block">
~sci-libs/fftw:s=0..1 :: fftw
</pre>
</dd>
<dt>Example 6 - slot-restricted fuzzy slot rule</dt>
<dd><p class="first">Similar to example 5, but this rule does not resolve anything unless the
calculated slot is allowed.</p>
<pre class="code text last literal-block">
~sci-libs/fftw:s=0..1:restrict=2.1,3.0: :: fftw
</pre>
</dd>
<dt>Example 7 - slot-restricted fuzzy slot rule with <em>immediate</em> value</dt>
<dd><p class="first">Example 6 is not quite correct, as sci-libs/fftw currently uses slot 3.0
for various versions from the 3.x range. The following rule resolves
"fftw 3.0", ..., "fftw 3.3" as "sci-libs/fftw:3.0":</p>
<pre class="code text last literal-block">
~sci-libs/fftw:s=i3.0:restrict=3.0,3.1,3.2,3.3 :: fftw
</pre>
</dd>
</dl>
<p>Please see the default rule files for more extensive examples that cover
other aspects like limiting a rule to certain dependency types.
They can be found in <em>/etc/roverlay/simple-deprules.d</em> if <em>roverlay</em> has been
installed with <em>emerge</em>, else in <em><R Overlay src directory>/simple-deprules.d</em>.</p>
</div>
<div class="section" id="rule-file-syntax">
<span id="dependency-rule-file-syntax"></span><h3><a class="toc-backref" href="#contents">7.1.4 Rule File Syntax</a></h3>
<p>Simple dependency rule files have a special syntax. Each rule is introduced
with the resolving <em>dependency</em> prefixed by a <em>keychar</em> that sets the rule
type if required. The <em>dependency strings</em> resolved by this rule are listed
after a rule separator or within a rule block. Leading/trailing whitespace
is ignored.</p>
<dl class="docutils">
<dt>Ignore rules</dt>
<dd>have only a keychar but no <em>dependency</em>.</dd>
<dt>Keychars</dt>
<dd><p class="first">set the rule type.</p>
<ul class="simple">
<li><strong>!</strong> introduces a <em>ignore</em> simple rule</li>
<li><strong>~</strong> introduces a <em>default</em> fuzzy rule</li>
<li><strong>%</strong> introduces a <em>ignore</em> fuzzy rule</li>
</ul>
<p class="last">Anything else is not treated as keychar and thus introduces a <em>default</em>
simple rule.</p>
</dd>
<dt>Keywords</dt>
<dd><p class="first">There are three keywords that control how a rule file is read.</p>
<p>The important one is the <em>#deptype <dependency type></em> directive that
defines that all rules until the next <em>deptype</em> directory or end of file,
whatever comes first, will only match <em>dependency strings</em>
with the specified <em>dependency type</em>.</p>
<p>Available dependency types are</p>
<ul class="simple">
<li><em>all</em> (no type restrictions)</li>
<li><em>pkg</em> (resolve only R package dependencies)</li>
<li><em>sys</em> (resolve only system dependencies)</li>
<li><em>selfdep</em> (subtype: dependency is part of the overlay, see selfdep below)</li>
</ul>
<p>The dependency type can also be a comma-separated list of the listed types.
Actually, <em>all</em> is an abbreviated version of <tt class="docutils literal">pkg,sys</tt>.
Specifying <em>selfdep</em> alone does not resolve anything.</p>
<div class="hint">
<p class="first admonition-title">Hint</p>
<p class="last">Check the <em>dependency type</em> if a newly added rule has no effect.</p>
</div>
<p class="last">The other keywords are <em>#! NOPARSE</em>, which stops parsing of a rule file
(ignore remaining file content), and <em>#! ERROR</em>, which raises a python
exception (program exits).</p>
</dd>
<dt>Dependencies</dt>
<dd><p class="first">are strings that are recognized by portage as <strong>Dynamic DEPENDs</strong>
(see the ebuild(5) man page).</p>
<p>Examples:</p>
<blockquote>
<ul class="simple">
<li>dev-lang/R</li>
<li>( media-libs/tiff >=sci-libs/fftw-3 )</li>
<li>>=x11-drivers/nvidia-drivers-270</li>
</ul>
</blockquote>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">The fuzzy rule types support <strong>DEPEND Atom Bases</strong> only.</p>
</div>
<div class="warning last">
<p class="first admonition-title">Warning</p>
<p class="last">Dependency strings cannot start with <em>~</em> as it is a keychar.
Use braces <em>( ~... )</em> to work around that.</p>
</div>
</dd>
<dt>Single line rules</dt>
<dd><p class="first">resolve exactly one <em>dependency string</em>. Their rule separator is ' :: '.</p>
<dl class="last docutils">
<dt>Syntax:</dt>
<dd><pre class="code text first last literal-block">
[<keychar>]<dependency>[<rule options>] :: <dependency string>
</pre>
</dd>
</dl>
</dd>
<dt>Multi line rules</dt>
<dd><p class="first">resolve several <em>dependency strings</em>.
Their rule block begins with '{' + newline, followed by one
<em>dependency string</em> per line, and ends with '}' in a separate line.</p>
<dl class="docutils">
<dt>Syntax:</dt>
<dd><pre class="code text first last literal-block">
[<keychar>]<dependency>[<rule options>] {
<dependency string>
[<dependency string>]
...
}
</pre>
</dd>
</dl>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">Technically, this rule syntax can be used to specify rules with
zero or more <em>dependency strings</em>. An empty rule makes little sense,
though.</p>
</div>
</dd>
<dt>Rule Options</dt>
<dd>Certain rule types accept options that control the rule's behavior.
For example, <em>default</em> fuzzy rules can be set up to yield slotted
dependencies.</dd>
<dt>Fuzzy Slot Rules</dt>
<dd><p class="first">Fuzzy Slot rules are a subtype of <em>default</em> fuzzy rules. Appending a colon
character <tt class="docutils literal">:</tt> to the <em>dependency string</em> of a fuzzy rule
(as <em>rule option</em>) turns it into a slot rule.</p>
<p>Fuzzy slot rules accept even more options, each of them separated by one
colong char <tt class="docutils literal">:</tt>:</p>
<ul class="simple">
<li>slot mode:<ul>
<li><tt class="docutils literal">default</tt>: calculate a slot value (<tt class="docutils literal"><span class="pre"><cat>/<pkg>:<SLOT></span></tt>)</li>
<li><tt class="docutils literal">with_version</tt> or <tt class="docutils literal">+v</tt>: include version, too (<tt class="docutils literal"><span class="pre">=<cat>/<pkg>-<pkgver>:<SLOT></span></tt>)</li>
<li><tt class="docutils literal">open</tt>: non-versioned slot (<tt class="docutils literal"><span class="pre"><cat>/<pkg>:*</span></tt> or <tt class="docutils literal"><span class="pre"><cat>/<pkg>:=</span></tt>)</li>
</ul>
</li>
<li>accepted <em>calculated</em> slot values can be restricted with
<tt class="docutils literal"><span class="pre">restrict=<list</span> of accepted values</tt> or <tt class="docutils literal"><span class="pre">r=<list></span></tt></li>
<li>relevant slot parts can be set with <tt class="docutils literal"><span class="pre">slotparts=<selection></span></tt> or
<tt class="docutils literal"><span class="pre">s=<selection></span></tt></li>
<li>relevant subslot parts can be set with <tt class="docutils literal"><span class="pre">subslotparts=<selection></span></tt> or
<tt class="docutils literal">/<selection></tt></li>
<li>slot operator can be set to <tt class="docutils literal">*</tt> or <tt class="docutils literal">=</tt></li>
</ul>
<p><tt class="docutils literal"><selection></tt> can be an index (integer) range
<tt class="docutils literal"><span class="pre">[<low>:=0]..[<high>:=<low>]</span></tt> or a fixed value <tt class="docutils literal">i<value></tt>.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">Fuzzy Slot rules cannot resolve "not <version>" statements, e.g.
"R ( != 2.14 )".</p>
</div>
</dd>
<dt>Comments</dt>
<dd>start with <strong>#</strong>. There are a few exceptions to that, the <em>#deptype</em> and
<em>#! NOPARSE</em> keywords. Comments inside rule blocks are not allowed and
will be read as normal <em>dependency strings</em>.</dd>
</dl>
<dl class="docutils" id="selfdeps">
<span id="selfdep"></span><dt>Selfdep</dt>
<dd><p class="first">This is a classification for dependencies on packages which are also part
of the overlay being created. Typically, selfdeps refer to other R
packages, but there may be a few exceptions.</p>
<p>roverlay validates <em>selfdeps</em> during overlay creation, which is the most
significant difference to non-<em>selfdeps</em>.</p>
<p>Selfdep rules can be written by prefixing a single rule with <tt class="docutils literal">@selfdep</tt>
(in a separate text line) or by adding <tt class="docutils literal">selfdep</tt> to the dependency rule
type.</p>
<p>There is a second variant of selfdeps, <em>true selfdeps</em>, which resolve
a <em>dependency string</em> as R package with the same name.</p>
<p>Example: <em>zoo</em> is resolved as <em>sci-R/zoo</em>, assuming that
<a class="reference internal" href="#overlay-category">OVERLAY_CATEGORY</a> is set to <em>sci-R</em>.</p>
<p>Writing such selfdep rules is not necessary since <em>roverlay</em> automatically
creates rules for all known R packages at runtime (see
<a class="reference internal" href="#dynamic-selfdep-rule-pool">Dynamic Selfdep Rule Pool</a> for details).</p>
<p>There are a few exceptions to that in which case selfdep rules have to
be written:</p>
<ul class="simple">
<li>The <em>dependency string</em> is assumed to be a system dependency (not an
R package). This is likely a "bug" in the DESCRIPTION file of the
R package being processed.</li>
</ul>
<div class="caution last">
<p class="first admonition-title">Caution!</p>
<p class="last">Writing unnecessary <em>true selfdep</em> rules slows dependency resolution
down! Each rule will exist twice, once as <em>dynamic</em> rule and once as
the written one.</p>
</div>
</dd>
<dt>Rule Stubs</dt>
<dd><p class="first">Selfdeps can be written using a shorter syntax.
For example, if your OVERLAY_CATEGORY is <em>sci-R</em>, <em>zoo</em> should be resolved
as <em>sci-R/zoo</em>. This rule can be written as a single word, <em>zoo</em>.</p>
<dl class="last docutils">
<dt>Syntax:</dt>
<dd><pre class="code text first last literal-block">
[<keychar>]<short dependency>[<rule options>]
</pre>
</dd>
</dl>
</dd>
</dl>
</div>
</div>
</div>
<div class="section" id="package-rules">
<h1><a class="toc-backref" href="#contents">8 Package Rules</a></h1>
<p>Package Rules can be used to control both overlay and ebuild creation.
Each package rule consists of conditions, e.g. <em>package name contains amd64</em>,
and actions, e.g. <em>set KEYWORDS="-x86 amd64"</em>.
The actions of a rule will only be applied if a package meets all conditions,
otherwise the rule applies alternative actions (if defined) or does nothing.
Moreover, rules can contain further rules which will only take effect if all
enclosing rules match a given package.</p>
<div class="section" id="package-rule-file-syntax">
<h2><a class="toc-backref" href="#contents">8.1 Package Rule File Syntax</a></h2>
<p>As stated above, each rule has two parts, a <em>match block</em> that lists the
rule's conditions and an <em>action block</em> that defines which actions and
nested rules are applied to a package if the rule matches it, i.e. if all
conditions are met. A rule can also contain an <em>alternative action block</em>
whose actions are applied to a package if the rule does not match it.</p>
<p>A rule file contains zero or more package rules.
Each rule has to declare one <em>match</em> and one
<em>[alternative] action statement</em> at least.
The basic syntax for a rule with 1..m <em>match</em>, 1..n <em>action statements</em> and
1..k <em>alternative action statements</em> is</p>
<pre class="code literal-block">
MATCH:
<match statement 1>
<match statement 2>
...
<match statement m>
ACTION:
<action statement 1>
<action statement 2>
...
<action statement n>
ELSE:
<alternative action statement 1>
<alternative action statement 2>
...
<alternative action statement k>
END;
</pre>
<p>A rule is introduced by the <tt class="docutils literal">MATCH:</tt> keyword, which starts the
<em>match block</em> and is followed by one or more <em>match statements</em>, one per line.
The <em>match block</em> ends with the <tt class="docutils literal">ACTION:</tt> keyword, which also starts the
<em>action block</em> and is followed by one or more <em>action statements</em>
(again, one per line). The <em>alternative action block</em> introduced by the
<tt class="docutils literal">ELSE:</tt> keyword is optional and lists <em>action statements</em>.
Finally, the rule is terminated by the <tt class="docutils literal">END;</tt> keyword.</p>
<p>Indention is purely optional, leading and ending whitespace will be discarded.
Lines starting with <tt class="docutils literal">#</tt> or <tt class="docutils literal">;</tt> are considered to be comments and will be
ignored.</p>
<div class="section" id="match-blocks">
<h3><a class="toc-backref" href="#contents">8.1.1 Match Blocks</a></h3>
<p>The <em>match block</em> lists one or more conditions, which all must evaluate to
<em>true</em> for a certain package, otherwise no actions will be applied.
There are two types of conditions, <em>trivial</em> conditions,
e.g. <em>always true/false</em> or <em>random - flip a coin</em>, and <em>non-trivial</em> ones
that depend on the information a package has, e.g. its repository or name.</p>
<p>Except for <em>always true/false</em>,
only <em>non-trivial</em> conditions can be defined in <em>match statements</em>.
The consist of a <strong>match keyword</strong> that defines <em>what</em> should be matched, an
<strong>accepted value</strong> to compare against and an <strong>operator</strong> that defines the
relation <em>accepted value - package's information</em>, i.e. <em>how</em> to compare.
The operator can be omitted, in which case it is determined by the
<em>match keyword</em>.</p>
<p>The <em>match statement</em> syntax is</p>
<pre class="code literal-block">
<match keyword> [<operator>] <accepted value>
</pre>
<p>These <em>match keywords</em> are recognized:</p>
<table border="1" class="docutils">
<caption>match statement keywords</caption>
<colgroup>
<col width="21%" />
<col width="25%" />
<col width="54%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">match keyword</th>
<th class="head">default operator</th>
<th class="head">matches</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>repo</td>
<td>nocase-string</td>
<td><em>alias to repo_name</em></td>
</tr>
<tr><td>repo_name</td>
<td>nocase-string</td>
<td>name of the repo, e.g. <em>CRAN</em></td>
</tr>
<tr><td>package</td>
<td><em>implicit</em></td>
<td>package file name with version
but without the file extension, e.g.
<em>rpart.plot_1.3-0</em></td>
</tr>
<tr><td>package_name</td>
<td><em>implicit</em></td>
<td>package file name without version
and file extension, e.g. <em>seewave</em></td>
</tr>
<tr><td>ebuild_name</td>
<td><em>implicit</em></td>
<td>ebuild name <tt class="docutils literal">${PN}</tt>, which is the
package_name with special chars
removed or replaced (e.g.,
<em>R.oo</em> (pkg) => <em>R_oo</em> (ebuild))</td>
</tr>
<tr><td>name</td>
<td><em>implicit</em></td>
<td><em>alias to ebuild_name</em></td>
</tr>
</tbody>
</table>
<p>Note the <strong>implicit operator</strong>. It will be used whenever no explicit operator
has been specified in the match statement and the match keyword does not
define a default one. Four explicit operators are available:</p>
<table border="1" class="docutils">
<caption>match statement operators</caption>
<colgroup>
<col width="21%" />
<col width="18%" />
<col width="61%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">operator name</th>
<th class="head">operator(s)</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>exact-string</td>
<td>== =</td>
<td>exact string match</td>
</tr>
<tr><td>nocase-string</td>
<td>,= =,</td>
<td>case-insensitive string match</td>
</tr>
<tr><td>exact-regex</td>
<td>~= =~</td>
<td>exact regex match <em>^<expression>$</em></td>
</tr>
<tr><td>regex</td>
<td>~~ ~</td>
<td>partial regex match</td>
</tr>
<tr><td><em>implicit</em></td>
<td><em>none</em></td>
<td><em>exact-regex</em> operator if <em>accepted value</em>
has any wildcard characters (?, *), else
<em>exact-string</em>. Wildcard chars will
be replaced with their regex equivalents.</td>
</tr>
</tbody>
</table>
<p>The <em>accepted value</em> is a simple string or a regular expression,
which depends on the operator.</p>
<div class="section" id="extended-match-block-syntax">
<h4><a class="toc-backref" href="#contents">8.1.1.1 Extended Match Block Syntax</a></h4>
<p>Sometimes, a rule should apply its actions to a package if it matches <em>any</em>
condition, e.g. <em>package from CRAN or BIOC</em>, or if it does not match a certain
condition, e.g. <em>package not from BIOC/experiment</em>.</p>
<p>This is supported by special <em>match keywords</em> that represent
<em>boolean functions</em>. Such a <em>match statement</em> is introduced by the keyword,
followed by one or more <em>match statements</em> that are indented by one asterisk
<tt class="docutils literal">*</tt> or dash <tt class="docutils literal">-</tt> character for each <em>boolean function</em> that is currently
active. These characters are important and indicate the <em>match depth</em>.
A depth of 0 means that no function is active.</p>
<p>Syntax Example:</p>
<pre class="code literal-block">
MATCH:
<match statement 1, match depth 0>
...
<boolean function>
* <match statement 1, match depth 1>
* <match statement 2, match depth 1>
* ...
* <match statement m, match depth 1>
...
<match statement n, match depth 0>
ACTION:
...
END;
</pre>
<p>For reference, the following table lists the <em>boolean functions</em> available,
their <em>match keywords</em> and their meaning:</p>
<table border="1" class="docutils">
<caption>boolean functions</caption>
<colgroup>
<col width="25%" />
<col width="18%" />
<col width="56%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">boolean function</th>
<th class="head">match
keyword(s)</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>AND</td>
<td>all &&</td>
<td>all listed conditions must match</td>
</tr>
<tr><td>OR</td>
<td>or ||</td>
<td>any
of the listed conditions must match</td>
</tr>
<tr><td>XOR1</td>
<td>xor1 xor ^^</td>
<td>exactly one
of the listed conditions must match</td>
</tr>
<tr><td>NOR</td>
<td>nor none</td>
<td>none
of the listed conditions must match</td>
</tr>
<tr><td>VERUM</td>
<td>any true</td>
<td>always true</td>
</tr>
<tr><td>FALSUM</td>
<td>none false</td>
<td>always false</td>
</tr>
</tbody>
</table>
<p>In other words, a (boolean) match keyword starts a <em>nested match block</em>
at any position in the current one and increases the <em>match depth</em> by one.
The nested block is terminated by indenting out, i.e. decreasing the
<em>match depth</em> by one. The (extended) match statement syntax then becomes:</p>
<pre class="code literal-block">
<'*'^<match_depth>> <(basic) match statement>
</pre>
<div class="note">
<p class="first admonition-title">Note</p>
<p>The extended match statement syntax does not support boolean functions
with a fixed number of conditions, e.g. 1. This is why there is no
<em>NOT</em> function. The definition for more than one condition would be
ambiguous, either <em>NOR</em> or <em>NAND</em>.</p>
<p>Correspondingly, the logic for the top-level match block is <em>AND</em> by
convention.</p>
<p class="last"><em>VERUM</em> and <em>FALSUM</em> do not accept any nested condition.</p>
</div>
<p>Using this syntax, match blocks can be nested indefinitely (minus technical
limitations):</p>
<pre class="code literal-block">
MATCH:
<match statement 1, depth 0>
<boolean function 2, depth 0>
* <match statement 1, depth 1>
* <match statement 2, depth 1>
* ...
* <match statement k-1, depth 1>
* <boolean function k, depth 1>
** <match statement 1, depth 2>
** ...
** <match statement o, depth 2>
* <match statement k+1, depth 1>
* ...
* <match statement m, depth 1>
...
<match statement n, depth 0>
ACTION:
...
END;
</pre>
</div>
</div>
<div class="section" id="action-blocks">
<h3><a class="toc-backref" href="#contents">8.1.2 Action Blocks</a></h3>
<p>The action block syntax is quite simple. Each <em>action statement</em> starts
with an <em>action keyword</em>, optionally followed by one or more <em>values</em>.</p>
<p>Action statement syntax:</p>
<pre class="code literal-block">
<action keyword> [<value>]*
</pre>
<p>The value(s) can be enclosed by quotation characters (<tt class="docutils literal">"</tt>, <tt class="docutils literal">'</tt>).</p>
<p>The following table lists all <em>action keywords</em>, their impact (<em>what</em> they
control <em>where</em>) and the number of values they accept:</p>
<table border="1" class="docutils">
<caption>action keywords</caption>
<colgroup>
<col width="22%" />
<col width="26%" />
<col width="18%" />
<col width="33%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">action keyword</th>
<th class="head">affects</th>
<th class="head"># of values</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>ignore</td>
<td rowspan="2">overlay creation</td>
<td rowspan="2">none</td>
<td rowspan="2">ignore package,
do not try to create
an ebuild for it</td>
</tr>
<tr><td>do-not-process</td>
</tr>
<tr><td>keywords</td>
<td rowspan="2">ebuild variables</td>
<td>>= 1</td>
<td>set per-package
<tt class="docutils literal">KEYWORDS</tt></td>
</tr>
<tr><td>license</td>
<td>1</td>
<td>set <tt class="docutils literal">LICENSE</tt></td>
</tr>
<tr><td rowspan="2">trace</td>
<td rowspan="2">package rules</td>
<td>none</td>
<td>mark a package as
modified</td>
</tr>
<tr><td>1</td>
<td>add the stored string
to a package's
<em>modified</em> variable
whenever this action
is applied</td>
</tr>
<tr><td>set</td>
<td rowspan="6">package metadata,
overlay creation,
ebuild creation</td>
<td>2</td>
<td rowspan="2">set package
information</td>
</tr>
<tr><td>set_<key></td>
<td>1</td>
</tr>
<tr><td>rename</td>
<td>2</td>
<td rowspan="2">modify package
information with
sed-like
<em>s/expr/repl/</em>
statements</td>
</tr>
<tr><td>rename_<key></td>
<td>1</td>
</tr>
<tr><td>add</td>
<td>2</td>
<td rowspan="2">similar to <em>set</em>, but
can be applied
multiple times without
overwriting existing
information</td>
</tr>
<tr><td>add_<key></td>
<td>1</td>
</tr>
<tr><td>depstr_ignore</td>
<td rowspan="2">ebuild creation</td>
<td rowspan="2">1</td>
<td rowspan="2">ignore
<em>dependency strings</em></td>
</tr>
<tr><td>depres_ignore</td>
</tr>
<tr><td>null</td>
<td rowspan="2"><em>n/a</em></td>
<td rowspan="2">none</td>
<td rowspan="2">does nothing
(can be used for
improving readability)</td>
</tr>
<tr><td>pass</td>
</tr>
</tbody>
</table>
<p>The two-arg form of the set/rename/add keywords expect a <key> as first and
a value / sed expression as second arg. The one-arg form expects the latter
one only. keys are case-insensitive. The "/" delimitier in the sed expression
can be any other character.</p>
<p>The following <em>info keys</em> can be set and/or modified:</p>
<table border="1" class="docutils">
<caption>info keys for set/rename/add</caption>
<colgroup>
<col width="18%" />
<col width="33%" />
<col width="49%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">info key</th>
<th class="head">supports set/rename/add</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>name</td>
<td>yes / yes / no</td>
<td>rename the ebuild</td>
</tr>
<tr><td>category</td>
<td>yes / yes (<em>repo name</em>)
/ no</td>
<td>set or rename (based on the
repository's name) the package's
category</td>
</tr>
<tr><td>destfile</td>
<td>yes / yes / no</td>
<td>rename ebuild destfile by using the
'->' operator in <tt class="docutils literal">${SRC_URI}</tt></td>
</tr>
<tr><td>DEPEND</td>
<td rowspan="3">no / no / <strong>yes</strong></td>
<td rowspan="3"><p class="first">add additional dependencies to
<em>DEPEND/RDEPEND/RSUGGESTS</em></p>
<p class="last">The value has to be a string
accepted by the package manager,
e.g. a <em>DEPEND Atom</em>.</p>
</td>
</tr>
<tr><td>RDEPEND</td>
</tr>
<tr><td>RSUGGESTS</td>
</tr>
</tbody>
</table>
<p>The <em>set</em> action also supports variable substitution by means of python
string formatting (<tt class="docutils literal">{info_key}</tt>), for example:</p>
<pre class="code literal-block">
set category sci-{repo_name}
</pre>
<p>The following <em>info keys</em> can be accessed:</p>
<table border="1" class="docutils">
<caption>info keys available for variable substitution</caption>
<colgroup>
<col width="29%" />
<col width="71%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">info key</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>repo_name</td>
<td>name of the repo, e.g. <em>CRAN</em></td>
</tr>
<tr><td>version</td>
<td>package version <tt class="docutils literal">${PV}</tt></td>
</tr>
<tr><td>package_name</td>
<td>package file name without version
and file extension, e.g. <em>seewave</em></td>
</tr>
<tr><td>name</td>
<td>ebuild name <tt class="docutils literal">${PN}</tt></td>
</tr>
<tr><td>package_filename</td>
<td>package file name with file extension,
e.g. <em>seewave_1.7.0.tar.gz</em></td>
</tr>
</tbody>
</table>
<div class="caution">
<p class="first admonition-title">Caution!</p>
<p class="last">Category moves are not handled automatically. In incremental mode, overlay
creation has to be called with either <tt class="docutils literal"><span class="pre">--fixup-category-move</span></tt> or
<tt class="docutils literal"><span class="pre">--fixup-category-move-reverse</span></tt>, depending on whether the package(s)
have been moved away from the default category or back to the default
category ("reverse"). Configuring both category move types at once requires
a full recreation of the overlay, that is <tt class="docutils literal">rm <span class="pre">-rf</span> <overlay dir></tt>
followed by <tt class="docutils literal">roverlay create</tt>.</p>
</div>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Applying the same ebuild variable, set or rename action more than once
is possible, but only the last one will have an effect on ebuild creation.
add actions are cumulative by definition.</p>
</div>
<div class="section" id="extended-action-block-syntax">
<h4><a class="toc-backref" href="#contents">8.1.2.1 Extended Action Block Syntax</a></h4>
<p>A mentioned before, action blocks can contain <em>nested rules</em>. The syntax
is exactly the same as for the normal package rules:</p>
<pre class="code literal-block">
MATCH:
# top-level rule, match block
...
ACTION:
# top-level rule, action block
...
MATCH:
# nested rule, match block
...
ACTION:
# nested rule, action block
...
END;
# top-level rule, action block continues
...
ELSE:
# top-level rule, alternative action block
...
MATCH:
# (alternative) nested rule, match block
...
ACTION:
# (alternative) nested rule, action block
...
ELSE:
# (alternative) nested rule, alternative action block
...
END;
END;
</pre>
<p>Rules can be nested indefinitely, whitespace indention is optional.
A <em>nested rule</em> only becomes active, i.e. tries to match a package, if its
enclosing rule already matched it. This can be used to reduce the number of
checks necessary for a given package.</p>
</div>
</div>
<div class="section" id="package-rule-examples">
<h3><a class="toc-backref" href="#contents">8.1.3 Package Rule Examples</a></h3>
<p>A rule that ignores the 'yaqcaffy' package from CRAN, which is also available
from BIOC. Additionally, it sets the category for all non-ignored packages
from CRAN to sci-CRAN:</p>
<pre class="code literal-block">
MATCH:
repo CRAN
ACTION:
MATCH:
package_name == yaqcaffy
ACTION:
do-not-process
ELSE:
set category sci-CRAN
END;
END;
</pre>
<p>A more complex example that sets the <tt class="docutils literal">KEYWORDS</tt> ebuild variable for
all packages whose name contains <em>amd64</em> or <em>x86_64</em> to <tt class="docutils literal"><span class="pre">-x86</span> ~amd64</tt>
if the package is from BIOC/experiment, and otherwise to <tt class="docutils literal"><span class="pre">-x86</span> amd64</tt>:</p>
<pre class="code literal-block">
MATCH:
or
* package_name ~ x86_64
* package_name ~ amd64
ACTION:
MATCH:
repo == BIOC/experiment
ACTION:
keywords "-x86 ~amd64"
ELSE:
keywords "-x86 amd64"
END;
END;
</pre>
<p>A rule that assigns all packages from BIOC-2.10/bioc to sci-bioc:</p>
<pre class="code literal-block">
MATCH:
repo == BIOC-2.10/bioc
ACTION:
set category sci-bioc
END;
# alternatively:
MATCH:
repo == BIOC-2.10/bioc
ACTION:
set_category sci-bioc
END;
</pre>
<p>A more generic rule that sets per-repo categories:</p>
<pre class="code literal-block">
MATCH:
any
ACTION:
# set category
# CRAN->sci-CRAN, CRAN-Archive->sci-CRAN,
# BIOC-2.10/experimental->sci-BIOC, ...
#
rename category s=^(?P<repo>[^-/]+)([-/].*)?$=sci-\g<repo>=
END;
</pre>
<p>The following example prefixes all <em>yaml</em> packages with <em>Rpkg_</em>:</p>
<pre class="code literal-block">
MATCH:
ebuild_name ,= yaml
ACTION:
set destfile Rpkg_{package_filename}
END;
# alternatively:
MATCH:
ebuild_name ,= yaml
ACTION:
rename destfile s/^/Rpkg_/
END;
</pre>
<p>Moving such packages to a "R-packages" sub directory would be possible, too:</p>
<pre class="code literal-block">
MATCH:
name ,= yaml
ACTION:
set_destfile R-packages/{package_filename}
END;
# alternatively:
MATCH:
name ,= yaml
ACTION:
rename_destfile s=^=R-packages/=
END;
</pre>
<div class="hint">
<p class="first admonition-title">Hint</p>
<p class="last"><tt class="docutils literal">roverlay <span class="pre">[--no-sync]</span> <span class="pre">[--dump-file</span> <file>] apply_rules</tt> can be used to
test rules. It applies the rules to all packages without running overlay
creation. Furthermore, <tt class="docutils literal">roverlay <span class="pre">--ppr</span></tt> parses the package rules,
prints them and exits afterwards.</p>
</div>
</div>
</div>
</div>
<div class="section" id="event-hooks">
<h1><a class="toc-backref" href="#contents">9 Event Hooks</a></h1>
<p><em>roverlay</em> is able to call a script when certain events occur, e.g. after
successful overlay creation, which can be used to perform additional actions
without touching <em>roverlay's</em> source code.</p>
<p>To realize this, <em>roverlay</em> determines whether a given event is permitted
(<a class="reference internal" href="#event-policy">event policy</a>) and, if so, creates a <a class="reference internal" href="#hook-environment">hook environment</a> and runs the
script. Additionally, shell scripts can load <em>roverlay's</em> <em>$FUNCTIONS</em> file,
which provides extra functionality.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last"><em>roverlay</em> waits until the script terminates and thus possibly waits
forever.</p>
</div>
<div class="section" id="default-event-script">
<h2><a class="toc-backref" href="#contents">9.1 Default event script</a></h2>
<p>The default event script (<tt class="docutils literal">mux.sh</tt>) loads <em>$FUNCTIONS</em> and then runs the
following script files (by sourcing them), in order:</p>
<ol class="arabic simple">
<li>all files from <a class="reference internal" href="#additions-dir">ADDITIONS_DIR</a>/hooks/<event> that end with <em>.sh</em>
(<tt class="docutils literal"><span class="pre"><ADDITIONS_DIR>/hooks/<event>/*.sh</span></tt>)</li>
<li>all files <a class="reference internal" href="#additions-dir">ADDITIONS_DIR</a>/hooks that end with <em>.<event></em>
(<tt class="docutils literal"><span class="pre"><ADDITIONS_DIR>/hooks/*.<event></span></tt>)</li>
</ol>
<p>So, there are two naming schemes for <em>hook scripts</em>.
Either one is acceptable, but it is advised to stay consistent.
Having the same script at both locations results in executing it twice.</p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">The default event script enables <em>nounset</em> behavior, which causes the
shell command interpreter to exit abnormally if an unset variable is
accessed.</p>
</div>
<div class="section" id="activating-a-hook-script">
<h3><a class="toc-backref" href="#contents">9.1.1 Activating a hook script</a></h3>
<p>Use <tt class="docutils literal"><span class="pre">roverlay-setup</span> hooks</tt> for managing hooks:</p>
<pre class="literal-block">
# activate a hook by adding it to one or more events
# the script's default event is used if <event> is omitted.
roverlay-setup hooks add <name> [<event>...]
# deactive a hook (remove it from one or more events)
roverlay-setup hooks del <name> [<event>...]
# list all hooks and show for which events they are run
roverlay-setup hooks [show]
</pre>
<p>Alternatively, hook scripts can be activated by means of symlinking:</p>
<pre class="code text literal-block">
ln -s <real script> ${ADDITIONS_DIR}/hooks/<event>/<name>.sh
# or
ln -s <real script> ${ADDITIONS_DIR}/hooks/<name>.<event>
</pre>
</div>
<div class="section" id="adding-a-new-hook-script">
<h3><a class="toc-backref" href="#contents">9.1.2 Adding a new hook script</a></h3>
<p>As hinted before, <em>hook scripts</em> are simple shell scripts. The following
template gives an idea of how to write them:</p>
<pre class="code sh literal-block">
<span class="comment">#!/bin/sh
#set -u
</span>
<span class="comment"># load essential functions
# (not necessary when using the default event script)
</span>. <span class="literal string double">"${FUNCTIONS?}"</span> <span class="operator">||</span> <span class="name builtin">exit</span>
<span class="comment">## load additional function files, if any
#$lf <name(s)>
</span>
<span class="comment"># script body
#
# when redirecting output to $DEVNULL, use ">>" instead of ">" as
# $DEVNULL could be a file
#ls >>${DEVNULL}
#
# ...
</span>
<span class="comment"># the script must not exit if everything went well (return is ok)
</span><span class="keyword">return </span>0
</pre>
</div>
</div>
<div class="section" id="event-policy">
<h2><a class="toc-backref" href="#contents">9.2 Event Policy</a></h2>
<p>The <em>event policy</em> controls whether a certain event actually triggers a script
call or not.
It is constructed by parsing the <a class="reference internal" href="#event-hook-restrict">EVENT_HOOK_RESTRICT</a> config option:</p>
<ul class="simple">
<li>a word prefixed by <tt class="docutils literal">-</tt> means <em>deny specific event</em> (-> blacklist)</li>
<li>the asterisk char <tt class="docutils literal">*</tt> (or <tt class="docutils literal">+*</tt>) sets the policy to
<em>allow unless denied</em> (blacklist) or <em>allow all</em></li>
<li>a word prefixed by <tt class="docutils literal">+</tt> or without a prefix char means
<em>allow specific event</em> (-> whitelist)</li>
<li>the asterisk char with <tt class="docutils literal">-</tt> as prefix (<tt class="docutils literal"><span class="pre">-*</span></tt>) sets the policy to
<em>deny unless allowed</em> (whitelist) or <em>deny all</em></li>
</ul>
<p>The policy defaults to <em>allow all</em> if <tt class="docutils literal">EVENT_HOOK_RESTRICT</tt> is not set in
the config file. An empty string sets the policy to <em>deny all</em>.</p>
</div>
<div class="section" id="hook-environment">
<h2><a class="toc-backref" href="#contents">9.3 Hook Environment</a></h2>
<table border="1" class="docutils">
<caption>environment variables provided by <em>roverlay</em></caption>
<colgroup>
<col width="21%" />
<col width="25%" />
<col width="54%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">variable</th>
<th class="head">source</th>
<th class="head">notes / description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>PATH</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td>LOGNAME</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td>SHLVL</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td>TERM</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td>HOME</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td>LANG</td>
<td>os.environ</td>
<td> </td>
</tr>
<tr><td><em>LC_*</em></td>
<td>os.environ</td>
<td>all environment variables starting
with LC_</td>
</tr>
<tr><td>PORTDIR</td>
<td>config</td>
<td>path to the main portage tree
(<a class="reference internal" href="#portdir">PORTDIR</a>, optional)</td>
</tr>
<tr><td>ROVERLAY_PHASE</td>
<td>event</td>
<td>event that caused the script to run</td>
</tr>
<tr><td>HAS_CHANGES</td>
<td><em>internal</em></td>
<td>a shbool (<tt class="docutils literal">y</tt> or <tt class="docutils literal">n</tt>) that
indicates whether the overlay has
any changes</td>
</tr>
<tr><td>OVERLAY_NAME</td>
<td>config</td>
<td>name of the overlay</td>
</tr>
<tr><td>OVERLAY</td>
<td>config</td>
<td rowspan="2">overlay directory (<a class="reference internal" href="#overlay-dir">OVERLAY_DIR</a>),</td>
</tr>
<tr><td>S</td>
<td><em>$OVERLAY</em></td>
</tr>
<tr><td>PWD</td>
<td><em>$OVERLAY</em>
<em>$ROVERLAY_PHASE</em></td>
<td><p class="first">initial working directory</p>
<p class="last">depends on $ROVERLAY_PHASE (usually set
to $OVERLAY or left unchanged)</p>
</td>
</tr>
<tr><td>DISTROOT</td>
<td>config</td>
<td>package mirror directory
(<a class="reference internal" href="#overlay-distdir-root">OVERLAY_DISTDIR_ROOT</a>)</td>
</tr>
<tr><td>TMPDIR</td>
<td>os.environ,
<em>fallback</em></td>
<td rowspan="2">directory for temporary files</td>
</tr>
<tr><td>T</td>
<td><em>$TMPDIR</em></td>
</tr>
<tr><td>ADDITIONS_DIR</td>
<td>config</td>
<td rowspan="2">directory with supplementary files
(<a class="reference internal" href="#overlay-additions-dir">OVERLAY_ADDITIONS_DIR</a>)</td>
</tr>
<tr><td>FILESDIR</td>
<td><em>$ADDITIONS_DIR</em></td>
</tr>
<tr><td>WORKDIR</td>
<td>config</td>
<td>directory for work data
(<a class="reference internal" href="#cachedir">CACHEDIR</a>)</td>
</tr>
<tr><td>SHLIB</td>
<td><em>$ADDITIONS_DIR</em>,
<em>installed?</em></td>
<td>A list of directories with shell
function files
(optional, only set if any dir exists)</td>
</tr>
<tr><td>FUNCTIONS</td>
<td><em>$ADDITIONS_DIR</em>,
<em>installed?</em></td>
<td>file with essential shell functions
(optional, only set if it exists)</td>
</tr>
<tr><td>DATADIR</td>
<td><em>installed?</em></td>
<td>location of installed data files
(directory, usually
<em>/usr/share/roverlay</em>)</td>
</tr>
<tr><td>ROVERLAY_HELPER_EXE</td>
<td>sys.argv</td>
<td>path to the roverlay executable that
created the hook environment
(usually <em>/usr/bin/roverlay</em> or
<em>/usr/bin/roverlay-sh</em>)</td>
</tr>
<tr><td>ROVERLAY_EXE</td>
<td>guessed,
<em>$ROVERLAY_HELPER_EXE</em></td>
<td>guessed path to the roverlay "main"
executable (which creates the overlay)</td>
</tr>
<tr><td>ROVERLAY_HOOKRC</td>
<td>config</td>
<td>hook config file (<a class="reference internal" href="#event-hook-rc">EVENT_HOOK_RC</a>,
optional)</td>
</tr>
<tr><td>STATS_DB</td>
<td>config</td>
<td>stats database file
(optional, only set if configured)</td>
</tr>
<tr><td>DEBUG</td>
<td>log level</td>
<td><em>shbool</em> (<tt class="docutils literal">y</tt> or <tt class="docutils literal">n</tt>) that
indicates whether debug messages should
be printed</td>
</tr>
<tr><td>VERBOSE</td>
<td>log level</td>
<td><em>shbool</em></td>
</tr>
<tr><td>QUIET</td>
<td>log level</td>
<td><em>shbool</em> that indicates whether scripts
should be quiet</td>
</tr>
<tr><td>NO_COLOR</td>
<td><em>n/a</em></td>
<td><em>shbool</em>. Always set to <em>y</em> since
colored output should not be produced</td>
</tr>
<tr><td>NOSYNC</td>
<td>config</td>
<td><em>shbool</em> that indicates whether data
transfers from/to remote machines is
allowed (<a class="reference internal" href="#nosync">NOSYNC</a>)</td>
</tr>
<tr><td>EBUILD</td>
<td>config</td>
<td>the <em>ebuild</em> executable</td>
</tr>
<tr><td>GIT_EDITOR</td>
<td><em>n/a</em></td>
<td rowspan="2">set to <em>/bin/false</em></td>
</tr>
<tr><td>GIT_ASKPASS</td>
<td><em>n/a</em></td>
</tr>
</tbody>
</table>
<p>The default <em>essential shell functions</em> file (<em>$FUNCTIONS</em>) makes,
when included in the hook script, most of the enviroment variables readonly.</p>
<table border="1" class="docutils">
<caption>variables provided by <em>$FUNCTIONS</em></caption>
<colgroup>
<col width="24%" />
<col width="76%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">variable</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>IFS_DEFAULT</td>
<td>default <em>internal field separator</em></td>
</tr>
<tr><td>IFS_NEWLINE</td>
<td><em>IFS</em> for iterating over text lines</td>
</tr>
<tr><td>DEVNULL</td>
<td><em>/dev/null</em> target (could also be a file)</td>
</tr>
<tr><td>EX_OK</td>
<td><em>success</em> exit code</td>
</tr>
<tr><td>EX_ERR</td>
<td>default error exit code</td>
</tr>
<tr><td>EX_ARG_ERR</td>
<td>default exit code for arg errors</td>
</tr>
<tr><td>EX_CANNOT_RUN</td>
<td><p class="first">default exit code when a hook cannot run,
e.g. if an essential program is missing</p>
<p class="last">Defaults to <tt class="docutils literal">$EX_OK</tt>.</p>
</td>
</tr>
<tr><td>EX_GIT_ERR
EX_GIT_ADD_ERR
EX_GIT_COMMIT_ERR
EX_GIT_PUSH_ERR</td>
<td>git-related error codes</td>
</tr>
<tr><td>SCRIPT_FILENAME</td>
<td>file name of the hook script</td>
</tr>
<tr><td>SCRIPT_NAME</td>
<td>name of the hook script (without file extension)</td>
</tr>
<tr><td>this</td>
<td><p class="first">initially a copy of <tt class="docutils literal">${SCRIPT_NAME}</tt>, but can be
modified (not a constant).</p>
<p class="last">Set to the name of the actual hook script when using
the default event script.</p>
</td>
</tr>
<tr><td>lf</td>
<td>reference to a function that loads additional shell
function files</td>
</tr>
</tbody>
</table>
<p><em>$FUNCTIONS</em> also provides a number of shell functions:</p>
<pre class="code sh literal-block">
<span class="comment"># --- message ---
#
# void veinfo ( message )
# Prints a message to stdout if $DEBUG is set to 'y'.
#
# void einfo ( message )
# Prints a message to stdout if $VERBOSE is set to 'y'.
#
# void ewarn ( message )
# Prints a message to stderr unless $QUIET is set to 'y'.
#
# void eerror ( message )
# Prints a message to stderr.
#
#
# --- core ---
#
# @noreturn die ( [message], [exit_code] ), raises exit()
# Lets the script die with the given message/exit code.
#
# @noreturn die_cannot_run ( [reason] ), raises die (**EX_CANNOT_RUN)
# Lets the script die due to missing preconditions.
#
# @noreturn OUT_OF_BOUNDS(), raises die()
# Lets the script die due to insufficient arg count.
#
# int run_command ( *cmdv )
# Logs a command and runs it afterwards.
#
# int run_command_logged ( *cmdv )
# Logs a command, runs it and logs the result.
#
# void autodie ( *cmdv ), raises die()
# Runs a command. Lets the script die if the command fails.
#
#
# void load_functions ( *filenames, **SHLIB ), raises die()
# Loads additional shell functions file(s) from $SHLIB.
# (Referenced by $lf.)
#
# void dont_run_as_root(), raises die()
# Lets the script die if it is run as root.
#
# int list_has ( word, *list_items )
# Returns 0 if $word is in the given list, else 1.
#
# int qwhich ( *command )
# Returns 0 if all listed commands could be found, else 1.
#
# int sync_allowed ( action_name, [msg_nosync], [msg_sync] )
# Returns 0 if syncing for the given action is allowed, else 1.
# Also prints a message.
#
#
# --- fs ---
#
# int dodir ( *dir )
# Ensures that zero or more directories exist by creating them if
# necessary. Returns the number of directories that could not be created.
#
#
# --- str ---
#
# int yesno ( word, **YESNO_YES=0, **YESNO_NO=1, **YESNO_EMPTY=2 )
# Returns $YESNO_YES if $word means "yes", $YESNO_EMPTY if $word is empty
# and $YESNO_NO otherwise (if $word probably means "no").
#
# ~int str_trim ( *args )
# Removes whitespace at the beginning and end of a string and replaces
# any whitespace sequence within the string with a single space char.
# Passes the return value of the underlying sed command.
#
# ~int str_upper ( *args )
# Echoes the uppercase variant of stdin or *args.
# Passes tr's return value.
#
# ~int str_lower ( *args )
# Echoes the lowercase variant of stdin or *args.
# Passes tr's return value.
#
# ~int str_field ( fieldspec, *args, **FIELD_SEPARATOR=' ' )
# Echoes the requested fields of stdin or *args.
# Passes cut's return value.
#
#
# --- int ---
#
# int is_int ( word )
# Returns 0 if $word is an integer, else 1.
#
# int is_natural ( word )
# Returns 0 if $word is an integer >= 0, else 1.
#
# int is_positive ( word )
# Returns 0 if $word is an integer >= 1, else 1.
#
# int is_negative ( word )
# Returns 0 if $word is an integer < 0, else 1.
#</span>
</pre>
</div>
<div class="section" id="adding-a-function-file">
<h2><a class="toc-backref" href="#contents">9.4 Adding a function file</a></h2>
<p>Function files are shell script files that provide functions and variables.
They should, however, not execute any code directly.</p>
<p>The template below illustrates how to write function files:</p>
<pre class="code sh literal-block">
<span class="comment"># protect against repeated inclusion of this file
# (replace <name> with a unique identifier)
</span><span class="keyword">if</span> <span class="operator">[</span> -z <span class="literal string double">"${__HAVE_<name>__-}"</span> <span class="operator">]</span>; <span class="keyword">then
</span><span class="name builtin">readonly </span>__HAVE_<name>__<span class="operator">=</span>y
<span class="comment"># function file body
# ...
</span>
<span class="keyword">fi</span>
</pre>
<p>Shell function files should be put into <tt class="docutils literal"><span class="pre"><ADDITIONS_DIR>/shlib</span></tt>.</p>
</div>
<div class="section" id="hook-event-table">
<h2><a class="toc-backref" href="#contents">9.5 Hook event table</a></h2>
<p>The following table lists all known events (<tt class="docutils literal">ROVERLAY_PHASE</tt>):</p>
<table border="1" class="docutils">
<colgroup>
<col width="25%" />
<col width="36%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">initial working directory</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>overlay_success</td>
<td><em>$OVERLAY</em></td>
<td>overlay creation succeeded</td>
</tr>
<tr><td>db_written</td>
<td><em>$OVERLAY</em></td>
<td>stats database file written</td>
</tr>
<tr><td>user</td>
<td>unchanged</td>
<td>user-triggered event</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="adding-a-hook-event">
<h2><a class="toc-backref" href="#contents">9.6 Adding a hook event</a></h2>
<p>Adding a new event has to be done in <em>roverlay's</em> source code and is a rather
trivial task. The <tt class="docutils literal">roverlay.hook</tt> module implements a function for running
the event script:</p>
<pre class="code python literal-block">
<span class="comment"># import hook module</span>
<span class="keyword namespace">import</span> <span class="name namespace">roverlay.hook</span>
<span class="comment"># ...</span>
<span class="comment"># then, somewhere in the code</span>
<span class="name">roverlay</span><span class="operator">.</span><span class="name">hook</span><span class="operator">.</span><span class="name">run</span> <span class="punctuation">(</span> <span class="literal string">"<event>"</span> <span class="punctuation">)</span>
<span class="comment"># ...</span>
<span class="name">roverlay</span><span class="operator">.</span><span class="name">hook</span><span class="operator">.</span><span class="name">run</span> <span class="punctuation">(</span> <span class="literal string">"<another event>"</span> <span class="punctuation">)</span>
</pre>
</div>
</div>
<div class="section" id="configuration-reference">
<h1><a class="toc-backref" href="#contents">10 Configuration Reference</a></h1>
<p>The main config file uses '<option> = <value>' syntax, comment lines start
with <strong>#</strong>. Variable substitution ("${X}") is not supported. Quotes around
the value are optional and allow to span long values over multiple lines.
Whitespace is ignored, file <strong>paths must not contain whitespace</strong>.</p>
<p>Some options have value type restrictions. These <em>value types</em> are used:</p>
<dl class="docutils">
<dt>log_level</dt>
<dd>Value has to be a log level. Available choise are <em>DEBUG</em>, <em>INFO</em>, <em>WARN</em>,
<em>WARNING</em>, <em>ERROR</em> and <em>CRITICAL</em>.</dd>
<dt>bool</dt>
<dd><p class="first">Value is a string that represents a boolean value.</p>
<p>This table illustrates which value strings are accepted:</p>
<table border="1" class="last docutils">
<colgroup>
<col width="59%" />
<col width="41%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">string value</th>
<th class="head">boolean value</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>y, yes, on, 1, true, enabled</td>
<td><em>True</em></td>
</tr>
<tr><td>n, no, off, 0, false, disabled</td>
<td><em>False</em></td>
</tr>
<tr><td><em><any other value></em></td>
<td><strong>not allowed</strong></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>There are also some implicit <em>value types</em>:</p>
<dl class="docutils">
<dt>list</dt>
<dd>This means that a option has several values that are separated by
whitespace. Quotation marks have to be used to specify more than one
value.</dd>
<dt>file, dir</dt>
<dd>A value that represents a file system location will be expanded ('~' will
be replaced by the user's home etc.).
Additionaly the value has to be a file (or directory) if it exists.</dd>
<dt><empty></dt>
<dd>Specifying empty values often leads to errors if an option has value type
restrictions. Commenting it out is safe.</dd>
</dl>
<p>The following sections will list all config entries.</p>
<div class="section" id="misc-options">
<h2><a class="toc-backref" href="#contents">10.1 misc options</a></h2>
<dl class="docutils" id="cachedir">
<dt>CACHEDIR</dt>
<dd><p class="first">Directory for persistent files that don't belong to the overlay, e.g.
the distmap file.</p>
<p class="last">This option is <strong>required</strong>.</p>
</dd>
</dl>
<dl class="docutils" id="stats-db-file">
<dt>STATS_DB</dt>
<dd><p class="first">Path to the stats database file. <em>roverlay</em> creates it if necessary.</p>
<p class="last">Defaults to <not set>, which disables database writing.</p>
</dd>
</dl>
<dl class="docutils" id="template-root">
<dt>TEMPLATE_ROOT</dt>
<dd><p class="first">List of directories with templates for generating status reports.</p>
<p><em>/usr/share/roverlay/mako_templates</em> is automatically added to this list
if roverlay has been installed.</p>
<p>This option is <strong>required</strong> for <em>roverlay-status</em>, but doesn't need to be
set if roverlay has been installed.</p>
<p class="last">Defaults to <not set>.</p>
</dd>
</dl>
<dl class="docutils" id="template-module-dir">
<dt>TEMPLATE_MODULE_DIR</dt>
<dd><p class="first">Directory for caching mako templates.</p>
<p class="last">Defaults to <a class="reference internal" href="#cachedir">CACHEDIR</a>/mako_templates.</p>
</dd>
</dl>
<dl class="docutils" id="distfiles">
<dt>DISTFILES</dt>
<dd>Alias to <a class="reference internal" href="#distfiles-root">DISTFILES_ROOT</a>.</dd>
</dl>
<dl class="docutils" id="distfiles-root">
<dt>DISTFILES_ROOT</dt>
<dd><p class="first">The root directory of per-repository package directories. Repos will create
their package directories in this directory unless they specify another
location (see <a class="reference internal" href="#repo-config-options">repo config options</a>).</p>
<p class="last">This option is <strong>required</strong>.</p>
</dd>
</dl>
<dl class="docutils" id="distroot">
<dt>DISTROOT</dt>
<dd>Alias to <a class="reference internal" href="#distfiles-root">DISTFILES_ROOT</a>.</dd>
</dl>
<dl class="docutils" id="ebuild-prog">
<dt>EBUILD_PROG</dt>
<dd><p class="first">Name or path of the ebuild executables that is required for (external)
Manifest file creation. A wrong value will cause ebuild creation to fail
late, which is a huge time loss, so make sure that this option is properly
set.</p>
<p class="last">Defaults to <em>ebuild</em>, which should be fine in most cases.</p>
</dd>
</dl>
<dl class="docutils" id="nosync">
<dt>NOSYNC</dt>
<dd><p class="first">A <em>bool</em> that controls whether <em>syncing</em>, i.e. data transfers from/to
remote machines, is allowed or forbidden.</p>
<p class="last">Defaults to <em>no</em>.</p>
</dd>
</dl>
<dl class="docutils" id="rsync-bwlimit">
<dt>RSYNC_BWLIMIT</dt>
<dd><p class="first">Set a max. average bandwidth usage in kilobytes per second.
This will pass '--bwlimit=<value>' to all rsync commands.</p>
<p class="last">Defaults to <not set>, which disables bandwidth limitation.</p>
</dd>
</dl>
<dl class="docutils" id="websync-timeout">
<dt>WEBSYNC_TIMEOUT</dt>
<dd><p class="first">Set the timeout for websync repo connections, in seconds.</p>
<p class="last">Defaults to 10.</p>
</dd>
</dl>
<dl class="docutils" id="portdir">
<dt>PORTDIR</dt>
<dd><p class="first">Path to the portage tree. This option is <strong>recommended</strong>, but not always
required (see <a class="reference internal" href="#use-portage-licenses">USE_PORTAGE_LICENSES</a>).</p>
<p class="last">Defaults to "/usr/portage".</p>
</dd>
</dl>
</div>
<div class="section" id="overlay-options">
<h2><a class="toc-backref" href="#contents">10.2 overlay options</a></h2>
<dl class="docutils" id="additions-dir">
<dt>ADDITIONS_DIR:</dt>
<dd>Alias to <a class="reference internal" href="#overlay-additions-dir">OVERLAY_ADDITIONS_DIR</a>.</dd>
</dl>
<dl class="docutils" id="backup-desc">
<dt>BACKUP_DESC</dt>
<dd>Alias to <a class="reference internal" href="#overlay-backup-desc">OVERLAY_BACKUP_DESC</a>.</dd>
</dl>
<dl class="docutils" id="distdir">
<dt>DISTDIR</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distdir-root">OVERLAY_DISTDIR_ROOT</a>.</dd>
</dl>
<dl class="docutils" id="distdir-flat">
<dt>DISTDIR_FLAT</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distdir-flat">OVERLAY_DISTDIR_FLAT</a>.</dd>
</dl>
<dl class="docutils" id="distdir-strategy">
<dt>DISTDIR_STRATEGY</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distdir-strategy">OVERLAY_DISTDIR_STRATEGY</a>.</dd>
</dl>
<dl class="docutils" id="distdir-verify">
<dt>DISTDIR_VERIFY</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distdir-verify">OVERLAY_DISTDIR_VERIFY</a>.</dd>
</dl>
<dl class="docutils" id="distmap-compression">
<dt>DISTMAP_COMPRESSION</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distmap-compression">OVERLAY_DISTMAP_COMPRESSION</a>.</dd>
</dl>
<dl class="docutils" id="distmap-file">
<dt>DISTMAP_FILE</dt>
<dd>Alias to <a class="reference internal" href="#overlay-distmap-file">OVERLAY_DISTMAP_FILE</a>.</dd>
</dl>
<dl class="docutils" id="ebuild-use-expand-name">
<dt>EBUILD_USE_EXPAND_NAME</dt>
<dd>Name of the R_SUGGESTS USE_EXPAND variable. Defaults to <em>R_SUGGESTS</em>.</dd>
</dl>
<dl class="docutils" id="eclass">
<dt>ECLASS</dt>
<dd>Alias to <a class="reference internal" href="#overlay-eclass">OVERLAY_ECLASS</a>.</dd>
</dl>
<dl class="docutils" id="manifest-implementation">
<dt>MANIFEST_IMPLEMENTATION</dt>
<dd>Alias to <a class="reference internal" href="#overlay-manifest-implementation">OVERLAY_MANIFEST_IMPLEMENTATION</a>.</dd>
</dl>
<dl class="docutils" id="overlay-additions-dir">
<dt>OVERLAY_ADDITIONS_DIR</dt>
<dd><p class="first">Directory with an overlay-like structure that contains extra files, e.g.
ebuild patches and hand-written ebuilds. This option is not required.</p>
<p class="last">Defaults to <not set>, which disables this feature.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-backup-desc">
<dt>OVERLAY_BACKUP_DESC</dt>
<dd><p class="first">A <em>bool</em> that indicates whether the description file of the <em>R_SUGGESTS</em>
USE_EXPAND variable should be backed up before (over-)writing it.</p>
<p class="last">Defaults to <em>true</em>.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-category">
<dt>OVERLAY_CATEGORY</dt>
<dd><p class="first">Sets the category of created ebuilds. There are no value type restrictions
for this option, but values with a slash <em>/</em> lead to errors.</p>
<p class="last">Defaults to <em>sci-R</em>.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-dir">
<dt>OVERLAY_DIR</dt>
<dd><p class="first">Sets the directory of the overlay that will be created.</p>
<p class="last">This option is <strong>required</strong>.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-distdir-flat">
<dt>OVERLAY_DISTDIR_FLAT</dt>
<dd><p class="first">A <em>bool</em> that controls the overall layout of <a class="reference internal" href="#overlay-distdir-root">OVERLAY_DISTDIR_ROOT</a>.</p>
<p>A flat distdir is a single directory with all package files or package
file links in it. A nested distdir contains per-package directories.</p>
<p class="last">Defaults to <em>true</em>.
This option has no effect if the distdir strategy is <em>tmpdir</em>.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-distdir-root">
<dt>OVERLAY_DISTDIR_ROOT</dt>
<dd><p class="first">Sets the DISTDIR root directory. It is used for Manifest file
creation, but can serve as package mirror directory as well.</p>
<p>The actual appearance of this directory is up to the distdir strategy
(<a class="reference internal" href="#overlay-distdir-strategy">OVERLAY_DISTDIR_STRATEGY</a>) and <a class="reference internal" href="#overlay-distdir-flat">OVERLAY_DISTDIR_FLAT</a>.
Basically, it contains all package files that have a valid ebuild.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">This directory will not be cleaned up, only broken symbolic links
will be removed. On the one hand, it is absolutely guaranteed that
package files will not disappear unless replaced by a new file with
the same name, but on the other hand, the directory may get bloated
over time.</p>
</div>
</dd>
</dl>
<dl class="docutils" id="overlay-distdir-strategy">
<dt>OVERLAY_DISTDIR_STRATEGY</dt>
<dd><p class="first">The distdir strategy defines <em>how</em> package files are created.
It is a list of methods that will be tried in the specified order, until
the first one succeeds.</p>
<table border="1" class="docutils">
<caption>distdir creation methods</caption>
<colgroup>
<col width="14%" />
<col width="86%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">method</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>symlink</td>
<td>use symbolic links</td>
</tr>
<tr><td>hardlink</td>
<td>use hard links</td>
</tr>
<tr><td>copy</td>
<td>copy package files
Obviously, this will need much more disk space.</td>
</tr>
<tr><td>tmpdir</td>
<td>use a temporary DISTDIR that will be deleted at exit.
This method is not compatible with any of the above.</td>
</tr>
</tbody>
</table>
<p class="last">This option is <strong>required</strong>, but has a reasonable value in the default
config file, "hardlink symlink".</p>
</dd>
</dl>
<dl class="docutils" id="overlay-distdir-verify">
<dt>OVERLAY_DISTDIR_VERIFY</dt>
<dd><p class="first">A <em>bool</em> that controls whether file integrity of <em>OVERLAY_DISTDIR_ROOT</em>
should be checked on startup. This is an expensive operation since each
file has to be read once.</p>
<p class="last">Defaults to <em>no</em> as the verification is normally not needed.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-distmap-compression">
<dt>OVERLAY_DISTMAP_COMPRESSION</dt>
<dd><p class="first">Compression format for the distmap file. Choices are none, gzip/gz and
bzip2/bz2.</p>
<p class="last">Defaults to bzip2.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-distmap-file">
<dt>OVERLAY_DISTMAP_FILE:</dt>
<dd><p class="first">File path to the distmap file.</p>
<p class="last">Defaults to <not set>, which results in <a class="reference internal" href="#cachedir">CACHEDIR</a>/distmap.db.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-eclass">
<dt>OVERLAY_ECLASS</dt>
<dd><p class="first">A list of eclass files that will be imported into the overlay and inherited
in all created ebuilds.
Note that overlay creation fails if any of the specified eclass files
cannot be imported.
Eclass files must end with '.eclass' or have no file extension.</p>
<p class="last">Defaults to <not set>, which means that no eclass files will be used.
This is <strong>not useful</strong>, since created ebuilds rely on an eclass for phase
functions like <em>src_install()</em>.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-keep-nth-latest">
<dt>OVERLAY_KEEP_NTH_LATEST</dt>
<dd><p class="first">Setting this option to a value > 0 enables keeping of max. <em>value</em> ebuilds
per R package. All others will be removed.</p>
<p class="last">Defaults to <not set>, which disables this feature and keeps all ebuilds.</p>
</dd>
</dl>
<dl class="docutils" id="overlay-manifest-implementation">
<dt>OVERLAY_MANIFEST_IMPLEMENTATION</dt>
<dd><p class="first">Sets the implementation that will be used for Manifest file writing.
Available choices are <em>ebuild</em>, <em>next</em>, <em>default</em> and <em>none</em>.
Defaults to <em>default</em> (-> <em>next</em>).</p>
<p><em>next</em> is an mostly internal implementation that is considerably faster
than <em>ebuild</em>. <em>ebuild</em> is still used when creating Manifest files for
imported ebuilds.</p>
<div class="note last">
<p class="first admonition-title">Note</p>
<p class="last">Choosing 'none' is destructive - <em>roverlay</em> will fail to function
whenever Manifest access is required.
Use the '--no-manifest' command line option to disable manifest
writing.</p>
</div>
</dd>
</dl>
<dl class="docutils" id="overlay-masters">
<dt>OVERLAY_MASTERS</dt>
<dd><p class="first">A list of repo names that are used as 'masters' attribute when generating
<tt class="docutils literal"><span class="pre"><overlay>/metadata/layout.conf</span></tt>.</p>
<p class="last">Defaults to "gentoo".</p>
</dd>
</dl>
<dl class="docutils" id="overlay-name">
<dt>OVERLAY_NAME</dt>
<dd><p class="first">Sets the name of the created overlay that will be written into
<em>OVERLAY_DIR/profiles/repo_name</em>. This file will be rewritten on every
<em>roverlay</em> run that includes the <em>create</em> command.</p>
<p class="last">Defaults to <em>R_Overlay</em>.</p>
</dd>
</dl>
<dl class="docutils" id="use-expand-name">
<dt>USE_EXPAND_NAME:</dt>
<dd>Alias to <a class="reference internal" href="#ebuild-use-expand-name">EBUILD_USE_EXPAND_NAME</a>.</dd>
</dl>
</div>
<div class="section" id="other-config-files">
<h2><a class="toc-backref" href="#contents">10.3 other config files</a></h2>
<p>Some config config options are split from the main config file for various
reasons:</p>
<ul class="simple">
<li>no need for modification in most cases, e.g. the <a class="reference internal" href="#id4">field definition</a> file</li>
<li>special syntax that is not compatible with the main config file,
e.g. the <a class="reference internal" href="#dependency-rule-file-syntax">dependency rule file syntax</a></li>
</ul>
<p>The paths to these files have to be listed in the main config file and
can be overridden with the appropriate command line options.</p>
<dl class="docutils" id="ebuild-use-expand-desc">
<dt>EBUILD_USE_EXPAND_DESC</dt>
<dd><p class="first">Path to a flag description file (for the <em>R_SUGGESTS</em> USE_EXPAND variable).
The syntax of this file is identical to USE_EXPAND description files
(<tt class="docutils literal"><overlay <span class="pre">root>/profiles/desc/r_suggests.desc</span></tt>).</p>
<p class="last">Defaults to <not set>, which disables this option.</p>
</dd>
</dl>
<dl class="docutils" id="ebuild-use-expand-rename">
<dt>EBUILD_USE_EXPAND_RENAME</dt>
<dd>Path to a file that lists alternative names for a flag in the <em>R_SUGGESTS</em>
USE_EXPAND variable.</dd>
</dl>
<dl class="docutils" id="field-definition">
<dt>FIELD_DEFINITION</dt>
<dd><p class="first">Path to the field definition file that controls how the <em>DESCRIPTION</em> file
of R packages is read.</p>
<p class="last">This option is <strong>required</strong>.</p>
</dd>
</dl>
<dl class="docutils" id="field-definition-file">
<dt>FIELD_DEFINITION_FILE</dt>
<dd>Alias to <a class="reference internal" href="#field-definition">FIELD_DEFINITION</a>.</dd>
</dl>
<dl class="docutils" id="id1">
<dt>PACKAGE_RULES</dt>
<dd>Alias to <a class="reference internal" href="#package-rule-files">PACKAGE_RULE_FILES</a>.</dd>
</dl>
<dl class="docutils" id="package-rule-files">
<dt>PACKAGE_RULE_FILES</dt>
<dd>A list of files and directories with package rules.
Directories will be recursively scanned for rule files.</dd>
</dl>
<dl class="docutils" id="id2">
<dt>REPO_CONFIG</dt>
<dd><p class="first">A list of one or more repo config files.</p>
<p class="last">This option is <strong>required</strong>.</p>
</dd>
</dl>
<dl class="docutils" id="repo-config-file">
<dt>REPO_CONFIG_FILE</dt>
<dd>Alias to <a class="reference internal" href="#id2">REPO_CONFIG</a>.</dd>
</dl>
<dl class="docutils" id="repo-config-files">
<dt>REPO_CONFIG_FILES</dt>
<dd>Alias to <a class="reference internal" href="#id2">REPO_CONFIG</a>.</dd>
</dl>
<dl class="docutils" id="simple-rules-file">
<dt>SIMPLE_RULES_FILE</dt>
<dd><p class="first">A list of files and directories with dependency rules.
Directories will be non-recursively scanned for rule files.</p>
<p class="last">This option is <strong>not required, but recommended</strong> since <em>roverlay</em> cannot do
much without dependency resolution.</p>
</dd>
</dl>
<dl class="docutils" id="simple-rules-files">
<dt>SIMPLE_RULES_FILES</dt>
<dd>Alias to <a class="reference internal" href="#simple-rules-file">SIMPLE_RULES_FILE</a>.</dd>
</dl>
<dl class="docutils" id="use-expand-desc">
<dt>USE_EXPAND_DESC</dt>
<dd>Alias to <a class="reference internal" href="#ebuild-use-expand-desc">EBUILD_USE_EXPAND_DESC</a>.</dd>
</dl>
<dl class="docutils" id="use-expand-rename">
<dt>USE_EXPAND_RENAME</dt>
<dd>Alias to <a class="reference internal" href="#ebuild-use-expand-rename">EBUILD_USE_EXPAND_RENAME</a>.</dd>
</dl>
</div>
<div class="section" id="shell-environment-hooks">
<h2><a class="toc-backref" href="#contents">10.4 shell environment / hooks</a></h2>
<dl class="docutils" id="event-hook">
<dt>EVENT_HOOK</dt>
<dd><p class="first">A script that is called for handling <em>events</em> (see <a class="reference internal" href="#event-hooks">Event Hooks</a>).</p>
<p class="last">Defaults to <libexec dir>/hooks/mux.sh if roverlay has been installed
and <a class="reference internal" href="#additions-dir">ADDITIONS_DIR</a>/hooks/mux.sh otherwise.</p>
</dd>
</dl>
<dl class="docutils" id="event-hook-rc">
<dt>EVENT_HOOK_RC</dt>
<dd><p class="first">Config file for hook scripts (in shell script syntax).</p>
<p class="last">Defaults to <not set>.</p>
</dd>
</dl>
<dl class="docutils" id="event-hook-restrict">
<dt>EVENT_HOOK_RESTRICT</dt>
<dd><p class="first">A list of <em>events</em> that are allowed (<tt class="docutils literal"><event></tt>, <tt class="docutils literal">+<event></tt>) or
forbidden (<tt class="docutils literal"><span class="pre">-<event></span></tt>). The asterisk wildcard character can be used to
set the default policy to <em>allow unless forbidden</em> (<tt class="docutils literal">*</tt>) or
<em>deny unless allowed</em> (<tt class="docutils literal"><span class="pre">-*</span></tt>).</p>
<p>Defaults to <not set>, which is equivalent to <em>deny all</em>.</p>
<p class="last"><tt class="docutils literal"><span class="pre">EVENT_HOOK_RESTRICT="overlay_success"</span></tt> would allow the <tt class="docutils literal">overlay_success</tt>
event only, whereas <tt class="docutils literal"><span class="pre">EVENT_HOOK_RESTRICT="*</span> <span class="pre">-overlay_success"</span></tt> would
allow any event except for <tt class="docutils literal">overlay_success</tt>. Also see <a class="reference internal" href="#event-policy">event policy</a>.</p>
</dd>
</dl>
<dl class="docutils" id="filter-shell-env">
<dt>FILTER_SHELL_ENV</dt>
<dd><p class="first">A <em>bool</em> that controls whether the hook environment should be filtered
or not.</p>
<p class="last">Defaults to <em>true</em>.</p>
</dd>
</dl>
<dl class="docutils" id="hook">
<dt>HOOK</dt>
<dd>Alias to <a class="reference internal" href="#event-hook">EVENT_HOOK</a>.</dd>
</dl>
<dl class="docutils" id="hook-rc">
<dt>HOOK_RC</dt>
<dd>Alias to <a class="reference internal" href="#event-hook-rc">EVENT_HOOK_RC</a>.</dd>
</dl>
<dl class="docutils" id="hook-restrict">
<dt>HOOK_RESTRICT</dt>
<dd>Alias to <a class="reference internal" href="#event-hook-restrict">EVENT_HOOK_RESTRICT</a>.</dd>
</dl>
</div>
<div class="section" id="logging">
<h2><a class="toc-backref" href="#contents">10.5 logging</a></h2>
<dl class="docutils" id="log-date-format">
<dt>LOG_DATE_FORMAT</dt>
<dd><p class="first">The date format (ISO8601) used in log messages.</p>
<p class="last">Defaults to <em>%F %H:%M:%S</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-enabled">
<dt>LOG_ENABLED</dt>
<dd><p class="first">Globally enable or disable logging. The value has to be a <em>bool</em>.
Setting this option to <em>True</em> allows logging to occur, while <em>False</em>
disables logging entirely.
Log target such as <em>console</em> or <em>file</em> have to be enabled
to actually get any log messages.</p>
<p class="last">Defaults to <em>True</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-level">
<dt>LOG_LEVEL</dt>
<dd><p class="first">Sets the default log level. Log targets will use this value unless they
have their own log level.</p>
<p class="last">Defaults to <not set> - all log targets will use their own defaults</p>
</dd>
</dl>
<div class="section" id="console-logging">
<h3><a class="toc-backref" href="#contents">10.5.1 console logging</a></h3>
<dl class="docutils" id="log-console">
<dt>LOG_CONSOLE</dt>
<dd><p class="first">Enables/Disables logging to console. The value has to be a <em>bool</em>.</p>
<p class="last">Defaults to <em>True</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-format-console">
<dt>LOG_FORMAT_CONSOLE</dt>
<dd><p class="first">Sets the format for console log messages.</p>
<p class="last">Defaults to <em>%(levelname)-8s %(name)-14s: %(message)s</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-level-console">
<dt>LOG_LEVEL_CONSOLE</dt>
<dd><p class="first">Sets the log level for console logging.</p>
<p class="last">Defaults to <em>INFO</em>.</p>
</dd>
</dl>
</div>
<div class="section" id="file-logging">
<h3><a class="toc-backref" href="#contents">10.5.2 file logging</a></h3>
<dl class="docutils" id="log-file">
<dt>LOG_FILE</dt>
<dd><p class="first">Sets the log file. File logging will be disabled if this option does not
exist or is commented out even if <a class="reference internal" href="#log-file-enabled">LOG_FILE_ENABLED</a> is set to <em>True</em>.</p>
<p class="last">Defaults to <not set>.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-buffered">
<dt>LOG_FILE_BUFFERED</dt>
<dd><p class="first">Enable/Disable buffering of log entries in memory before they are written
to the log file. Enabling this reduces I/O blocking, especially when using
low log levels. The value must be a <em>bool</em>.</p>
<p class="last">Defaults to enabled.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-buffer-count">
<dt>LOG_FILE_BUFFER_COUNT</dt>
<dd><p class="first">Sets the number of log entries to buffer at most. Can be decreased to
lower memory consumption when using log entry buffering.</p>
<p class="last">Defaults to <em>250</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-enabled">
<dt>LOG_FILE_ENABLED</dt>
<dd><p class="first">Enables/Disable file logging. The value has to be a bool.</p>
<p class="last">Defaults to enabled, in which case file logging is enabled if <a class="reference internal" href="#log-file">LOG_FILE</a>
is set, else disabled.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-format">
<dt>LOG_FILE_FORMAT</dt>
<dd><p class="first">Sets the format used for log messages written to a file.</p>
<p class="last">Defaults to <em>%(asctime)s %(levelname)-8s %(name)-10s: %(message)s</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-level">
<dt>LOG_FILE_LEVEL</dt>
<dd><p class="first">Sets the log level for file logging.</p>
<p class="last">Defaults to <em>WARNING</em>.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-rotate">
<dt>LOG_FILE_ROTATE</dt>
<dd><p class="first">A <em>bool</em> that enables/disables log file rotation. If enabled, the log file
will be rotated on every script run and max. <a class="reference internal" href="#log-file-rotate-count">LOG_FILE_ROTATE_COUNT</a> log
files will be kept.</p>
<p class="last">Defaults to disabled.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-rotate-count">
<dt>LOG_FILE_ROTATE_COUNT</dt>
<dd><p class="first">Sets the number of log files to keep at most.</p>
<p class="last">Defaults to <em>3</em> and has no effect if <a class="reference internal" href="#log-file-rotate">LOG_FILE_ROTATE</a> is disabled.</p>
</dd>
</dl>
</div>
</div>
<div class="section" id="license-map-options">
<h2><a class="toc-backref" href="#contents">10.6 license map options</a></h2>
<dl class="docutils" id="create-license-file">
<dt>CREATE_LICENSE_FILE</dt>
<dd>Alias to <a class="reference internal" href="#create-licenses-file">CREATE_LICENSES_FILE</a>.</dd>
</dl>
<dl class="docutils" id="create-licenses-file">
<dt>CREATE_LICENSES_FILE</dt>
<dd><p class="first">Create the <a class="reference internal" href="#cachedir">CACHEDIR</a>/license file after scanning <a class="reference internal" href="#portdir">PORTDIR</a>/licenses for
licenses. This file can serve as fallback if <a class="reference internal" href="#portdir">PORTDIR</a> is not available
or if <a class="reference internal" href="#use-portage-licenses">USE_PORTAGE_LICENSES</a> is set to <em>no</em>.</p>
<p class="last">Defaults to <em>yes</em>.</p>
</dd>
</dl>
<dl class="docutils" id="license-map">
<dt>LICENSE_MAP</dt>
<dd><p class="first">Path to the license map file, which is used to translate license strings
into valid licenses (accepted by portage). Its syntax is similar to
dependency rules.</p>
<p>This option is <strong>not required</strong>, but recommended if the
<a class="reference internal" href="#field-definition-config">field definition config</a> file contains a field with the <em>isLicense</em> flag.</p>
<p class="last">Defaults to <not set>.</p>
</dd>
</dl>
<dl class="docutils" id="use-portage-licenses">
<dt>USE_PORTAGE_LICENSES</dt>
<dd><p class="first">A <em>bool</em> that controls whether <a class="reference internal" href="#portdir">PORTDIR</a>/licenses should be scanned for
licenses. As fallback, or if this option is set to <em>no</em>, the
<a class="reference internal" href="#cachedir">CACHEDIR</a>/license file is read.</p>
<p class="last">Defaults to <em>yes</em>.</p>
</dd>
</dl>
</div>
<div class="section" id="options-for-debugging-manual-dependency-rule-creation-and-testing">
<h2><a class="toc-backref" href="#contents">10.7 options for debugging, manual dependency rule creation and testing</a></h2>
<dl class="docutils" id="description-dir">
<dt>DESCRIPTION_DIR</dt>
<dd><p class="first">A directory where all description data read from an R package will be
written into. This can be used to analyze/backtrack overlay creation
results.</p>
<p class="last">Defaults to <not set>, which disables writing of description data files.</p>
</dd>
</dl>
<dl class="docutils" id="log-file-unresolvable">
<dt>LOG_FILE_UNRESOLVABLE</dt>
<dd><p class="first">A file where all unresolved dependency strings will be written into
on <em>roverlay</em> exit. Primarily useful for creating new rules.
The file's format is <tt class="docutils literal"><dependency type mask in hex>, <dependency string></tt>,
where the <em>dependency type mask</em> is usually
<tt class="docutils literal">0x7</tt> (mandatory system dependency),
<tt class="docutils literal">0x8</tt> (optional R package dependency)
or <tt class="docutils literal">0xb</tt> (mandatory R package dependency).</p>
<p class="last">Defaults to <not set>, which disables this feature.</p>
</dd>
</dl>
</div>
</div>
<div class="section" id="id3">
<h1><a class="toc-backref" href="#contents">11 Other config files</a></h1>
<div class="section" id="use-expand-flag-rename-file">
<h2><a class="toc-backref" href="#contents">11.1 USE_EXPAND flag rename file</a></h2>
<p>The <a class="reference internal" href="#use-expand-rename">USE_EXPAND_RENAME</a> file contains dictionary-like entries that assign
<em>effective</em> flag names to flag names generated at runtime.</p>
<p>The syntax is as follows:</p>
<pre class="code text literal-block">
# comments start with '#'
<effective flag> <runtime flag> [<another runtime flag>...]
# a '=' can be used as separator to improve readability
<effective flag> = <runtime flag> [<another runtime flag>...]
# the previous line can be continued with leading whitespace
<effective flag> = <runtime flag>
[<another runtime flag>...]
</pre>
<p>Example:</p>
<pre class="code text literal-block">
# rename 'audio' and 'snd' to 'sound'
sound = audio snd
</pre>
<p>Each flag is renamed at most once, so the following example renames 'sound'
to media, but 'audio' to 'sound':</p>
<pre class="code text literal-block">
sound = audio snd
media = sound video
</pre>
<div class="caution">
<p class="first admonition-title">Caution!</p>
<p class="last">Assigning more than one <em>effective flag</em> to a <em>runtime flag</em> leads to
unpredictable results.</p>
</div>
</div>
<div class="section" id="license-map-file">
<h2><a class="toc-backref" href="#contents">11.2 License Map File</a></h2>
<p>The license map file is a file with dictionary-like entries that is used
to translate <em>license strings</em> (read from the package's DESCRIPTION) into
licenses accepted by portage, e.g. <tt class="docutils literal"><span class="pre">GPL-3</span></tt> or <tt class="docutils literal">|| ( <span class="pre">GPL-3+</span> BSD )</tt>.
Its syntax is similar to the dependency rule file syntax:</p>
<pre class="code text literal-block">
# this is a comment line
# 1,1 mapping
portage_license :: license_str
# 1,n mapping (n>=0)
portage_license {
license_str_0
license_str_1
...
license_str_n
}
# 0,1 mapping (ignore license_str)
! :: license_str
# 0,n mapping (ignore several license_str)
! {
license_str_0
license_str_1
...
license_str_n
}
</pre>
<p>Example (excerpt from <em>roverlay's</em> license map file):</p>
<pre class="code text literal-block">
# freestyle text
! {
foo
freeforresearchpurpose.
whatlicenseisitunder?
}
BSD :: freebsd
|| ( GPL-2+ BSD ) {
gpl>2|bsd
gpl>2|freebsd
}
</pre>
</div>
<div class="section" id="field-definition-config">
<span id="id4"></span><h2><a class="toc-backref" href="#contents">11.3 Field Definition Config</a></h2>
<p>The field definition file uses <a class="reference external" href="http://docs.python.org/library/configparser.html">ConfigParser</a> syntax and defines
how an R package's DESCRIPTION file is read.
See the next section, <a class="reference internal" href="#default-field-definition-file">default field definition file</a>, for an example.</p>
<p>Each information field has its own section which declares a set of options
and flags. Flags are case-insensitive options without a value - they are
enabled by listing them.</p>
<p id="field-options"><span id="field-option"></span>Available field options:</p>
<blockquote>
<dl class="docutils" id="field-option-default-value">
<dt>default_value</dt>
<dd>Sets the default value for a field, which implies that any read
DESCRIPTION file will contain this field, either with the value read
from the file or (as fallback) the default value.
Disables the <a class="reference internal" href="#mandatory-field-flag">'mandatory' field flag</a>.</dd>
</dl>
<dl class="docutils" id="field-option-allowed-value">
<dt>allowed_value</dt>
<dd>Declares that a field has a value whitelist and adds the value to that
list (preserves whitespace).</dd>
</dl>
<dl class="docutils" id="field-option-allowed-values">
<dt>allowed_values</dt>
<dd>Declares that a field has a value whitelist and adds the values to
that list (values are separated by whitespace).</dd>
</dl>
<dl class="docutils" id="field-option-alias">
<span id="field-option-alias-withcase"></span><dt>alias_withcase, alias</dt>
<dd>Declares case-sensitive field name aliases. This can be used to fix
'typos', e.g. <em>Suggest</em> and <em>Suggests</em> both mean <em>Suggests</em>.</dd>
</dl>
<dl class="docutils" id="field-option-alias-nocase">
<dt>alias_nocase</dt>
<dd>Same as <a class="reference internal" href="#field-option-alias">field option: alias</a>, but the listed aliases are
case-insensitive.</dd>
</dl>
<dl class="docutils" id="field-option-flags">
<dt>flags</dt>
<dd>List of <a class="reference internal" href="#field-flags">field flags</a>. Note that any option without a value is treated
as flag.</dd>
</dl>
</blockquote>
<p id="field-flag"><span id="field-flags"></span>Known field flags:</p>
<blockquote>
<dl class="docutils" id="field-flag-joinvalues">
<dt>joinValues</dt>
<dd>Declares that a field's value is one string even if it spans over
multiple lines. The lines will be joined with a single space
character ' '. The default behavior is to merge lines.
This flag can be used in conjunction with any "is list" flag.</dd>
</dl>
<dl class="docutils" id="field-flag-islist">
<dt>isList</dt>
<dd>Declares that a field's value is a list whose values are separated
by ',' and/or ';'.</dd>
</dl>
<dl class="docutils" id="field-flag-iswhitespacelist">
<dt>isWhitespaceList</dt>
<dd>Declares that a field's value is a list whose values are separated by
whitespace. Has no effect if <cite>field flag: isList</cite> is set.</dd>
</dl>
<dl class="docutils" id="field-flag-islicense">
<dt>isLicense</dt>
<dd>Declares that a field's value should be interpreted as license string.
This disables <em>allowed_value</em>/<em>allowed_values</em> and all other flags
except for <em>mandatory</em>/<em>optional</em>.</dd>
</dl>
<dl class="docutils" id="mandatory-field-flag">
<span id="field-flag-mandatory"></span><dt>mandatory</dt>
<dd>Declares that a field is required in <em>all</em> DESCRIPTION files.
This means that R packages without that field are considered as unusable,
i.e. ebuild creation fails early.
This flag is (effectively) useless in conjunction with
<a class="reference internal" href="#field-option-default-value">field option: default_value</a> unless the default value evaluates to
False (e.g. is an empty string).</dd>
</dl>
<dl class="docutils" id="field-flag-ignore">
<dt>ignore</dt>
<dd>Declares that a field is known but entirely ignored. Unknown fields
are ignored, too, the main difference is the emitted log message if
such a field is found.</dd>
</dl>
</blockquote>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">It is not checked whether a flag is known or not.</p>
</div>
<div class="section" id="example-the-default-field-definition-file">
<span id="default-field-definition-file"></span><h3><a class="toc-backref" href="#contents">11.3.1 Example: The default field definition file</a></h3>
<p>This is the default field definition file (without any ignored fields):</p>
<pre class="code ini literal-block">
<span class="keyword">[Description]</span>
<span class="error">joinValues</span>
<span class="keyword">[Title]</span>
<span class="error">joinValues</span>
<span class="keyword">[Suggests]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">Suggests, Suggest, %Suggests, Suggets, Recommends</span>
<span class="error">isList</span>
<span class="keyword">[Depends]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">Depends, Dependencies, Dependes, %Depends, Depents, Require, Requires</span>
<span class="error">isList</span>
<span class="keyword">[Imports]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">Imports, Import</span>
<span class="error">isList</span>
<span class="keyword">[LinkingTo]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">LinkingTo, LinkingdTo, LinkinTo</span>
<span class="error">isList</span>
<span class="keyword">[SystemRequirements]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">SystemRequirements, SystemRequirement</span>
<span class="error">isList</span>
<span class="keyword">[OS_Type]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">OS_TYPE</span>
<span class="name attribute">allowed_values</span> <span class="operator">=</span> <span class="literal string">unix</span>
<span class="keyword">[License]</span>
<span class="name attribute">alias_nocase</span> <span class="operator">=</span> <span class="literal string">License, Licence, Lisence</span>
<span class="error">isLicense</span>
</pre>
</div>
</div>
</div>
<div class="section" id="id5">
<span id="roverlay-console"></span><h1><a class="toc-backref" href="#contents">12 Roverlay Console</a></h1>
<p>roverlay provides an interactive console for accessing certain subsystems,
e.g. dependency resolution. Its features include tab completion for filesystem
paths and a command history that supports navigation with the arrow keys.
Line continuation with a backslash character <tt class="docutils literal">\</tt> is supported, too.</p>
<p>The console also implements a subset of typical tools like <tt class="docutils literal">cat</tt>, which
behave similar but not identical to their counterparts.</p>
<p>See the following sections for how to run specific consoles.</p>
<p>The following table lists all basic commands, which are available in all
roverlay consoles. Some commands have more detailed help messages, which are
printed when running <tt class="docutils literal"><cmd> <span class="pre">--help</span></tt>.</p>
<table border="1" class="docutils">
<caption>basic console commands (subsystem-independent)</caption>
<colgroup>
<col width="25%" />
<col width="12%" />
<col width="63%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">command</th>
<th class="head">extended
--help</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>exit, quit, q, qq</td>
<td>no</td>
<td>exit</td>
</tr>
<tr><td>help, ?</td>
<td>no</td>
<td>print help message (list known commands)</td>
</tr>
<tr><td>help <em>cmd</em></td>
<td>no</td>
<td>show command-specific help message</td>
</tr>
<tr><td>alias</td>
<td>no</td>
<td>show command aliases</td>
</tr>
<tr><td>unalias</td>
<td>no</td>
<td>unset command aliases (<em>not implemented</em>)</td>
</tr>
<tr><td>cat</td>
<td><strong>yes</strong></td>
<td>read files and print them (supports compressed
files)</td>
</tr>
<tr><td>cd</td>
<td>no</td>
<td><p class="first">change working directory</p>
<p class="last">Actually, this does not change the working
directory. It simply sets the prefix which is used
when dealing with relative filesystem paths.</p>
</td>
</tr>
<tr><td>chroot</td>
<td>no</td>
<td><p class="first">enter/leave/show command chroot</p>
<p class="last">A command chroot prefixes all input with a
specific command.</p>
</td>
</tr>
<tr><td>declare</td>
<td>no</td>
<td>show variables</td>
</tr>
<tr><td>echo</td>
<td>no</td>
<td>print text (supports python string formatting)</td>
</tr>
<tr><td>exec</td>
<td>no</td>
<td>switch to another subsystem (<em>not implemented</em>)</td>
</tr>
<tr><td>history</td>
<td>no</td>
<td>show command history</td>
</tr>
<tr><td>ls</td>
<td>no</td>
<td>print directory content</td>
</tr>
<tr><td>pwd</td>
<td>no</td>
<td>print current working directory</td>
</tr>
<tr><td>set</td>
<td>no</td>
<td>set variables</td>
</tr>
<tr><td>unset</td>
<td>no</td>
<td>unset variables</td>
</tr>
</tbody>
</table>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">Running the console with <tt class="docutils literal">python <span class="pre">-OO</span></tt> removes most of the help messages.</p>
</div>
<div class="section" id="dependency-resolution-console">
<span id="depres-console"></span><h2><a class="toc-backref" href="#contents">12.1 Dependency Resolution Console</a></h2>
<p>As previously stated, the <em>DepRes Console</em> is only meant for <strong>testing</strong>.
It is an interactive console with the following features:</p>
<ul class="simple">
<li>resolve dependencies</li>
<li>create new dependency rules</li>
<li>load rules from files</li>
<li>save rules to a file</li>
</ul>
<p>Rules are managed in a set. These so-called <em>rule pools</em> are organized in
a <em>last-in-first-out</em> data structure that allows to create or remove
them easily at runtime.</p>
<p>Running <tt class="docutils literal">roverlay depres_console</tt> prints a short welcome message and starts
the console.</p>
<p>For reference, these commands are available (in addition to the basic ones):</p>
<table border="1" class="docutils">
<caption>depres commands</caption>
<colgroup>
<col width="25%" />
<col width="12%" />
<col width="63%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">command</th>
<th class="head">extended
--help</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>add_pool, <<</td>
<td>no</td>
<td>creates a new, empty <em>rule pool</em></td>
</tr>
<tr><td>add_rule, +</td>
<td>no</td>
<td>creates a new rule and adds it to the topmost,
i.e. latest <em>rule pool</em>. This command uses
<a class="reference internal" href="#rule-file-syntax">Rule File Syntax</a>. Multi line rules are
supported.</td>
</tr>
<tr><td>load, l</td>
<td>yes</td>
<td>load rule files</td>
</tr>
<tr><td>load_conf, lc</td>
<td>no</td>
<td>load configured rule files</td>
</tr>
<tr><td>print_pool, print,
p</td>
<td>yes</td>
<td>print one or more <em>rule pools</em></td>
</tr>
<tr><td>resolve, ??</td>
<td>no</td>
<td>tries to resolve the given dependency string and
prints the result</td>
</tr>
<tr><td>unwind_pool, >></td>
<td>yes</td>
<td>removes the topmost <em>rule pool</em> and all of its
rules</td>
</tr>
<tr><td>write, w</td>
<td>yes</td>
<td>writes rules to a file</td>
</tr>
<tr><td>!</td>
<td>no</td>
<td>enter the <em>resolve command chroot</em>, which prefixes
all input with <em>resolve</em></td>
</tr>
<tr><td>!!</td>
<td>no</td>
<td>leave any <em>command chroot</em></td>
</tr>
</tbody>
</table>
<dl class="docutils">
<dt>Example Session:</dt>
<dd><pre class="code first last literal-block">
[roverlay depres_console]
== dependency resolution console (r2) ==
Run 'help' to list all known commands.
More specifically, 'help <cmd>' prints a help message for
the given command, and 'help --list' lists all help topics.
Use 'load_conf' or 'lc' to load the configured rule files.
cmd % help
Documented commands (type help <topic>):
========================================
EOF cat echo history print qq unalias
add_pool cd exec load print_pool quit unset
add_rule chroot exit load_conf pwd resolve unwind_pool
alias declare help ls q set write
cmd % <tab><tab>
EOF chroot history pwd unalias
add_pool declare load q unset
add_rule echo load_conf qq unwind_pool
alias exec ls quit write
cat exit print resolve
cd help print_pool set
cmd % + ~dev-lang/R :: R language
cmd % print --help
usage: print_pool [-h] [--all] [<id> [<id> ...]]
positional arguments:
<id> print specific pools (by id)
optional arguments:
-h, --help show this help message and exit
--all, -a print all pools
cmd % print -a
~dev-lang/R :: R language
cmd % !
(resolve) % R language
'R language' has been resolved as dev-lang/R.
(resolve) % R language [ 2.15 ]
'R language [ 2.15 ]' has been resolved as >=dev-lang/R-2.15.
(resolve) % R
'R' could not be resolved.
(resolve) % !!
cmd % p
~dev-lang/R :: R language
cmd % >>
pool has been removed.
cmd % >>
resolver has no pools.
cmd % p
cmd % ?? R language
'R language' could not be resolved.
cmd % set PS1=#!
#! exit
</pre>
</dd>
</dl>
</div>
</div>
<div class="section" id="roverlay-interface">
<h1><a class="toc-backref" href="#contents">13 Roverlay Interface</a></h1>
<p>Roverlay provides an API for accessing its functionality independently of
R overlay creation.</p>
<p>Note, however, that a minimal config file may still be required for accessing
<em>roverlay interfaces</em>.</p>
<p>The table below lists all interfaces and where to find them:</p>
<table border="1" class="docutils">
<caption>roverlay interfaces</caption>
<colgroup>
<col width="23%" />
<col width="37%" />
<col width="40%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">name</th>
<th class="head">module</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>RootInterface</td>
<td>roverlay.interface.root</td>
<td>meta interface for managing
other interfaces</td>
</tr>
<tr><td>MainInterface</td>
<td>roverlay.interface.main</td>
<td>RootInterface with delayed
initialization</td>
</tr>
<tr><td>DepresInterface</td>
<td>roverlay.interface.depres</td>
<td>dependency resolution</td>
</tr>
<tr><td>RemoteInterface</td>
<td>roverlay.interface.remote</td>
<td>remote interaction (sync)</td>
</tr>
</tbody>
</table>
<p>For extending the API, roverlay provides the abstract <em>RoverlayInterface</em> and
<em>RoverlaySubInterface</em> classes.</p>
<p>The following code snippet gives an idea on how to include roverlay's API in
your code:</p>
<pre class="code python literal-block">
<span class="comment">#!/usr/bin/python</span>
<span class="comment">#</span>
<span class="comment"># Initializes logging and roverlay's interfaces</span>
<span class="comment">#</span>
<span class="keyword namespace">import</span> <span class="name namespace">logging</span>
<span class="keyword namespace">import</span> <span class="name namespace">roverlay.core</span>
<span class="keyword namespace">import</span> <span class="name namespace">roverlay.interface.main</span>
<span class="keyword">def</span> <span class="name function">main</span><span class="punctuation">():</span>
<span class="comment"># log everything to console</span>
<span class="name">roverlay</span><span class="operator">.</span><span class="name">core</span><span class="operator">.</span><span class="name">force_console_logging</span> <span class="punctuation">(</span> <span class="name">log_level</span><span class="operator">=</span><span class="name">logging</span><span class="operator">.</span><span class="name">INFO</span> <span class="punctuation">)</span>
<span class="comment"># load roverlay's config</span>
<span class="name">config</span> <span class="operator">=</span> <span class="name">roverlay</span><span class="operator">.</span><span class="name">core</span><span class="operator">.</span><span class="name">load_locate_config_file</span> <span class="punctuation">(</span>
<span class="name">ROVERLAY_INSTALLED</span><span class="operator">=</span><span class="name builtin pseudo">False</span><span class="punctuation">,</span> <span class="name">setup_logger</span><span class="operator">=</span><span class="name builtin pseudo">False</span>
<span class="punctuation">)</span>
<span class="comment"># create the main interface</span>
<span class="name">main_interface</span> <span class="operator">=</span> <span class="name">roverlay</span><span class="operator">.</span><span class="name">interface</span><span class="operator">.</span><span class="name">main</span><span class="operator">.</span><span class="name">MainInterface</span> <span class="punctuation">(</span> <span class="name">config</span><span class="operator">=</span><span class="name">config</span> <span class="punctuation">)</span>
<span class="comment"># create subinterfaces, as needed</span>
<span class="name">depres_interface</span> <span class="operator">=</span> <span class="name">main_interface</span><span class="operator">.</span><span class="name">spawn_interface</span> <span class="punctuation">(</span> <span class="literal string">"depres"</span> <span class="punctuation">)</span>
<span class="name">remote_interface</span> <span class="operator">=</span> <span class="name">main_interface</span><span class="operator">.</span><span class="name">spawn_interface</span> <span class="punctuation">(</span> <span class="literal string">"remote"</span> <span class="punctuation">)</span>
<span class="comment"># use them</span>
<span class="keyword">pass</span>
<span class="comment"># --- end of main (...) ---</span>
<span class="keyword">if</span> <span class="name">__name__</span> <span class="operator">==</span> <span class="literal string">'__main__'</span><span class="punctuation">:</span>
<span class="name">main</span><span class="punctuation">()</span>
</pre>
<div class="section" id="depres-interface">
<h2><a class="toc-backref" href="#contents">13.1 DepRes Interface</a></h2>
<p>The <em>DepResInterface</em> offers the following functionality:</p>
<ul class="simple">
<li>rule creation<ul>
<li>load rules from text input, files and/or configured files (<a class="reference internal" href="#simple-rules-file">SIMPLE_RULES_FILE</a>)</li>
<li><em>compile</em> rules after loading them</li>
</ul>
</li>
<li>manage dependency rule pools (container for rules)<ul>
<li>rule pools are kept in a stack-like data structure, which makes it easy
to "forget" the most recent rules (<em>discard_pool()</em> et al.)</li>
<li><em>visualize</em> pools: convert rules into text (inverse of rule creation)</li>
</ul>
</li>
<li>easy access to the resolver via <em>resolve()</em>, <em>can_resolve()</em>
and <em>cannot_resolve()</em></li>
<li>"low-level" access to dependency resolution, e.g. <em>EbuildJobChannels</em>, is
also possible</li>
</ul>
<p>Refer to in-code documentation on how to use this interface.
See the dependency resolution test suite (<tt class="docutils literal">tests.depres</tt>, not part of the
roverlay installation) and the dependency resolution console
for usage examples.</p>
</div>
<div class="section" id="remote-interface">
<h2><a class="toc-backref" href="#contents">13.2 Remote Interface</a></h2>
<p>The <em>RemoteInterface</em> is experimental/incomplete and currently offers the
following functionality:</p>
<ul class="simple">
<li>set sync mode to online/offline</li>
<li>sync/nosync</li>
<li>load repo config</li>
<li>list repos</li>
<li>list repo packages</li>
</ul>
<p>Refer to in-code documentation for details.</p>
</div>
</div>
<div class="section" id="implementation-overview">
<h1><a class="toc-backref" href="#contents">14 Implementation Overview</a></h1>
<p>This chapter gives an in-depth overview of how roverlay works.
Code documentation is also available and html pages for it can be created
with <tt class="docutils literal">make pydoc</tt> in the <em>R Overlay src directory</em> or by using pydoc
directly.</p>
<div class="section" id="packageinfo">
<h2><a class="toc-backref" href="#contents">14.1 PackageInfo</a></h2>
<p><em>PackageInfo</em> is the data object that contains all information about an
R package and is created by the owning repository.</p>
<p>After initialization it contains data like</p>
<ul class="simple">
<li>the path to the R package file</li>
<li>the origin (repository)</li>
<li>the SRC_URI</li>
<li>the package name, version</li>
</ul>
<p>Not all of these are really existent, some are calculated. <em>SRC_URI</em>,
for example, can often be calculated by combining the origin's "root" src uri
with the package file.</p>
<p>Initialization may fail if the package's name cannot be understood, which is
most likely due to unsupported versioning schemes.</p>
<p>It is then checked whether the newly created <em>PackageInfo p</em> can be part of
the overlay. The overlay may refuse to accept <em>p</em> if an ebuild already exists
for it. Otherwise, <em>p</em> is now part of the overlay and has to pass
<em>ebuild creation</em>.</p>
</div>
<div class="section" id="repository-management">
<h2><a class="toc-backref" href="#contents">14.2 Repository Management</a></h2>
<p>Repositories are managed in a list-like object, <em>RepoList</em>. Its task is to
provide R package input for overlay creation and implements the following
functionality:</p>
<ul class="simple">
<li>load repository config from file(s)</li>
<li>directly add a directory as <em>local repository</em></li>
<li><em>sync</em> all repos and <em>nosync</em> all repos (offline mode)</li>
<li>create <em>PackageInfo</em> instances for R packages from all repositories</li>
</ul>
<div class="section" id="repository">
<h3><a class="toc-backref" href="#contents">14.2.1 Repository</a></h3>
<p>The functionality described above is an abstraction layer that calls the
respective function for each repository and collects the result.
So, while the <em>RepoList</em> object knows <em>what</em> to do for all repositories,
a repository object <em>repo</em> extends this by:</p>
<ul>
<li><p class="first">data</p>
<blockquote>
<ul>
<li><p class="first">repository <em>type</em></p>
</li>
<li><p class="first">filesystem directory <em>distdir</em> where <em>repo</em>'s R packages are stored</p>
</li>
<li><p class="first">the <em>root src_uri</em>, which is used to determine the <em>SRC_URI</em> ebuild
variable for all packages from <em>repo</em>:</p>
<p><em>SRC_URI</em> = <em>root src_uri</em> + '/' + <path of R package relative to <em>distdir</em>></p>
</li>
<li><p class="first">other data like the sync status, repository name</p>
</li>
</ul>
</blockquote>
</li>
<li><p class="first">functionality</p>
<blockquote>
<ul class="simple">
<li>sync/nosync</li>
<li>create <em>PackageInfo</em> instances for all packages from <em>repo</em></li>
<li>status indicators, e.g. if sync was successful</li>
</ul>
</blockquote>
</li>
</ul>
<p>The actual functionality depends on the <em>repository type</em>, i.e. the
implementing class. The most basic implementation that provides all common
data, status indicator functions and <em>PackageInfo</em> creation is called
<em>BasicRepo</em>. It also implements a rather abstract sync function that calls
subclass-specifc <em>_sync()</em>/<em>_nosync()</em> functions if available.
<em>BasicRepos</em> are used to realize <em>local repositories</em>. The other available
repository types, <em>rsync</em>, <em>websync_repo</em> and <em>websync_pkglist</em> derive from
<em>BasicRepo</em>.</p>
<div class="section" id="adding-new-repository-types">
<h4><a class="toc-backref" href="#contents">14.2.1.1 Adding new repository types</a></h4>
<p>Adding new repository types is best done by creating a new repo class
that inherits <em>BasicRepo</em>. The table below shows <em>BasicRepo</em>'s subclass
awareness concerning <em>sync()</em> and what may be changed if required.
Most repository types want to define their own sync functionality and
can do so by implementing <em>_dosync()</em>:</p>
<table border="1" class="docutils">
<caption>deriving repository types from BasicRepo</caption>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">function/method</th>
<th class="head">description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>_dosync()</td>
<td>sync packages using a remote, has to return True/False</td>
</tr>
<tr><td>_nosync()</td>
<td>sync packages in offline mode (returns True/False)</td>
</tr>
<tr><td>sync (<em>online?</em>)</td>
<td>implemented by <em>BasicRepo</em>, calls _dosync()/_nosync()
if available, else checks whether <em>distdir</em> exists</td>
</tr>
<tr><td>scan_distdir(...)</td>
<td><em>BasicRepo</em>: creates <em>PackageInfo</em> instances for all
R packages in <em>distdir</em>. Derived classes can override
this e.g. if they want to expose only synced packages</td>
</tr>
<tr><td>ready()</td>
<td>tells whether _dosync()/_nosync() was successful,
used by <em>RepoList</em> to decide whether to call
scan_distdir() or not. Properly implemented by
<em>BasicRepo</em> when using its sync() method, else needs
to be overridden.</td>
</tr>
<tr><td>__init__()</td>
<td>has to be implemented if the new class has additional
data. Refer to in-code documentation and examples.</td>
</tr>
</tbody>
</table>
<p>The <em>RsyncRepo</em>, for example, extends <em>BasicRepo</em> by rsync-specific data, e.g.
the uri used for rsync, and has its own <em>__init__()</em> method. It also
implements <em>_dosync()</em>, which calls the <em>rsync</em> executable in a filtered
environment that contains only variables like USER, PATH and RSYNC_PROXY.
The other available repository types have an internal-only implementation:</p>
<table border="1" class="docutils">
<colgroup>
<col width="24%" />
<col width="28%" />
<col width="48%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">repository type</th>
<th class="head">repository class</th>
<th class="head">_dosync() implementation</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>local</td>
<td>BasicRepo</td>
<td><em>not applicable</em></td>
</tr>
<tr><td>rsync</td>
<td>RsyncRepo</td>
<td><strong>external</strong>, using <em>rsync</em> in
a filtered environment</td>
</tr>
<tr><td>websync_repo
websync_pkglist</td>
<td>WebsyncRepo
WebsyncPackageList</td>
<td>internal, using <em>urllib</em></td>
</tr>
</tbody>
</table>
<p>Repository types also need an entry in the repository config loader in order
to be accessible.</p>
</div>
</div>
</div>
<div class="section" id="overlay">
<h2><a class="toc-backref" href="#contents">14.3 Overlay</a></h2>
<p>The <em>overlay</em> is roverlay's central data structure that represents a <em>portage
overlay</em>. It is organized in a tree structure (overlay root, categories,
package directories) and implements all overlay-related functionality:</p>
<ul>
<li><p class="first">Scan the <em>portage overlay</em> for existing ebuilds</p>
</li>
<li><p class="first">Add <em>PackageInfo</em> objects to the overlay. Packages can be declined if
they already exist as ebuild (incremental overlay).
Adding multiple packages at once is <strong>thread-safe</strong>, but overlay writing
is not.</p>
</li>
<li><p class="first">List all known packages (filesystem and runtime/memory)</p>
</li>
<li><p class="first">Write the overlay to its filesystem location</p>
<blockquote>
<ul class="simple">
<li>initialize the overlay (write the <em>profiles/</em> directory and
<em>metadata</em>/layout.conf, import eclass files)</li>
<li>Write ebuilds; all <em>PackageInfo</em> instances with an ebuild will be written</li>
<li>Generate and write metadata</li>
<li>Write Manifest files</li>
</ul>
</blockquote>
</li>
<li><p class="first">Features like <a class="reference internal" href="#overlay-keep-nth-latest">OVERLAY_KEEP_NTH_LATEST</a> make use of ebuild deletion,
but unconditional ebuild deletion is only available on the package directory
level</p>
</li>
</ul>
<div class="section" id="metadata-creation">
<h3><a class="toc-backref" href="#contents">14.3.1 Metadata Creation</a></h3>
<p><em>metadata.xml</em> files are created with a tree structure that contains <em>metadata
nodes</em>, e.g. '<pkgmetadata>...</pkgmetadata>' and '<use>...</use>' are <em>nodes</em>.
The current implementation writes the R package's full description
('Title' and 'Description') into the metadata file.
Metadata creation uses the latest package, i.e. highest version,
for which an ebuild has been created.</p>
</div>
<div class="section" id="manifest-creation">
<h3><a class="toc-backref" href="#contents">14.3.2 Manifest Creation</a></h3>
<p>Two implementations for writing manifest files are available, <em>ebuild</em> and
<em>next</em>.</p>
<p>The <em>ebuild</em> implementation calls the <tt class="docutils literal">ebuild</tt> executable for each package
directory in a filtered environment where where FETCHCOMMAND and
RESUMECOMMAND are set to no-operation (/bin/true on systems that support it).</p>
<p><em>next</em> is an internal implementation that uses the
<tt class="docutils literal">roverlay.overlay.pkgdir.manifest</tt> module for creating Manifest files.
It falls back to <em>ebuild</em> when creating Manifest entries for imported ebuilds,
since roverlay does not support reading <em>SRC_URI</em> from ebuilds reliably (that
would require variable interpolation, e.g. for <tt class="docutils literal">${PN}</tt>).</p>
</div>
</div>
<div class="section" id="ebuild-creation">
<h2><a class="toc-backref" href="#contents">14.4 Ebuild Creation</a></h2>
<p>Ebuild creation is the process centered around one <em>PackageInfo</em> instance <em>p</em>
that tries to create an ebuild for it.</p>
<p>An <em>EbuildCreationJob</em> does the following steps:</p>
<ol class="arabic simple">
<li>Read the DESCRIPTION file of <em>p</em>'s R package tarball and store the
data in an associative array ('DESCRIPTION field' -> 'data')</li>
<li>Call <a class="reference internal" href="#dependency-resolution">dependency resolution</a></li>
<li>If dependency resolution was successful and any <a class="reference internal" href="#selfdeps">selfdeps</a> found
(dependencies on other packages): <em>pause</em> ebuild creation for <em>p</em> until
it has been verified whether these dependencies are satisfiable.
This is necessary because dependency resolution does not know whether a
resolved dependency is actually valid. To realize this, <em>roverlay</em> collects
paused ebuild creation jobs after processing all packages, performs
<em>selfdep validation</em> and then continues ebuild creation.</li>
<li>If dependency resolution was successful, dependency ebuild variables are
created (<em>DEPEND</em>, <em>RDEPEND</em> and <em>R_SUGGESTS</em>, also <em>IUSE</em>, <em>MISSINGDEPS</em>).
Otherwise <strong>ebuild creation stops</strong> and <em>p</em> is marked as
<em>ebuild uncreatable</em>. The overlay creation may decide to remove <em>p</em> in
order to save memory etc.</li>
<li>The <em>DESCRIPTION</em> and <em>SRC_URI</em> variables are created</li>
<li>Add any ebuild variables created by package rules, e.g. <em>KEYWORDS</em></li>
<li><strong>done</strong> - Generate the ebuild as text, add it to <em>p</em> and mark <em>p</em>
as <em>ebuild successfully created</em></li>
</ol>
<div class="section" id="ebuild-variables">
<h3><a class="toc-backref" href="#contents">14.4.1 Ebuild Variables</a></h3>
<p>Each ebuild variable is an object whose class is derived from the <em>EbuildVar</em>
class. An <em>EbuildVar</em> defines its position in the ebuild and how its text
output should look like. Ebuild text is created by adding ebuild variables
to an <em>Ebuilder</em> that automatically sorts them and creates the ebuild.</p>
<p>Most ebuild variables, e.g. all variables that contain text from a package's
DESCRIPTION data, have basic protection against code injection:</p>
<ul class="simple">
<li>only ASCII characters are allowed</li>
<li>the following chars are always removed: <tt class="docutils literal">"</tt>, <tt class="docutils literal">'</tt>, <tt class="docutils literal">`</tt> and <tt class="docutils literal">;</tt></li>
<li>backslash chars <tt class="docutils literal">\</tt> at the end of the variable's value are removed</li>
<li>any char sequence starting with <tt class="docutils literal">$(</tt> is completely dropped</li>
</ul>
</div>
</div>
<div class="section" id="overlay-creation">
<h2><a class="toc-backref" href="#contents">14.5 Overlay Creation</a></h2>
<p>Overlay creation is the process of creating an overlay for many R packages
and <em>roverlay</em>'s main task. More specifically, <em>OverlayCreation</em> is an
<em>R packages -> Overlay (-> overlay in filesystem)</em> interface.
It accepts <em>PackageInfo</em> objects as input, applies package rules to them,
which possibly filters some packages out, tries to reserve a slot in the
overlay for them, and, if successful, adds them to the work queue.</p>
<p>The work queue is processed by <em>OverlayWorkers</em> that run ebuild creation
for a <em>PackageInfo</em> object and inform the <em>OverlayCreation</em> about the result
afterwards. Overlay creation keeps going if an ebuild cannot be created,
instead the event is logged. Running more than one <em>OverlayWorker</em> in parallel
is possible.</p>
<p>The following pseudo-code illustrates how overlay creation basically works:</p>
<pre class="code text literal-block">
ACCEPT_PACKAGES:
for each received PackageInfo <p>
create an EbuildCreationJob for p and add it to the work queue
end for
CREATE_OVERLAY:
while work_queue is not empty
work_queue_next <= empty
in parallel with N OverlayWorkers (>=0 threads):
for each EbuildCreationJob ebuild_job from the work_queue
run/resume ebuild_job (as described in Ebuild Creation)
if ebuild_job is paused
add ebuild_job to work_queue_next
end if
end for
end in parallel
if work_queue_next is not empty
<run selfdep validation>
work_queue <= work_queue_next
end if
end while
</pre>
<div class="section" id="selfdep-validation">
<h3><a class="toc-backref" href="#contents">14.5.1 Selfdep Validation</a></h3>
<p>EbuildCreationJobs are processed in no specific order and possibly
concurrently. This leads to the problem that dependency resolution cannot
know whether a successfully resolved <a class="reference internal" href="#selfdep">selfdep</a> is actually satisfiable.</p>
<p>For example, if a package <em>A</em> depends on another package <em>B</em> and <em>B</em> is
uncreatable (ebuild creation <em>will</em> fail for <em>B</em>), then dependency resolution
still resolves <em>B</em> (e.g. as sci-R/B). <em>A</em> has a <strong>dangling selfdep</strong> now.</p>
<p><em>Selfdep validation</em> is the process of <strong>identifying</strong> <em>dangling selfdeps</em> and
<strong>removing</strong> packages with such dependencies or simply <strong>dropping</strong>
the dependencies, depending on their <a class="reference internal" href="#dependency-type">dependency type</a>.</p>
<p>It is an algorithm with 3 phases:</p>
<ol class="arabic simple">
<li><strong>prepare</strong>: create a graph containing all selfdeps<ul>
<li><strong>collect</strong>: find ebuild creation jobs with selfdeps (<em>direct</em> selfdeps)</li>
<li><strong>link</strong>: expand the selfdep graph, find selfdep-selfdep dependencies
(<em>indirect</em> selfdeps)</li>
</ul>
</li>
<li><strong>reduce</strong>: find <em>dangling selfdeps</em> and mark them as invalid<ul>
<li>a selfdep is <em>dangling</em> iff the overlay contains no suitable
<em>PackageInfo</em> with valid selfdeps</li>
<li><strong>repeat this step</strong> until no more <em>dangling selfdeps</em> found</li>
</ul>
</li>
<li><strong>balance</strong>: find ebuild creation jobs with invalid selfdeps (<em>inversed collect</em>)<ul>
<li>drop optional dependencies</li>
<li>let ebuild creation fail if a mandatory selfdep is not valid</li>
</ul>
</li>
</ol>
<p>The actual implementation in <em>roverlay</em> is spread across several modules:</p>
<table border="1" class="docutils">
<caption>modules/packages involved in selfdep validation</caption>
<colgroup>
<col width="42%" />
<col width="58%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">module/package</th>
<th class="head">phase(s) / description</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>roverlay.overlay.creator</td>
<td><strong>all</strong> (controls selfdep validation),
especially <em>collect</em> and
<em>reduction loop</em></td>
</tr>
<tr><td>roverlay.ebuild.creation
roverlay.ebuild.depres</td>
<td><strong>prepare</strong> (<em>collect</em>),
<strong>balance</strong> (<em>drop dependencies</em>,
<em>ebuild creation failure</em>)</td>
</tr>
<tr><td>roverlay.overlay.root
roverlay.overlay.category
roverlay.overlay.pkgdir</td>
<td><strong>prepare</strong> (<em>link</em>),
<strong>balance</strong> (<em>remove packages</em>)</td>
</tr>
<tr><td>roverlay.depres.depresult</td>
<td><strong>all</strong> (selfdep data object)</td>
</tr>
<tr><td>roverlay.packageinfo</td>
<td><strong>all</strong> (package data object),</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="dependency-resolution">
<h2><a class="toc-backref" href="#contents">14.6 Dependency Resolution</a></h2>
<p>Each ebuild creation process has access to the <em>dependency resolver</em> that
accepts <em>dependency strings</em>, tries to resolve them and returns the result,
either "unresolvable" or the resolving <em>dependency</em> as
<em>Dynamic DEPEND</em>/<em>DEPEND Atom</em>.</p>
<p>The ebuild creation uses <em>channels</em> for communication with the <em>dependency
resolver</em>, so-called <em>EbuildJobChannels</em> that handle the 'high-level'
string-to-string dependency resolution for a set of <em>dependency strings</em>.
Typically, one <em>channel</em> is used per ebuild variable (DEPEND, RDEPEND and
R_SUGGESTS).</p>
<p>From the ebuild creation perspective, dependency resolution works like this:</p>
<ol class="arabic simple">
<li>Collect the <em>dependency strings</em> from the DESCRIPTION data and add them
to the communication <em>channels</em> (up to 3 will be used)</li>
<li>Wait until all channels are <em>done</em></li>
<li><strong>Stop ebuild creation</strong> if a channel reports that it could not resolve
all <em>required dependencies</em>. No ebuild can be created in that case.</li>
<li><strong>Successfully done</strong> - transfer the channel results to ebuild variables</li>
</ol>
<p>Details about dependency resolution like how <em>channels</em> work can be found
in the following subsections.</p>
<div class="section" id="dependency-types">
<span id="dependency-type"></span><h3><a class="toc-backref" href="#contents">14.6.1 Dependency types</a></h3>
<p>Every <em>dependency string</em> has a <em>dependency type</em> that declares how a
dependency should be resolved. It has one or more of these properties:</p>
<dl class="docutils">
<dt>Mandatory</dt>
<dd>Ebuild creation fails if the <em>dependency string</em> in question cannot
be resolved.</dd>
<dt>Optional</dt>
<dd>The opposite of <em>Mandatory</em>, ebuild creation keeps going even if the
<em>dependency string</em> is unresolvable.</dd>
<dt>Package Dependency</dt>
<dd>This declares that the <em>dependency string</em> could be another R package.</dd>
<dt>System Dependency</dt>
<dd>This declares that the <em>dependency string</em> could be a system dependency,
e.g. a scientific library or a video encoder.</dd>
<dt>Selfdep</dt>
<dd>This declares that the resolved dependency has to pass
<em>selfdep validation</em>. While <em>selfdep</em> usually implies <em>package</em>, these
types are not the same. The <em>package</em> type is applied to <em>dependency strings</em>
based on their origin (DESCRIPTION field), whereas <em>selfdep</em> is a property
of the resolving rule.</dd>
<dt>Try other dependency types</dt>
<dd>This declares that the <em>dependency string</em> can be resolved by ignoring its
dependency type partially. This property allows to resolve package
dependencies as system dependencies and vice versa. Throughout this
document, such property is indicated by <em>TRY_OTHER</em> and
<em><preferred dependency type> first</em>, e.g. <em>package first</em>.</dd>
</dl>
<p><em>Mandatory</em> and <em>Optional</em> are mutually exclusive.</p>
<p>The <em>dependency type</em> of a <em>dependency string</em> is determined by its origin,
i.e. info field in the package's DESCRIPTION file.
The <em>Suggests</em> field, for example, gets the
<em>"package dependency only and optional"</em> type, whereas the <em>SystemRequirements</em>
gets <em>"system dependency, but try others, and mandatory"</em>.</p>
<div class="section" id="description-file-dependency-fields">
<h4><a class="toc-backref" href="#contents">14.6.1.1 DESCRIPTION file dependency fields</a></h4>
<p>The DESCRIPTION file of an R package contains several fields that list
dependencies on R packages or other software like scientific libraries.
This section describes which <em>dependency fields</em> are used and how.</p>
<table border="1" class="docutils">
<caption>R package dependency fields</caption>
<colgroup>
<col width="28%" />
<col width="31%" />
<col width="25%" />
<col width="15%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">dependency field</th>
<th class="head">ebuild variable</th>
<th class="head">dependency type</th>
<th class="head">required</th>
</tr>
</thead>
<tbody valign="top">
<tr><td>Depends</td>
<td rowspan="2">DEPEND</td>
<td rowspan="2">package first</td>
<td rowspan="4"><em>yes</em></td>
</tr>
<tr><td>Imports</td>
</tr>
<tr><td>LinkingTo</td>
<td rowspan="2">RDEPEND</td>
<td>package first</td>
</tr>
<tr><td>SystemRequirements</td>
<td>system first</td>
</tr>
<tr><td rowspan="2">Suggests</td>
<td>R_SUGGESTS</td>
<td>package <strong>only</strong></td>
<td><strong>no</strong></td>
</tr>
<tr><td>_UNRESOLVED_PACKAGES</td>
<td><em>unresolvable</em></td>
<td><em>n/a</em></td>
</tr>
</tbody>
</table>
<p>A non-empty <em>R_SUGGESTS</em> ebuild variable will enable the <em>R_suggests</em> USE
flag. <em>R_SUGGESTS</em> is a runtime dependency (a <em>Dynamic DEPEND</em> in <em>RDEPEND</em>).</p>
<p>Ebuild creation keeps going if an optional dependency cannot be resolved.
This is not desirable for most <em>dependency fields</em>, but extremely
useful for R package suggestions that often link to other repositories or
private homepages.
Such unresolvable dependencies go into the <em>_UNRESOLVED_PACKAGES</em> ebuild
variable.
Whether and how this variable is used is up to the eclass file(s).
The default <em>R-packages eclass</em> reports unresolvable,
but optional dependencies during the <em>pkg_postinst()</em> ebuild phase.</p>
</div>
</div>
<div class="section" id="dependency-environments">
<h3><a class="toc-backref" href="#contents">14.6.2 Dependency Environments</a></h3>
<p>A <em>dependency environment</em> is an object that reflects the whole dependency
resolution process of a single <em>dependency string</em>. It usually contains
the <em>dependency string</em>, its <em>dependency type</em>, information about its
resolution state (<em>resolved</em>, <em>unresolvable</em>, <em>to be processed</em>) and the
resolving resolving <em>dependency</em>, if any.</p>
<p>It is initialized by the communication <em>channel</em> and processed by the
<em>dependency resolver</em>.</p>
</div>
<div class="section" id="ebuildjob-channel">
<h3><a class="toc-backref" href="#contents">14.6.3 EbuildJob Channel</a></h3>
<p>The <em>EbuildJob Channel</em> is used by the ebuild creation to communicate with
the <em>dependency resolver</em>. It is initialized by an ebuild creation process and
realizes a greedy <em>string to string</em> dependency resolution.</p>
<p>Its mode of operation is</p>
<ol class="arabic">
<li><p class="first">Accept <em>dependency strings</em>, create <em>dependency environments</em> for them
and add them to the registered <em>dependency resolver</em>.
The <em>dependency resolver</em> may already be resolving the added dependencies.</p>
<p>Leave this state if the ebuild creation signalizes that all <em>dependency
strings</em> have been added.</p>
</li>
<li><p class="first">Tell the <em>dependency resolver</em> that this channel is waiting for results.</p>
<p>The channel using a <em>blocking queue</em> for waiting. It expects that the
<em>dependency resolver</em> sends processed <em>dependency environments</em> though this
channel, whether successful or not.</p>
</li>
<li><p class="first">Process each received <em>dependency environment</em> until all dependencies have
been resolved or waiting does not make sense anymore, i.e. at least one
<em>required</em> dependency could not be resolved.</p>
<ul class="simple">
<li>add successful resolved dependencies to the "resolved" list</li>
<li>add unresolved, but optional dependencies to the "unresolvable" list</li>
<li>any other unresolved dependency is interpreted as "channel cannot satisfy
the request", the <strong>channel stops waiting</strong> for remaining results.</li>
</ul>
</li>
<li><p class="first">The <em>channel</em> returns the result to the ebuild creation:</p>
<ul class="simple">
<li>a 2-tuple of resolved and unresolvable dependencies or</li>
<li>"nothing" if the request is not satisfiable, i.e. one or more required
dependencies are unresolvable.</li>
</ul>
</li>
</ol>
</div>
<div class="section" id="dependency-rule-pools">
<h3><a class="toc-backref" href="#contents">14.6.4 Dependency Rule Pools</a></h3>
<p>The <em>dependency resolver</em> does not know <em>how</em> to resolve a <em>dependency string</em>.
Instead, it searches through a list of <em>dependency rule pools</em> that may be
able to do this.</p>
<p>A <em>dependency rule pool</em> combines a list of <em>dependency rules</em> with a
<em>dependency type</em> and is able to determine whether it accepts the type
of a <em>dependency string</em> or not.</p>
<p><em>Dependency rules</em> are objects with a "matches" function that returns the
<em>resolving dependency</em> if it matches the given <em>dependency string</em>, else
it returns "cannot resolve". Note the difference between
"a rule cannot resolve a dep string" and "dep string is unresolvable",
which means that no rule can resolve a particular <em>dependency string</em>.</p>
<p>See <a class="reference internal" href="#dependency-rules">Dependency Rules</a> for the concrete rules available.</p>
<p>Rule pools are normally created by reading rule files, but some rule pools
consist of rules that exist in memory only.
These are called <strong>Dynamic Rule Pools</strong> and use runtime data like "all known
R packages" to create rules.</p>
<p id="dynamic-selfdep-rule-pool"><em>roverlay</em> uses one dynamic rule pool, the <strong>Dynamic Selfdep Rule Pool</strong>.
This pool contains <em>selfdep</em> rules for all known R packages and is able
to resolve R package dependencies. Moreover, it knows to which repository
a rule belongs, and tries to satisfy dependencies on a package within its
own repository first, before trying the other repositories in the order as
they appear in the repo config file(s).</p>
<p>By convention, this rule pool never resolves any system dependencies.</p>
</div>
<div class="section" id="dependency-resolver-modules">
<h3><a class="toc-backref" href="#contents">14.6.5 Dependency Resolver Modules</a></h3>
<p>The dependency resolver can be extended by modules. Two base types are
available, <em>channels</em> and <em>listeners</em>.</p>
<dl class="docutils">
<dt>Listener modules</dt>
<dd><p class="first">Listener modules are used to react on certain dependency resolution
<em>events</em>, e.g. if a <em>dependency environment</em> is unresolvable.
They usually have access to the <em>event</em> and the <em>dependency environment</em>.
However, they cannot begin communication with the <em>dependency resolver</em>.</p>
<p class="last">In the current <em>roverlay</em> implementation, a listener module is used to
report all unresolvable dependencies to a separate file.</p>
</dd>
<dt>Channel modules</dt>
<dd><p class="first">Channel modules interact with the resolver, e.g. queue dependencies for
resolution, wait for results, and send them to the other end.</p>
<p class="last">The previously described <a class="reference internal" href="#ebuildjob-channel">EbuildJob Channel</a> is such a channel.</p>
</dd>
</dl>
</div>
<div class="section" id="dependency-resolver">
<h3><a class="toc-backref" href="#contents">14.6.6 Dependency Resolver</a></h3>
<p>The dependency resolver puts all parts of dependency resolution together,
<em>rule pools</em>, <em>listeners</em> and <em>channels</em>. Its main task is a loop that
processes all queued <em>dependency environments</em> and sends the result back to
their origin (an <em>EbuildJob channel</em>).</p>
<p>Besides that, it also offers functionality to register new channels, add
listeners, load rule pools from one or more files etc..
A dependency resolver has to be explicitly closed in which case it will stop
working and notify all listeners about that.</p>
<p>Its mode of operation of operation is best described in pseudo-code:</p>
<pre class="code text literal-block">
while <dependencies queued for resolution>
depenv <= get the next dependency environment
resolved <= False
# try to resolve depenv
if <depenv's type contains PACKAGE> and
<the dynamic selfdep rule pool resolves depenv>
resolved <= True
else
if <a rule pool accepts depenv's type and resolves depenv>
resolved <= True
else if <depenv's type contains TRY_OTHER>
if <a rule pool supports TRY_OTHER and does not accept depenv's type and resolves depenv>
resolved <= True
end if
end if
end if
# send the result to depenv's channel
if resolved
mark depenv as resolved, add the resolving dependency to it
else
mark depenv as unresolvable
end if
send depenv to its channel
end while
</pre>
<p>The dependency resolver can be <strong>run as thread</strong>, in which case the while loop
becomes "loop until resolver closes".</p>
</div>
</div>
</div>
</div>
<div class="footer">
<hr class="footer" />
Generated on: 2014-05-07.
</div>
</body>
</html>
|