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
|
// file : doc/manual.cli
// license : MIT; see accompanying LICENSE file
"\name=build2-build-bot-manual"
"\subject=build bot"
"\title=Build Bot"
// NOTES
//
// - Maximum <pre> line is 70 characters.
//
"
\h0#preface|Preface|
This document describes \c{bbot}, the \c{build2} build bot. For the build bot
command line interface refer to the \l{bbot-agent(1)} and \l{bbot-worker(1)}
man pages.
\h1#intro|Introduction|
\h1#arch|Architecture|
The \c{bbot} architecture includes several layers for security and
manageability. At the top we have a \c{bbot} running in the \i{controller}
mode. The controller monitors various \i{build sources} for \i{build
tasks}. For example, a controller may poll a \c{brep} instances for any new
packages to built as well as monitor a \cb{git} repository for any new commits
to test. There can be several layers of controllers with \c{brep} being just a
special kind. A machine running a \c{bbot} instance in the controller mode is
called a \i{controller host}.
Below the controllers we have a \c{bbot} running in the \i{agent} mode
normally on Build OS. The agent polls its controllers for \i{build tasks} to
perform. A machine running a \c{bbot} instance in the agent mode is called a
\i{build host}.
The actual building is performed in the virtual machines and/or containers
that are executed on the build host. Inside virtual machines/containers,
\c{bbot} is running in the \i{worker mode} and receives build tasks from its
agent. Virtual machines and containers running a \c{bbot} instance in the
worker mode are collectively called \i{build machines}.
Let's now examine the workflow in the other direction, that is, from a worker
to a controller. Once a build machine is booted (by the agent), the worker
inside connects to the TFTP server running on the build host and downloads the
\i{build task manifest}. It then proceeds to perform the build task and
uploads the \i{build result manifest} (which includes build logs) to the TFTP
server.
Once an agent receives a build task for a specific build machine, it goes
through the following steps. First, it creates a directory on its TFTP server
with the \i{machine name} as its name and places the build task manifest
inside. Next, it makes a throw-away snapshot of the build machine and boots
it. After booting the build machine, the agent monitors the machine directory
on its TFTP server for the build result manifest (uploaded by the worker once
the build has completed). Once the result manifest is obtained, the agent
shuts down the build machine and discards its snapshot.
To obtains a build task the agent polls via HTTP/HTTPS one or more
controllers. Before each poll request the agent enumerates the available build
machines and sends this information as part of the request. The controller
responds with a build task manifest that identifies a specific build machine
to use.
In the task request the agent specifies if only non-interactive, interactive,
or both build kinds are supported. If interactive builds are supported, it
additionally provides the login information for interactive build sessions. If
the controller responds with an interactive build task, then its manifest
specifies the breakpoint the worker must stop the task execution at and prompt
the user whether to continue or abort the execution. The user can log into the
build machine, potentially perform some troubleshooting, and, when done,
either answer the prompt or just shutdown the machine.
If the controller has higher-level controllers (for example, \c{brep}), then
it aggregates the available build machines from its agents and polls these
controllers (just as an agent would), forwarding build tasks to suitable
agents. In this case we say that the \i{controller act as an agent}. The
controller may also be configured to monitor build sources, such as SCM
repositories, directly in which case it generates build tasks itself.
In this architecture the build results are propagated up the chain: from a
worker, to its agent, to its controller, and so on. A controller that is the
final destination of a build result uses email to notify interested parties of
the outcome. For example, \c{brep} would send a notification to the package
owner if the build failed. Similarly, a \c{bbot} controller that monitors a
\cb{git} repository would send an email to a committer if their commit caused a
build failure. The email would include a link (normally HTTP/HTTPS) to the
build logs hosted by the controller.
\h#arch-machine-config|Configurations|
The \c{bbot} architecture distinguishes between a \i{machine configuration},
\i{build target configuration}, and a \i{build package configuration}. The
machine configuration captures the operating system, installed compiler
toolchain, and so on. The same build machine may be used to \"generate\"
multiple \i{build target configurations}. For example, the same machine can
normally be used to produce 32/64-bit and debug/optimized builds.
The machine configuration is \i{approximately} encoded in its \i{machine
name}. The machine name is a list of components separated with \c{-}.
Components cannot be empty and must contain only alpha-numeric characters,
underscores, dots, and pluses with the whole id being a portably-valid path
component.
The encoding is approximate in a sense that it captures only what's important
to distinguish in a particular \c{bbot} deployment.
The first component normally identifies the operating system and has the
following recommended form:
\
[<arch>_][<class>_]<os>[_<version>]
\
For example:
\
windows
windows_10
windows_10.1607
i686_windows_xp
bsd_freebsd_10
linux_centos_6.2
linux_ubuntu_16.04
macos_10.12
\
The second component normally identifies the installed compiler toolchain and
has the following recommended form:
\
<id>[<version>][<vendor>][<runtime>]
\
For example:
\
gcc
gcc_6
gcc_6.3
gcc_6.3_mingw_w64
clang_3.9_libc++
clang_3.9_libstdc++
msvc_14
msvc_14u3
icc
\
Some examples of complete machine names:
\
windows_10-msvc_14u3
macos_10.12-clang_10.0
linux_ubuntu_16.04-gcc_6.3
aarch64_linux_debian_11-gcc_12.2
\
Similarly, the build target configuration is encoded in a \i{configuration
name} using the same overall format. As described in \l{#arch-controller
Controller Logic}, target configurations are generated from machine
configurations. As a result, it usually makes sense to have the first
component identify the operating systems and the second component \- the
toolchain with the rest identifying a particular target configuration variant,
for example, optimized, sanitized, etc. For example:
\
windows-vc_14-O2
linux-gcc_6-O3_asan
\
While we can also specify the \c{<arch>} component in a build target
configuration, this information is best conveyed as part of \c{<target>} as
described in \l{#arch-controller Controller Logic}.
A package can be built in multiple package configurations per target
configuration. A build package configuration normally specifies the options
and/or the package configuration variables that need to be used for the
build. It may also include the information regarding the dependency packages
which need to additionally be configured. The build package configurations
originate from the package manifest \c{*-build-config}, \c{*-builds},
\c{*-build-include}, and \c{*-build-exclude} values. See
\l{bpkg#manifest-package Package Manifest} for more information on these
values.
\h#arch-machine-header|Machine Header Manifest|
@@ TODO: need ref to general manifest overview in bpkg, or, better yet,
move it to libbutl and ref to that from both places.
The build machine header manifest contains basic information about a build
machine on the build host. A list of machine header manifests is sent by
\c{bbot} agents to controllers. The manifest synopsis is presented next
followed by the detailed description of each value in subsequent sections.
\
id: <machine-id>
name: <machine-name>
summary: <string>
\
For example:
\
id: windows_10-msvc_14-1.3
name: windows_10-msvc_14
summary: Windows 10 build 1607 with VC 14 update 3
\
\h2#arch-machine-header-id|\c{id}|
\
id: <machine-id>
\
The unique machine version/revision/build identifier. For virtual machines
this can be the disk image checksum. For a container this can be UUID that is
re-generated every time a container filesystem is altered.
Note that we assume that a different machine identifier is assigned on any
change that may affect the build result.
\h2#arch-machine-header-name|\c{name}|
\
name: <machine-name>
\
The machine name.
\h2#arch-machine-header-summary|\c{summary}|
\
summary: <string>
\
The one-line description of the machine.
\h#arch-machine|Machine Manifest|
The build machine manifest contains the complete description of a build
machine on the build host (see the Build OS documentation for their origin and
location). The machine manifest starts with the machine manifest header with
all the header values appearing before any non-header values. The non-header
part of manifest synopsis is presented next followed by the detailed
description of each value in subsequent sections.
\
type: kvm|nspawn
[mac]: <addr>
[options]: <machine-options>
[changes]: <text>
\
\h2#arch-machine-type|\c{type}|
\
type: kvm|nspawn
\
The machine type. Valid values are \c{kvm} (QEMU/KVM virtual machine) and
\c{nspawn} (\c{systemd-nspawn} container).
\h2#arch-machine-mac|\c{mac}|
\
[mac]: <addr>
\
The fixed MAC address for the machine. Must be in the hexadecimal,
comma-separated format. For example:
\
mac: de:ad:be:ef:de:ad
\
If it is not specified, then a random address is generated on the first
machine bootstrap which is then reused for each build/re-bootstrap. Note that
if you specify a fixed address, then the machine can only be used by a single
\c{bbot} agent.
\h2#arch-machine-options|\c{options}|
\
[options]: <machine-options>
\
The list of machine options. The exact semantics is machine type-dependent
(see below). A single level of quotes (either single or double) is removed in
each option before being passed on. Options can be separated with spaces or
newlines.
For \c{kvm} machines, if this value is present, then it replaces the default
network and disk configuration when starting the QEMU/KVM hypervisor. The
options are pre-processed by replacing the question mark in \c{ifname=?} and
\c{mac=?} strings with the network interface and MAC address, respectively.
\h2#arch-machine-changes|\c{changes}|
\
[changes]: <text>
\
The description of machine changes in this version.
Multiple \c{changes} values can be present which are all concatenated in the
order specified, that is, the first value is considered to be the most recent.
For example:
\
changes: 1.1: initial version
changes: 1.2: increased disk size to 30GB
\
Or:
\
changes:
\\
1.1
- initial version
1.2
- increased disk size to 30GB
- upgraded bootstrap baseutils
\\
\
\h#arch-task|Task Manifest|
The task manifest describes a build task. It consists of two groups of values.
The first group defines the package to build. The second group defines the
build configuration to use for building the package. The manifest synopsis is
presented next followed by the detailed description of each value in
subsequent sections.
\
name: <package-name>
version: <package-version>
#location: <package-url>
repository-url: <repository-url>
[repository-type]: pkg|git|dir
[trust]: <repository-fp>
[requires]: <package-requirements>
[tests]: <dependency-package>
[examples]: <dependency-package>
[benchmarks]: <dependency-package>
[dependency-checksum]: <checksum>
machine: <machine-name>
target: <target-triplet>
[environment]: <environment-name>
[target-config]: <tgt-config-args>
[package-config]: <pkg-config-args>
[host]: true|false
[warning-regex]: <warning-regex>
[interactive]: <breakpoint>
[worker-checksum]: <checksum>
\
\h2#arch-task-name|\c{name}|
\
name: <package-name>
\
The package name to build.
\h2#arch-task-version|\c{version}|
\
version: <package-version>
\
The package version to build.
\h2#arch-task-repository-url|\c{repository-url}|
\
repository-url: <repository-url>
\
The URL of the repository that contains the package and its dependencies.
\h2#arch-task-repository-type|\c{repository-type}|
\
[repository-type]: pkg|git|dir
\
The repository type (see \c{repository-url} for details). Alternatively, the
repository type can be specified as part of the URL scheme. See
\l{bpkg-repository-types(1)} for details.
\h2#arch-task-trust|\c{trust}|
\
[trust]: <repository-fp>
\
The SHA256 repository certificate fingerprint to trust (see the \c{bpkg}
\c{--trust} option for details). This value may be specified multiple times to
establish the authenticity of multiple certificates. If the special \c{yes}
value is specified, then all repositories will be trusted without
authentication (see the \c{bpkg} \c{--trust-yes} option).
Note that while the controller may return a task with \c{trust} values,
whether they will be used is up to the agent's configuration. For example,
some agents may only trust their internally-specified fingerprints to prevent
the \"man in the middle\" attacks.
\h2#arch-task-requires-tests-examples-benchmarks|\c{requires, tests, examples, benchmarks}|
The primary package manifest values that need to be known by the \c{bbot}
worker before it retrieves the primary package manifest. See
\l{bpkg#manifest-package Package Manifest} for more information on these
values.
The controller copies these values from the primary package manifest, except
those \c{tests}, \c{examples}, and \c{benchmarks} values which should be
excluded from building due to their \c{builds}, \c{build-include}, and
\c{build-exclude} manifest values.
\h2#arch-task-dependency-checksum|\c{dependency-checksum}|
\
[dependency-checksum]: <checksum>
\
The package dependency checksum received as a part of the previous build task
result (see \l{#arch-result Result Manifest}).
\h2#arch-task-machine|\c{machine}|
\
machine: <machine-name>
\
The name of the build machine to use.
\h2#arch-task-target|\c{target}|
\
target: <target-triplet>
\
The target to build for.
Compared to the autotools terminology, the \c{machine} value corresponds to
\c{--build} (the machine we are building on) and \c{target} \- to \c{--host}
(the machine we are building for). While we use essentially the same \i{target
triplet} format as autotools for \c{target}, it is not flexible enough for
\c{machine}.
\h2#arch-task-environment|\c{environment}|
\
[environment]: <environment-name>
\
The name of the build environment to use. See \l{#arch-worker Worker Logic}
for details.
\h2#arch-task-target-config|\c{target-config}|
\
[target-config]: <tgt-config-args>
\
The additional target configuration options and variables. A single level of
quotes (either single or double) is removed in each value before being passed
to \c{bpkg}. For example, the following value:
\
target-config: config.cc.coptions=\"-O3 -stdlib='libc++'\"
\
Will be passed to \c{bpkg} as the following (single) argument:
\
config.cc.coptions=-O3 -stdlib='libc++'
\
Values can be separated with spaces or newlines. See \l{#arch-controller
Controller Logic} for details.
\h2#arch-task-package-config|\c{package-config}|
\
[package-config]: <pkg-config-args>
\
The primary package manifest \c{*-build-config} value for the build
configuration the build task is issued for. See \l{bpkg#manifest-package
Package Manifest} for more information on this value. A single level of quotes
(either single or double) is removed in each value before being passed to
\c{bpkg}. For example, the following value:
\
package-config: \"?libcurl ~7.76.0\"
\
Will be passed to \c{bpkg} as the following (single) argument:
\
?libcurl ~7.76.0
\
Values can be separated with spaces or newlines. See \l{#arch-controller
Controller Logic} for details.
\h2#arch-task-host|\c{host}|
\
[host]: true|false
\
If \c{true}, then the build target configuration is self-hosted. If not
specified, \c{false} is assumed. See \l{#arch-controller Controller Logic} for
details.
\h2#arch-task-warning-regex|\c{warning-regex}|
\
[warning-regex]: <warning-regex>
\
Additional regular expressions that should be used to detect warnings in the
build logs. Note that only the first 512 bytes of each log line is considered.
A single level of quotes (either single or double) is removed in each
expression before being used for search. For example, the following value:
\
warning-regex: \"warning C4\d{3}: \"
\
Will be treated as the following (single) regular expression (with a trailing
space):
\
warning C4\d{3}:
\
Expressions can be separated with spaces or newlines. They will be added to
the following default list of regular expressions that detect the \c{build2}
toolchain warnings:
\
^warning:
^.+: warning:
\
Note that this built-in list also covers GCC and Clang warnings (for the
English locale).
\h2#arch-task-interactive|\c{interactive}|
\
[interactive]: <breakpoint>
\
The task execution step to stop at. Can only be present if the agent has
specified \c{interactive-mode} with either the \c{true} or \c{both} value in
the task request.
The breakpoint can either be a primary step id of the worker script or the
special \c{error} or \c{warning} value. There is also the special \c{none}
value which never interrupts the task execution. See \l{#arch-worker Worker
Logic} for details.
\h2#arch-task-worker-checksum|\c{worker-checksum}|
\
[worker-checksum]: <checksum>
\
The worker checksum received as a part of the previous build task result (see
\l{#arch-result Result Manifest}).
\h#arch-result|Result Manifest|
The result manifest describes a build result. The manifest synopsis is
presented next followed by the detailed description of each value in
subsequent sections.
\
name: <package-name>
version: <package-version>
status: <status>
[configure-status]: <status>
[update-status]: <status>
[test-status]: <status>
[install-status]: <status>
[test-installed-status]: <status>
[uninstall-status]: <status>
[configure-log]: <text>
[update-log]: <text>
[test-log]: <text>
[install-log]: <text>
[test-installed-log]: <text>
[uninstall-log]: <text>
[worker-checksum]: <checksum>
[dependency-checksum]: <checksum>
\
\h2#arch-result-name|\c{name}|
\
name: <package-name>
\
The package name from the task manifest.
\h2#arch-result-version|\c{version}|
\
version: <package-version>
\
The package version from the task manifest.
\h2#arch-result-status|\c{status}|
\
status: <status>
\
The overall (cumulative) build result status. Valid values are:
\
skip # Package update and subsequent operations were skipped.
success # All operations completed successfully.
warning # One or more operations completed with warnings.
error # One or more operations completed with errors.
abort # One or more operations were aborted.
abnormal # One or more operations terminated abnormally.
\
The \c{abort} status indicates that the operation has been aborted by
\c{bbot}, for example, because it was consuming too many resources and/or was
taking too long. Note that a task can be aborted both by the \c{bbot} worker
as well as the agent. In the later case the whole machine is shut down and no
operation-specific status or logs will be included (@@ Maybe we should just
include 'log:' with commands that start VM, for completeness?).
The \c{abnormal} status indicates that the operation has terminated
abnormally, for example, due to the package manager or build system crash.
Note that the overall \c{status} value should appear before any per-operation
\c{*-status} values.
The \c{skip} status indicates that the received from the controller build task
checksums have not changed and the task execution has therefore been skipped
under the assumtion that it would have produced the same result. See
\c{agent-checksum}, \c{worker-checksum}, and \c{dependency-checksum} for
details.
\h2#arch-result-x-status|\c{*-status}|
\
[*-status]: <status>
\
The per-operation result status. Note that the \c{*-status} values should
appear in the same order as the corresponding operations were performed
and for each \c{*-status} there should be the corresponding \c{*-log}
value. Currently supported operation names:
\
configure
update
test
install
test-installed
uninstall
\
\h2#arch-result-x-log|\c{*-log}|
\
[*-log]: <text>
\
The per-operation result log. Note that the \c{*-log} values should appear
last and in the same order as the corresponding \c{*-status} values. For
the list of supported operation names refer to the \c{*-status} value
description.
\h2#arch-result-dependency-checksum|\c{dependency-checksum}|
\
[dependency-checksum]: <checksum>
\
The package dependency checksum obtained as a byproduct of the package
configuration operation. See \l{bpkg-pkg-build(1)} command's
\c{--rebuild-checksum} option for details.
\h2#arch-result-worker-checksum|\c{worker-checksum}|
\
[worker-checksum]: <checksum>
\
The version of the worker logic used to perform the package build task.
\h#arch-task-req|Task Request Manifest|
An agent (or controller acting as an agent) sends a task request to its
controller via HTTP/HTTPS POST method (@@ URL/API endpoint). The task request
starts with the task request manifest followed by a list of machine manifests.
The task request manifest synopsis is presented next followed by the detailed
description of each value in subsequent sections.
\
agent: <name>
toolchain-name: <name>
toolchain-version: <standard-version>
[interactive-mode]: false|true|both
[interactive-login]: <login>
[fingerprint]: <agent-fingerprint>
\
\h2#arch-task-req-agent|\c{agent}|
\
agent: <name>
\
The name of the agent host (\c{hostname}). The name should be unique in a
particular \c{bbot} deployment.
\h2#arch-task-req-toolchain-name|\c{toolchain-name}|
\
toolchain-name: <name>
\
The \c{build2} toolchain name being used by the agent.
\h2#arch-task-req-toolchain-version|\c{toolchain-version}|
\
toolchain-version: <standard-version>
\
The \c{build2} toolchain version being used by the agent.
\h2#arch-task-req-interactive-mode|\c{interactive-mode}|
\
[interactive-mode]: false|true|both
\
The agent's capability to perform build tasks only non-interactively
(\c{false}), only interactively (\c{true}), or both (\c{both}).
If it is not specified, then the \c{false} value is assumed.
\h2#arch-task-req-interactive-login|\c{interactive-login}|
\
[interactive-login]: <login>
\
The login information for the interactive build session. Must be present only
if \c{interactive-mode} is specified with the \c{true} or \c{both} value.
\h2#arch-task-req-fingerprint|\c{fingerprint}|
\
[fingerprint]: <agent-fingerprint>
\
The SHA256 fingerprint of the agent's public key. An agent may be configured
not to use the public key-based authentication in which case it does not
include this value. However, the controller may be configured to require the
authentication in which case it should respond with the 401 (unauthorized)
HTTP status code.
\h#arch-task-res|Task Response Manifest|
A controller sends the task response manifest in response to the task request
initiated by an agent. The response is delivered as a result of the POST
method. The task response starts with the task response manifest optionally
followed by the task manifest. The task response manifest synopsis is
presented next followed by the detailed description of each value in
subsequent sections.
\
session: <id>
[challenge]: <text>
[result-url]: <url>
[agent-checksum]: <checksum>
\
\h2#arch-task-res-session|\c{session}|
\
session: <id>
\
The identifier assigned to this session by the controller. An empty value
indicates that the controller has no tasks at this time in which case all the
following values as well as the task manifest are absent.
\h2#arch-task-res-challenge|\c{challenge}|
\
[challenge]: <text>
\
The random, 64 characters long string (nonce) used to challenge the agent's
private key. If present, then the agent must sign this string and include the
signature in the result request (see below).
The signature should be calculated by encrypting the string with the agent's
private key and then \c{base64}-encoding the result.
\h2#arch-task-res-result-url|\c{result-url}|
\
[result-url]: <url>
\
The URL to POST (upload) the result request to.
\h2#arch-task-res-agent-checksum|\c{agent-checksum}|
\
[agent-checksum]: <checksum>
\
The agent checksum received as a part of the previous build task result
request (see \l{#arch-result-req Result Request Manifest}).
\h#arch-result-req|Result Request Manifest|
On completion of a task an agent (or controller acting as an agent) sends the
result (upload) request to the controller via the POST method using the URL
returned in the task response (see above). The result request starts with the
result request manifest followed by the result manifest. Note that there is no
result response and only a successful but empty POST result is returned. The
result request manifest synopsis is presented next followed by the detailed
description of each value in subsequent sections.
\
session: <id>
[challenge]: <text>
[agent-checksum]: <checksum>
\
\h2#arch-result-req-session|\c{session}|
\
session: <session-id>
\
The session id as returned by the controller in the task response.
\h2#arch-result-req-challenge|\c{challenge}|
\
[challenge]: <text>
\
The answer to the private key challenge as posed by the controller in the task
response. It must be present only if the \c{challenge} value was present in
the task response.
\h2#arch-result-req-agent-checksum|\c{agent-checksum}|
\
[agent-checksum]: <checksum>
\
The version of the agent logic used to perform the package build task.
\h#arch-worker|Worker Logic|
The \c{bbot} worker builds each package in a \i{build environment} that is
established for a particular build target. The environment has three
components: the execution environment (environment variables, etc), build
system modules, as well as configuration options and variables.
Setting up of the environment is performed by an executable (script, batch
file, etc). Specifically, upon receiving a build task, if it specifies the
environment name then the worker looks for the environment setup executable
with this name in a specific directory and for the executable called
\c{default} otherwise. Not being able to locate the environment executable is
an error.
Once the environment setup executable is determined, the worker re-executes
itself as that executable passing to it as command line arguments the target
name, the path to the \c{bbot} worker to be executed once the environment is
setup, and any additional options that need to be propagated to the re-executed
worker. The environment setup executable is executed in the build directory as
its current working directory. The build directory contains the build task
\c{task.manifest} file.
The environment setup executable sets up the necessary execution environment
for example by adjusting \c{PATH} or running a suitable \c{vcvars} batch file.
It then re-executes itself as the \c{bbot} worker passing to it as command
line arguments (in addition to worker options) the list of build system
modules (\c{<env-modules>}) and the list of configuration options and variables
(\c{<env-config-args>}). The environment setup executable must execute the
\c{bbot} worker in the build directory as the current working directory.
The re-executed \c{bbot} worker then proceeds to test the package from the
repository by executing the following commands, collectively called a
\i{worker script}. Each command has a unique \i{step id} that can be used as a
breakpoint and normally as a prefix in the \c{<tgt-config-args>},
\c{<env-config-args>}, and \c{<env-modules>} values as discussed in
\l{#arch-controller Controller Logic} as well as in the \c{<pkg-config-args>}
values (see below). The \c{<>}-values are from the task manifest and the
environment though some are assigned by the worker during the script execution
(configuration directories, UUIDs, etc). In particular, the
\c{<pkg-config-args>} (prefixed global options and variables),
\c{<pkg-config-opts>} (unprefixed options), \c{<pkg-config-vars>} (unprefixed
variables), \c{<dependency-name>}, \c{<dependency-version-constraint>}, and
\c{<dep-config-vars>} values result from parsing the
\l{#arch-task-package-config \c{package-config}} task manifest value.
Some prefix step ids have fallback step ids which are used in the absence of
the primary step id values. If the prefix step id differs from the breakpoint
step id and/or has the fallback step ids, then they are listed in parenthesis:
the prefix id before the colon and the fallback ids after it.
Some commands have no target configuration or environment options or
variables. Such commands have only breakpoint step ids associated, which are
listed in square brackets.
Note that the worker script varies for different primary package types. The
\c{bbot} worker classifies the primary package based on the configuration type
in which it is built: \c{module} (build system module packages), \c{host}
(packages such as source code generators, marked with the \c{requires: host}
manifest value; see \l{bpkg#manifest-package Package Manifest} for details),
and \c{target} (all other packages).
Note also that the \c{*.configure.build} step configures potentially multiple
packages (primary package, tests, etc) in potentially multiple configurations
by always using the \c{bpkg.global.configure.build} prefix step id for global
(as opposed to package-specific) \l{bpkg-pkg-build(1)} options. The
\c{bpkg.global.configure.build} prefix id has no fallback ids.
Note finally that if no configuration variables are specified in the main
package configuration, then the worker adds the
\c{config.<name>.develop=false} configuration variable for the main package at
the \c{bpkg.configure.build} step to trigger its package skeleton creation and
loading. It also adds this variable for external test packages at this step
and for the same purpose. This makes sure that these packages can be used as
dependencies of dependents with configuration clauses. To keep the below
listings concise, these variables are not shown.
Worker script for \c{target} packages:
\
# bpkg.create (bpkg.target.create : b.create, bpkg.create)
#
bpkg -V create <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# bpkg.configure.add
#
bpkg -v add <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch --trust <repository-fp>
# bpkg.configure.build (
# bpkg.global.configure.build,
# (bpkg.target.configure.build : b.configure, bpkg.configure.build))
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-opts>] \\
[{ <pkg-config-vars> }+] <package-name>/<package-version> \\
[<test-package-name>[ <test-version-constraint>]...] \\
[([{ <dep-config-vars> }+] \\
(?|sys:)<dependency-name> \\
[<dependency-version-constraint>])...] \\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# bpkg.update
#
bpkg -v update <package-name>
# If the test operation is supported by the package:
#
{
# bpkg.test
#
bpkg -v test <package-name>
}
# For each (runtime) tests, examples, or benchmarks package referred
# to by the task manifest:
#
{
# bpkg.test-separate.update ( : bpkg.update)
#
bpkg -v update <package-name>
# bpkg.test-separate.test ( : bpkg.test)
#
bpkg -v test <package-name>
}
# If config.install.root is specified and no
# bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.install
#
bpkg -v install <package-name>
}
# If bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.bindist.{debian,fedora,archive}
#
bpkg -v bindist --distribution <distribution> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
<package-name>
}
# If the main package is installed either from source or from the
# binary distribution package:
#
{
# If the package contains subprojects that support the test
# operation:
#
{
# b.test-installed.create ( : b.create)
#
b -V create <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# For each test subproject:
#
{
# b.test-installed.configure ( : b.configure)
#
b -v configure [<pkg-config-vars>]
}
# b.test-installed.test
#
b -v test
}
# If task manifest refers to any (runtime) tests, examples, or
# benchmarks packages:
#
{
# bpkg.test-separate-installed.create (
# bpkg.test-separate-installed.create_for_target :
# bpkg.test-separate-installed.create)
#
bpkg -V create <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# bpkg.test-separate-installed.configure.add (
# : bpkg.configure.add)
#
bpkg -v add <repository-url>
# bpkg.test-separate-installed.configure.fetch (
# : bpkg.configure.fetch)
#
bpkg -v fetch --trust <repository-fp>
# bpkg.test-separate-installed.configure.build (
# bpkg.global.configure.build,
# (bpkg.test-separate-installed.configure.build_for_target :
# bpkg.test-separate-installed.configure.build))
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
<test-package-name>[ <test-version-constraint>]... \\
?sys:<package-name>/<package-version> \\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# For each (runtime) tests, examples, or benchmarks package
# referred to by the task manifest:
#
{
# bpkg.test-separate-installed.update ( : bpkg.update)
#
bpkg -v update <package-name>
# bpkg.test-separate-installed.test ( : bpkg.test)
#
bpkg -v test <package-name>
}
}
}
# If the main package is installed from source:
#
{
# bpkg.uninstall
#
bpkg -v uninstall <package-name>
}
# end
#
# This step id can only be used as a breakpoint.
\
Worker script for \c{host} packages:
\
# If configuration is self-hosted:
#
{
# bpkg.create (bpkg.host.create : b.create, bpkg.create)
#
bpkg -V create --type host -d <host-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
}
#
# Otherwise:
#
{
# [bpkg.create]
#
b -V create(<host-conf>, cc) config.config.load=~host
bpkg -v create --existing --type host -d <host-conf>
}
# bpkg.configure.add
#
bpkg -v add -d <host-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <host-conf> --trust <repository-fp>
# If configuration is self-hosted and config.install.root is specified:
#
{
# bpkg.create (bpkg.target.create : b.create, bpkg.create)
#
bpkg -V create -d <install-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# [bpkg.link]
#
bpkg -v link -d <install-conf> <host-conf>
# bpkg.configure.add
#
bpkg -v add -d <install-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <install-conf> --trust <repository-fp>
}
# If task manifest refers to any build-time tests, examples, or
# benchmarks packages:
#
{
# bpkg.create (bpkg.target.create : b.create, bpkg.create)
#
bpkg -V create -d <target-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# [bpkg.create]
#
b -V create(<module-conf>, cc) config.config.load=~build2
bpkg -v create --existing --type build2 -d <module-conf>
# [bpkg.link]
#
bpkg -v link -d <target-conf> <host-conf>
bpkg -v link -d <target-conf> <module-conf>
bpkg -v link -d <host-conf> <module-conf>
# If configuration is self-hosted and config.install.root is
# specified:
#
{
# [bpkg.link]
#
bpkg -v link -d <install-conf> <module-conf>
}
# bpkg.configure.add
#
bpkg -v add -d <target-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <target-conf> --trust <repository-fp>
}
# bpkg.configure.build (bpkg.global.configure.build)
#
# Notes:
#
# - Some parts may be omitted.
#
# - Parts related to different configurations have different prefix
# step ids:
#
# bpkg.host.configure.build for <host-uuid>
# bpkg.target.configure.build for <install-uuid>
# bpkg.target.configure.build for <target-uuid>
#
# - All parts have the same fallback step ids: b.configure and
# bpkg.configure.build.
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-opts>] \\
\\
{ --config-uuid <host-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-vars>] }+ \\
<package-name>/<package-version> \\
\\
{ --config-uuid <install-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-vars>] }+ \\
<package-name>/<package-version> \\
\\
{ --config-uuid <host-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> }+ \\
{ <runtime-test-package-name>[ test-version-constraint>]... } \\
\\
{ --config-uuid <target-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> }+ \\
{ <buildtime-test-package-name>[ test-version-constraint>]... } \\
\\
({ --config-uuid <host-uuid> [--config-uuid <install-uuid>] \\
[<dep-config-vars>] }+ \\
(?|sys:)<dependency-name>[ <dependency-version-constraint>])... \\
\\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# bpkg.update
#
bpkg -v update -d <host-conf> <package-name>
# If the test operation is supported by the package:
#
{
# bpkg.test
#
bpkg -v test -d <host-conf> <package-name>
}
# If configuration is self-hosted, then for each runtime tests,
# examples, or benchmarks package referred to by the task manifest:
#
{
# bpkg.test-separate.update ( : bpkg.update)
#
bpkg -v update -d <host-conf> <package-name>
# bpkg.test-separate.test ( : bpkg.test)
#
bpkg -v test -d <host-conf> <package-name>
}
# For each build-time tests, examples, or benchmarks package referred
# to by the task manifest:
#
{
# bpkg.test-separate.update ( : bpkg.update)
#
bpkg -v update -d <target-conf> <package-name>
# bpkg.test-separate.test ( : bpkg.test)
#
bpkg -v test -d <target-conf> <package-name>
}
# If configuration is self-hosted, config.install.root is specified,
# and no bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.install
#
bpkg -v install -d <install-conf> <package-name>
}
# If configuration is self-hosted and
# bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.bindist.{debian,fedora,archive}
#
bpkg -v bindist --distribution <distribution> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
<package-name>
}
# If the main package is installed either from source or from the
# binary distribution package:
#
{
# If the package contains subprojects that support the test
# operation:
#
{
# b.test-installed.create ( : b.create)
#
b -V create <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# For each test subproject:
#
{
# b.test-installed.configure ( : b.configure)
#
b -v configure [<pkg-config-vars>]
}
# b.test-installed.test
#
b -v test
}
# If task manifest refers to any tests, examples, or benchmarks
# packages:
#
{
# bpkg.test-separate-installed.create (
# bpkg.test-separate-installed.create_for_host :
# bpkg.test-separate-installed.create)
#
bpkg -V create --type host -d <host-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# If task manifest refers to any runtime tests, examples, or
# benchmarks packages:
#
{
# bpkg.test-separate-installed.configure.add (
# : bpkg.configure.add)
#
bpkg -v add -d <host-conf> <repository-url>
# bpkg.test-separate-installed.configure.fetch (
# : bpkg.configure.fetch)
#
bpkg -v fetch -d <host-conf> --trust <repository-fp>
}
# If task manifest refers to any build-time tests, examples, or
# benchmarks packages:
#
{
# bpkg.test-separate-installed.create (
# bpkg.test-separate-installed.create_for_host :
# bpkg.test-separate-installed.create)
#
bpkg -V create -d <target-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# [bpkg.test-separate-installed.create]
#
b -V create(<module-conf>, cc) config.config.load=~build2
bpkg -v create --existing --type build2 -d <module-conf>
# [bpkg.test-separate-installed.link]
#
bpkg -v link -d <target-conf> <host-conf>
bpkg -v link -d <target-conf> <module-conf>
bpkg -v link -d <host-conf> <module-conf>
# bpkg.test-separate-installed.configure.add (
# : bpkg.configure.add)
#
bpkg -v add -d <target-conf> <repository-url>
# bpkg.test-separate-installed.configure.fetch (
# : bpkg.configure.fetch)
#
bpkg -v fetch -d <target-conf> --trust <repository-fp>
}
# bpkg.test-separate-installed.configure.build (
# bpkg.global.configure.build,
# (bpkg.test-separate-installed.configure.build_for_host :
# bpkg.test-separate-installed.configure.build))
#
# Note that any of the runtime or build-time tests related parts
# (but not both) may be omitted.
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
\\
{ --config-name <host-conf> }+ \\
{ <runtime-test-package-name>[ <test-version-constraint>]... } \\
\\
{ --config-name <target-conf> }+ \\
<buildtime-test-package-name>[ <test-version-constraint>]... \\
\\
?sys:<package-name>/<package-version> \\
\\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# For each tests, examples, or benchmarks package referred
# to by the task manifest:
#
{
# bpkg.test-separate-installed.update ( : bpkg.update)
#
bpkg -v update <package-name>
# bpkg.test-separate-installed.test ( : bpkg.test)
#
bpkg -v test <package-name>
}
}
}
# If the main package is installed from source:
#
{
# bpkg.uninstall
#
bpkg -v uninstall -d <install-conf> <package-name>
}
# end
#
# This step id can only be used as a breakpoint.
\
Worker script for \c{module} packages:
\
# If configuration is self-hosted:
#
{
# bpkg.create (bpkg.module.create)
#
b -V create(<module-conf>, <env-modules>) config.config.load=~build2 \\
<env-config-args> <tgt-config-args> <pkg-config-args>
bpkg -v create --existing --type build2 -d <module-conf>
}
#
# Otherwise:
#
{
# [bpkg.create]
#
b -V create(<module-conf>, cc) config.config.load=~build2
bpkg -v create --existing --type build2 -d <module-conf>
}
# bpkg.configure.add
#
bpkg -v add -d <module-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <module-conf> --trust <repository-fp>
# If configuration is self-hosted and config.install.root is specified:
#
{
# bpkg.create (bpkg.module.create)
#
b -V create(<install-conf>, <env-modules>) \\
config.config.load=~build2 \\
<env-config-args> <tgt-config-args> <pkg-config-args>
bpkg -v create --existing --type build2 -d <install-conf>
# bpkg.configure.add
#
bpkg -v add -d <install-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <install-conf> --trust <repository-fp>
}
# If task manifest refers to any (build-time) tests, examples, or
# benchmarks packages:
#
{
# bpkg.create (bpkg.target.create : b.create, bpkg.create)
#
bpkg -V create -d <target-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# [bpkg.create]
#
b -V create(<host-conf>, cc) config.config.load=~host
bpkg -v create --existing --type host -d <host-conf>
# [bpkg.link]
#
bpkg -v link -d <target-conf> <host-conf>
bpkg -v link -d <target-conf> <module-conf>
bpkg -v link -d <host-conf> <module-conf>
# bpkg.configure.add
#
bpkg -v add -d <target-conf> <repository-url>
# bpkg.configure.fetch
#
bpkg -v fetch -d <target-conf> --trust <repository-fp>
}
# bpkg.configure.build (bpkg.global.configure.build)
#
# Notes:
#
# - Some parts may be omitted.
#
# - Parts related to different configurations have different prefix
# step ids:
#
# bpkg.module.configure.build for <module-uuid>
# bpkg.target.configure.build for <install-uuid>
# bpkg.target.configure.build for <target-uuid>
#
# - All parts have the same fallback step ids: b.configure and
# bpkg.configure.build.
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-opts>] \\
\\
{ --config-uuid <module-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-vars>] }+ \\
<package-name>/<package-version> \\
\\
{ --config-uuid <install-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
[<pkg-config-vars>] }+ \\
<package-name>/<package-version> \\
\\
{ --config-uuid <target-uuid> \\
<env-config-args> <tgt-config-args> <pkg-config-args> }+ \\
{ <buildtime-test-package-name>[ test-version-constraint>]... } \\
\\
({ --config-uuid <host-uuid> [--config-uuid <install-uuid>] \\
[<dep-config-vars>] }+ \\
(?|sys:)<dependency-name>[ <dependency-version-constraint>])... \\
\\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# bpkg.update
#
bpkg -v update -d <module-conf> <package-name>
# If the test operation is supported by the package:
#
{
# bpkg.test
#
bpkg -v test -d <module-conf> <package-name>
}
# For each (build-time) tests, examples, or benchmarks package referred
# to by the task manifest:
#
{
# bpkg.test-separate.update ( : bpkg.update)
#
bpkg -v update -d <target-conf> <package-name>
# bpkg.test-separate.test ( : bpkg.test)
#
bpkg -v test -d <target-conf> <package-name>
}
# If configuration is self-hosted, config.install.root is specified,
# and no bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.install
#
bpkg -v install -d <install-conf> <package-name>
}
# If configuration is self-hosted and
# bpkg.bindist.{debian,fedora,archive} step is enabled:
#
{
# bpkg.bindist.{debian,fedora,archive}
#
bpkg -v bindist --distribution <distribution> \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
<package-name>
}
# If the main package is installed either from source or from the
# binary distribution package:
#
{
# If task manifest refers to any (build-time) tests, examples, or
# benchmarks packages:
#
{
# [bpkg.test-separate-installed.create]
#
b -V create(<module-conf>, cc) config.config.load=~build2
bpkg -v create --existing --type build2 -d <module-conf>
# bpkg.test-separate-installed.create (
# bpkg.test-separate-installed.create_for_module :
# bpkg.test-separate-installed.create)
#
bpkg -V create -d <target-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# bpkg.test-separate-installed.create (
# bpkg.test-separate-installed.create_for_module :
# bpkg.test-separate-installed.create)
#
bpkg -V create --type host -d <host-conf> <env-modules> \\
<env-config-args> <tgt-config-args> <pkg-config-args>
# [bpkg.test-separate-installed.link]
#
bpkg -v link -d <target-conf> <host-conf>
bpkg -v link -d <target-conf> <module-conf>
bpkg -v link -d <host-conf> <module-conf>
# bpkg.test-separate-installed.configure.add (
# : bpkg.configure.add)
#
bpkg -v add -d <target-conf> <repository-url>
# bpkg.test-separate-installed.configure.fetch (
# : bpkg.configure.fetch)
#
bpkg -v fetch -d <target-conf> --trust <repository-fp>
# bpkg.test-separate-installed.configure.build (
# bpkg.global.configure.build,
# (bpkg.test-separate-installed.configure.build_for_module :
# bpkg.test-separate-installed.configure.build))
#
bpkg -v build --configure-only \\
<env-config-args> <tgt-config-args> <pkg-config-args> \\
\\
{ --config-name <target-conf> }+ \\
<buildtime-test-package-name>[ <test-version-constraint>]... \\
\\
?sys:<package-name>/<package-version> \\
\\
[?sys:<dependency-name>[ <dependency-version-constraint>]...]
# For each (build-time) tests, examples, or benchmarks package
# referred to by the task manifest:
#
{
# bpkg.test-separate-installed.update ( : bpkg.update)
#
bpkg -v update -d <target-conf> <package-name>
# bpkg.test-separate-installed.test ( : bpkg.test)
#
bpkg -v test -d <target-conf> <package-name>
}
}
}
# If the main package is installed from source:
#
{
# bpkg.uninstall
#
bpkg -v uninstall -d <install-conf> <package-name>
}
# end
#
# This step id can only be used as a breakpoint.
\
For details on configuring and testing installation refer to
\l{#arch-controller Controller Logic}.
If a primary or test package comes from a version control-based repository,
then its \c{dist} meta-operation is also tested as a part of the
\c{bpkg[.*].configure.build} steps by re-distributing the source directory in
the load distribution mode after configuration.
If the build is interactive, then the worker pauses its execution at the
specified breakpoint and prompts the user whether to continue or abort the
execution. If the breakpoint is a step id, then the worker pauses prior to
executing every command of the specified step. Otherwise, the breakpoint
denotes the result status and the worker pauses if the command results with
the specified or more critical status (see \l{#arch-result Result Manifest}).
As an example, the following POSIX shell script can be used to setup the
environment for building C and C++ packages with GCC 9 on most Linux
distributions.
\
#!/bin/sh
# Environment setup script for C/C++ compilation with GCC 9.
#
# $1 - target
# $2 - bbot executable
# $3+ - bbot options
set -e # Exit on errors.
mode=
case \"$1\" in
x86_64-*)
#mode=-m64
;;
i?86-*)
mode=-m32
;;
*)
echo \"unknown target: '$1'\" 1>&2
exit 1
;;
esac
shift
exec \"$@\" cc config.c=\"gcc-9 $mode\" config.cxx=\"g++-9 $mode\"
\
\h#arch-controller|Controller Logic|
A \c{bbot} controller that issues own build tasks maps available build
machines (as reported by agents) to \i{build target configurations} according
to the \c{buildtab} configuration file. Blank lines and lines that start with
\c{#} are ignored. All other lines in this file have the following format:
\
<machine-pattern> <target-config> <target>[/<environment>] <classes> [<tgt-config-arg>]* [<warning-regex>]*
<tgt-config-arg> = [[+|-]<prefix>:](<variable>|<option>) | \\
(+|-)<prefix>:
<prefix> = <tool>[.<phase>][.<operation>[.<command>]]
\
Where \c{<machine-pattern>} is filesystem wildcard pattern that is matched
against available machine names, \c{<target-config>} is the target
configuration name, \c{<target>} is the build target, optional
\c{<environment>} is the build environment name, \c{<classes>} is a
space-separated list of configuration classes that is matched against the
package configuration \c{*-builds} values, optional \c{<tgt-config-arg>} list
is additional configuration options and variables, and optional
\c{<warning-regex>} list is additional regular expressions that should be used
to detect warnings in the logs.
The build target configurations can belong to multiple classes with their
names reflecting some common configuration aspects, such as the operating
system, compiler, build options, etc. Predefined class names are \c{default},
\c{all}, \c{none}, \c{host}, and \c{build2}. The default target configurations
are built by default. A configuration must also belong to the \c{all} unless
it is hidden. A configuration that is self-hosted must also belong to the
\c{host} class and, if it is also self-hosted for build system modules, to the
\c{build2} class. Valid custom class names must contain only alpha-numeric
characters, \c{_}, \c{+}, \c{-}, and \c{.}, except as the first character for
the last three. Class names that start with \c{_} are reserved for the future
hidden/special class functionality.
Regular expressions must start with \c{~}, to be distinguished from target
configuration options and variables. Note that the \c{<tgt-config-arg>} and
\c{<warning-regex>} lists have the same quoting semantics as in the
\c{target-config} and the \c{warning-regex} value in the build task
manifest. The matched machine name, the target, the environment name,
configuration options/variables, and regular expressions are included into the
build task manifest.
Values in the \c{<tgt-config-arg>} list can be opionally prefixed with the
\i{step id} or a leading portion thereof to restrict it to a specific step,
operation, phase, or tool in the \i{worker script} (see \l{#arch-worker Worker
Logic}). The prefix can optionally begin with the \c{+} or \c{-} character (in
this case the argument can be omitted) to enable or disable the respective
step. The steps which can be enabled or disabled are:
\
bpkg.update
bpkg.test
bpkg.test-separate.update
bpkg.test-separate.test
# Disabled if bpkg.bindist.* is enabled.
#
bpkg.install
# Disabled by default.
#
bpkg.bindist.{debian,fedora,archive}
# Disabled if bpkg.bindist.* is disabled.
#
bbot.sys-install
b.test-installed.test
bpkg.test-separate-installed.update
bpkg.test-separate-installed.test
\
Note that the \c{bpkg.bindist.*} steps are mutually exclusive and only the
last step status change via the \c{(+|-)bpkg.bindist.*} prefix is considered.
Unprefixed values only apply to the \c{*.create[_for_*]} steps. Note that
options with values can only be specified using the single argument
notation. For example:
\
bpkg:--fetch-timeout=600 \\
bpkg.configure.fetch:--fetch-timeout=60 \\
+bpkg.bindist.debian: \\
b:-j1
\
Note that each machine name is matched against every pattern and all the
patterns that match produce a target configuration. If a machine does not
match any pattern, then it is ignored (meaning that this controller is not
interested in testing its packages with this machine). If multiple machines
match the same pattern, then only a single target configuration using any of
the machines is produced (meaning that this controller considers these
machines equivalent).
As an example, let's say we have a machine named \c{windows_10-vc_14.3}. If we
wanted to test both 32 and 64-bit as well as debug and optimized builds, then
we could have generated the following target configurations:
\
windows*-msvc_14* windows-msvc_14-Z7 i686-microsoft-win32-msvc14.0 \"all default msvc i686 debug\" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~\"warning C4\d{3}: \"
windows*-msvc_14* windows-msvc_14-O2 i686-microsoft-win32-msvc14.0 \"all default msvc i686 optimized\" config.cc.coptions=/O2 ~\"warning C4\d{3}: \"
windows*-msvc_14* windows-msvc_14-Z7 x86_64-microsoft-win32-msvc14.0 \"all default msvc x86_64 debug\" config.cc.coptions=/Z7 config.cc.loptions=/DEBUG ~\"warning C4\d{3}: \"
windows*-msvc_14* windows-msvc_14-O2 x86_64-microsoft-win32-msvc14.0 \"all default msvc x86_64 optimized\" config.cc.coptions=/O2 ~\"warning C4\d{3}: \"
\
In the above example we could handle both \c{i686} and \c{x86_64}
architectures with the same machine but this may not always be possible
and we may have to use different machines for different configuration/target
combinations. For example:
\
x86_64_linux_debian_11*-gcc_12.2 linux_debian_11-gcc_12.2 i686-linux-gnu ...
x86_64_linux_debian_11*-gcc_12.2 linux_debian_11-gcc_12.2 x86_64-linux-gnu ...
aarch64_linux_debian_11*-gcc_12.2 linux_debian_11-gcc_12.2 aarch64-linux-gnu ...
\
As another example, let's say we have \c{linux_fedora_25-gcc_6} and
\c{linux_ubuntu_16.04-gcc_6}. If all we cared about is testing GCC 6 64-bit
builds on Linux, then our target configurations could look like this:
\
linux*-gcc_6 linux-gcc_6-g x86_64-linux-gnu \"all default gcc debug\" config.cc.coptions=-g
linux*-gcc_6 linux-gcc_6-O3 x86_64-linux-gnu \"all default gcc optimized\" config.cc.coptions=-O3
\
A build target configuration class can derive from another class in which case
target configurations that belong to the derived class are treated as also
belonging to the base class (or classes, recursively). The derived and base
class names are separated with \c{:} (no leading or trailing spaces allowed)
and the base must be present in the first mentioning of the derived class. For
example:
\
linux*-gcc_6 linux-gcc_6-g x86_64-linux-gnu \"all gcc-6+ debug\" config.cc.coptions=-g
linux*-gcc_6 linux-gcc_6-O3 x86_64-linux-gnu \"all gcc-6+ optimized\" config.cc.coptions=-O3
linux*-gcc_7 linux-gcc_7-g x86_64-linux-gnu \"all gcc-7+:gcc-6+ debug\" config.cc.coptions=-g
linux*-gcc_7 linux-gcc_7-O3 x86_64-linux-gnu \"all gcc-7+ optimized\" config.cc.coptions=-O3
\
A machine pattern consisting of a single \c{-} is a placeholder
entry. Everything about a placeholder is ignored except for the class
inheritance information. Note, however, that while all other information is
ignored, the configuration name and target must be present but can also be
\c{-}. For example:
\
linux*-gcc_6 linux-gcc_6 x86_64-linux-gnu \"all gcc-6+ \"
- - - \" gcc-7+:gcc-6+\"
linux*-gcc_8 linux-gcc_8 x86_64-linux-gnu \"all gcc-8+:gcc-7+\"
\
If the \c{<tgt-config-arg>} list contains the \c{config.install.root} variable
that applies to the \c{bpkg.create} step, then in addition to building and
possibly running tests, the \c{bbot} worker will also test installing and
uninstalling each package. Furthermore, if the package contains subprojects
that support the test operation and/or refers to other packages via the
\c{tests}, \c{examples}, or \c{benchmarks} manifest values which are not
excluded by the \c{bbot} controller, then the worker will additionally build
such subprojects/packages against the installation and run their tests (test
installed and test separate installed phases).
Two types of installations can be tested: \i{system} and \i{private}. A system
installation uses a well-known location, such as \c{/usr} or \c{/usr/local},
that will be searched by the compiler toolchain by default. A private
installation uses a private directory, such as \c{/opt}, that will have to be
explicitly mentioned to the compiler. While the system installation is usually
preferable, it may not be always usable because of the potential conflicts
with the already installed software, for example, by the system package
manager.
As an example, the following two target configurations could be used to test
system and private installations:
\
linux*-gcc* linux-gcc-sysinstall x86_64-linux-gnu \"all default gcc\" config.install.root=/usr config.install.sudo=sudo
linux*-gcc* linux-gcc-prvinstall x86_64-linux-gnu \"all default gcc\" config.install.root=/tmp/install config.cc.poptions=-I/tmp/install/include config.cc.loptions=-L/tmp/install/lib config.bin.rpath=/tmp/install/lib
\
Note also that while building and running tests against the installation the
worker makes the \c{bin} subdirectory of \c{config.install.root} the first
entry in the \c{PATH} environment variable, except for build system modules
which supposedly don't install any executables.
The \c{bbot} controller normally issues the build task by picking an unbuilt
package configuration and one of the produced (via the machine names match)
target configurations, which is not excluded from building due to this package
configuration \c{*-builds}, \c{*-build-include}, and \c{*-build-exclude}
manifest values.
"
|