Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-SA-2.0-UK |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 2 | |
| 3 | ********************** |
| 4 | Concepts and Reference |
| 5 | ********************** |
| 6 | |
| 7 | In order to configure and use Toaster, you should understand some |
| 8 | concepts and have some basic command reference material available. This |
| 9 | final chapter provides conceptual information on layer sources, |
| 10 | releases, and JSON configuration files. Also provided is a quick look at |
| 11 | some useful ``manage.py`` commands that are Toaster-specific. |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 12 | Information on ``manage.py`` commands is available across the Web and |
| 13 | this manual by no means attempts to provide a command |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 14 | comprehensive reference. |
| 15 | |
| 16 | Layer Source |
| 17 | ============ |
| 18 | |
| 19 | In general, a "layer source" is a source of information about existing |
| 20 | layers. In particular, we are concerned with layers that you can use |
| 21 | with the Yocto Project and Toaster. This chapter describes a particular |
| 22 | type of layer source called a "layer index." |
| 23 | |
| 24 | A layer index is a web application that contains information about a set |
| 25 | of custom layers. A good example of an existing layer index is the |
| 26 | OpenEmbedded Layer Index. A public instance of this layer index exists |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 27 | at :oe_layerindex:`/`. You can find the code for this |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 28 | layer index's web application at :yocto_git:`/layerindex-web/`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 29 | |
| 30 | When you tie a layer source into Toaster, it can query the layer source |
| 31 | through a |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 32 | `REST <https://en.wikipedia.org/wiki/Representational_state_transfer>`__ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 33 | API, store the information about the layers in the Toaster database, and |
| 34 | then show the information to users. Users are then able to view that |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 35 | information and build layers from Toaster itself without having to |
| 36 | clone or edit the BitBake layers configuration file ``bblayers.conf``. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 37 | |
| 38 | Tying a layer source into Toaster is convenient when you have many |
| 39 | custom layers that need to be built on a regular basis by a community of |
| 40 | developers. In fact, Toaster comes pre-configured with the OpenEmbedded |
| 41 | Metadata Index. |
| 42 | |
| 43 | .. note:: |
| 44 | |
| 45 | You do not have to use a layer source to use Toaster. Tying into a |
| 46 | layer source is optional. |
| 47 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 48 | Setting Up and Using a Layer Source |
| 49 | ----------------------------------- |
| 50 | |
| 51 | To use your own layer source, you need to set up the layer source and |
| 52 | then tie it into Toaster. This section describes how to tie into a layer |
| 53 | index in a manner similar to the way Toaster ties into the OpenEmbedded |
| 54 | Metadata Index. |
| 55 | |
| 56 | Understanding Your Layers |
| 57 | ~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 58 | |
| 59 | The obvious first step for using a layer index is to have several custom |
| 60 | layers that developers build and access using the Yocto Project on a |
| 61 | regular basis. This set of layers needs to exist and you need to be |
| 62 | familiar with where they reside. You will need that information when you |
| 63 | set up the code for the web application that "hooks" into your set of |
| 64 | layers. |
| 65 | |
| 66 | For general information on layers, see the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 67 | ":ref:`overview-manual/yp-intro:the yocto project layer model`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 68 | section in the Yocto Project Overview and Concepts Manual. For information on how |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 69 | to create layers, see the ":ref:`dev-manual/common-tasks:understanding and creating layers`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 70 | section in the Yocto Project Development Tasks Manual. |
| 71 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 72 | Configuring Toaster to Hook Into Your Layer Index |
| 73 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 74 | |
| 75 | If you want Toaster to use your layer index, you must host the web |
| 76 | application in a server to which Toaster can connect. You also need to |
| 77 | give Toaster the information about your layer index. In other words, you |
| 78 | have to configure Toaster to use your layer index. This section |
| 79 | describes two methods by which you can configure and use your layer |
| 80 | index. |
| 81 | |
| 82 | In the previous section, the code for the OpenEmbedded Metadata Index |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 83 | (i.e. :oe_layerindex:`/`) was referenced. You can use |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 84 | this code, which is at :yocto_git:`/layerindex-web/`, as a base to create |
| 85 | your own layer index. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 86 | |
| 87 | Use the Administration Interface |
| 88 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 89 | |
| 90 | Access the administration interface through a browser by entering the |
| 91 | URL of your Toaster instance and adding "``/admin``" to the end of the |
| 92 | URL. As an example, if you are running Toaster locally, use the |
| 93 | following URL:: |
| 94 | |
| 95 | http://127.0.0.1:8000/admin |
| 96 | |
| 97 | The administration interface has a "Layer sources" section that includes |
| 98 | an "Add layer source" button. Click that button and provide the required |
| 99 | information. Make sure you select "layerindex" as the layer source type. |
| 100 | |
| 101 | Use the Fixture Feature |
| 102 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 103 | |
| 104 | The Django fixture feature overrides the default layer server when you |
| 105 | use it to specify a custom URL. To use the fixture feature, create (or |
| 106 | edit) the file ``bitbake/lib/toaster.orm/fixtures/custom.xml``, and then |
| 107 | set the following Toaster setting to your custom URL: |
| 108 | |
| 109 | .. code-block:: xml |
| 110 | |
| 111 | <?xml version="1.0" ?> |
| 112 | <django-objects version="1.0"> |
| 113 | <object model="orm.toastersetting" pk="100"> |
| 114 | <field name="name" type="CharField">CUSTOM_LAYERINDEX_SERVER</field> |
| 115 | <field name="value" type="CharField">https://layers.my_organization.org/layerindex/branch/master/layers/</field> |
| 116 | </object> |
| 117 | <django-objects> |
| 118 | |
| 119 | When you start Toaster for the first time, or |
| 120 | if you delete the file ``toaster.sqlite`` and restart, the database will |
| 121 | populate cleanly from this layer index server. |
| 122 | |
| 123 | Once the information has been updated, verify the new layer information |
| 124 | is available by using the Toaster web interface. To do that, visit the |
| 125 | "All compatible layers" page inside a Toaster project. The layers from |
| 126 | your layer source should be listed there. |
| 127 | |
| 128 | If you change the information in your layer index server, refresh the |
| 129 | Toaster database by running the following command: |
| 130 | |
| 131 | .. code-block:: shell |
| 132 | |
| 133 | $ bitbake/lib/toaster/manage.py lsupdates |
| 134 | |
| 135 | |
| 136 | If Toaster can reach the API URL, you should see a message telling you that |
| 137 | Toaster is updating the layer source information. |
| 138 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 139 | Releases |
| 140 | ======== |
| 141 | |
| 142 | When you create a Toaster project using the web interface, you are asked |
| 143 | to choose a "Release." In the context of Toaster, the term "Release" |
| 144 | refers to a set of layers and a BitBake version the OpenEmbedded build |
| 145 | system uses to build something. As shipped, Toaster is pre-configured |
| 146 | with releases that correspond to Yocto Project release branches. |
| 147 | However, you can modify, delete, and create new releases according to |
| 148 | your needs. This section provides some background information on |
| 149 | releases. |
| 150 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 151 | Pre-Configured Releases |
| 152 | ----------------------- |
| 153 | |
| 154 | As shipped, Toaster is configured to use a specific set of releases. Of |
| 155 | course, you can always configure Toaster to use any release. For |
| 156 | example, you might want your project to build against a specific commit |
| 157 | of any of the "out-of-the-box" releases. Or, you might want your project |
| 158 | to build against different revisions of OpenEmbedded and BitBake. |
| 159 | |
| 160 | As shipped, Toaster is configured to work with the following releases: |
| 161 | |
| 162 | - *Yocto Project &DISTRO; "&DISTRO_NAME;" or OpenEmbedded "&DISTRO_NAME;":* |
| 163 | This release causes your Toaster projects to build against the head |
| 164 | of the &DISTRO_NAME_NO_CAP; branch at |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 165 | :yocto_git:`/poky/log/?h=&DISTRO_NAME_NO_CAP;` or |
| 166 | :oe_git:`/openembedded-core/commit/?h=&DISTRO_NAME_NO_CAP;`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 167 | |
| 168 | - *Yocto Project "Master" or OpenEmbedded "Master":* This release |
| 169 | causes your Toaster Projects to build against the head of the master |
| 170 | branch, which is where active development takes place, at |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 171 | :yocto_git:`/poky/log/` or :oe_git:`/openembedded-core/log/`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 172 | |
| 173 | - *Local Yocto Project or Local OpenEmbedded:* This release causes your |
| 174 | Toaster Projects to build against the head of the ``poky`` or |
| 175 | ``openembedded-core`` clone you have local to the machine running |
| 176 | Toaster. |
| 177 | |
| 178 | Configuring Toaster |
| 179 | =================== |
| 180 | |
| 181 | In order to use Toaster, you must configure the database with the |
| 182 | default content. The following subsections describe various aspects of |
| 183 | Toaster configuration. |
| 184 | |
| 185 | Configuring the Workflow |
| 186 | ------------------------ |
| 187 | |
| 188 | The ``bldcontrol/management/commands/checksettings.py`` file controls |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 189 | workflow configuration. Here is the process to |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 190 | initially populate this database. |
| 191 | |
| 192 | 1. The default project settings are set from |
| 193 | ``orm/fixtures/settings.xml``. |
| 194 | |
| 195 | 2. The default project distro and layers are added from |
| 196 | ``orm/fixtures/poky.xml`` if poky is installed. If poky is not |
| 197 | installed, they are added from ``orm/fixtures/oe-core.xml``. |
| 198 | |
| 199 | 3. If the ``orm/fixtures/custom.xml`` file exists, then its values are |
| 200 | added. |
| 201 | |
| 202 | 4. The layer index is then scanned and added to the database. |
| 203 | |
| 204 | Once these steps complete, Toaster is set up and ready to use. |
| 205 | |
| 206 | Customizing Pre-Set Data |
| 207 | ------------------------ |
| 208 | |
| 209 | The pre-set data for Toaster is easily customizable. You can create the |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 210 | ``orm/fixtures/custom.xml`` file to customize the values that go into |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 211 | the database. Customization is additive, and can either extend or |
| 212 | completely replace the existing values. |
| 213 | |
| 214 | You use the ``orm/fixtures/custom.xml`` file to change the default |
| 215 | project settings for the machine, distro, file images, and layers. When |
| 216 | creating a new project, you can use the file to define the offered |
| 217 | alternate project release selections. For example, you can add one or |
| 218 | more additional selections that present custom layer sets or distros, |
| 219 | and any other local or proprietary content. |
| 220 | |
| 221 | Additionally, you can completely disable the content from the |
| 222 | ``oe-core.xml`` and ``poky.xml`` files by defining the section shown |
| 223 | below in the ``settings.xml`` file. For example, this option is |
| 224 | particularly useful if your custom configuration defines fewer releases |
| 225 | or layers than the default fixture files. |
| 226 | |
| 227 | The following example sets "name" to "CUSTOM_XML_ONLY" and its value to |
| 228 | "True". |
| 229 | |
| 230 | .. code-block:: xml |
| 231 | |
| 232 | <object model="orm.toastersetting" pk="99"> |
| 233 | <field type="CharField" name="name">CUSTOM_XML_ONLY</field> |
| 234 | <field type="CharField" name="value">True</field> |
| 235 | </object> |
| 236 | |
| 237 | Understanding Fixture File Format |
| 238 | --------------------------------- |
| 239 | |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 240 | Here is an overview of the file format used by the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 241 | ``oe-core.xml``, ``poky.xml``, and ``custom.xml`` files. |
| 242 | |
| 243 | The following subsections describe each of the sections in the fixture |
| 244 | files, and outline an example section of the XML code. you can use to |
| 245 | help understand this information and create a local ``custom.xml`` file. |
| 246 | |
| 247 | Defining the Default Distro and Other Values |
| 248 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 249 | |
| 250 | This section defines the default distro value for new projects. By |
| 251 | default, it reserves the first Toaster Setting record "1". The following |
| 252 | demonstrates how to set the project default value for |
| 253 | :term:`DISTRO`: |
| 254 | |
| 255 | .. code-block:: xml |
| 256 | |
| 257 | <!-- Set the project default value for DISTRO --> |
| 258 | <object model="orm.toastersetting" pk="1"> |
| 259 | <field type="CharField" name="name">DEFCONF_DISTRO</field> |
| 260 | <field type="CharField" name="value">poky</field> |
| 261 | </object> |
| 262 | |
| 263 | You can override |
| 264 | other default project values by adding additional Toaster Setting |
| 265 | sections such as any of the settings coming from the ``settings.xml`` |
| 266 | file. Also, you can add custom values that are included in the BitBake |
| 267 | environment. The "pk" values must be unique. By convention, values that |
| 268 | set default project values have a "DEFCONF" prefix. |
| 269 | |
| 270 | Defining BitBake Version |
| 271 | ~~~~~~~~~~~~~~~~~~~~~~~~ |
| 272 | |
| 273 | The following defines which version of BitBake is used for the following |
| 274 | release selection: |
| 275 | |
| 276 | .. code-block:: xml |
| 277 | |
| 278 | <!-- Bitbake versions which correspond to the metadata release --> |
| 279 | <object model="orm.bitbakeversion" pk="1"> |
| 280 | <field type="CharField" name="name">&DISTRO_NAME_NO_CAP;</field> |
| 281 | <field type="CharField" name="giturl">git://git.yoctoproject.org/poky</field> |
| 282 | <field type="CharField" name="branch">&DISTRO_NAME_NO_CAP;</field> |
| 283 | <field type="CharField" name="dirpath">bitbake</field> |
| 284 | </object> |
| 285 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 286 | Defining Release |
| 287 | ~~~~~~~~~~~~~~~~ |
| 288 | |
| 289 | The following defines the releases when you create a new project: |
| 290 | |
| 291 | .. code-block:: xml |
| 292 | |
| 293 | <!-- Releases available --> |
| 294 | <object model="orm.release" pk="1"> |
| 295 | <field type="CharField" name="name">&DISTRO_NAME_NO_CAP;</field> |
| 296 | <field type="CharField" name="description">Yocto Project &DISTRO; "&DISTRO_NAME;"</field> |
| 297 | <field rel="ManyToOneRel" to="orm.bitbakeversion" name="bitbake_version">1</field> |
| 298 | <field type="CharField" name="branch_name">&DISTRO_NAME_NO_CAP;</field> |
| 299 | <field type="TextField" name="helptext">Toaster will run your builds using the tip of the <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?h=&DISTRO_NAME_NO_CAP;">Yocto Project &DISTRO_NAME; branch</a>.</field> |
| 300 | </object> |
| 301 | |
| 302 | The "pk" value must match the above respective BitBake version record. |
| 303 | |
| 304 | Defining the Release Default Layer Names |
| 305 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 306 | |
| 307 | The following defines the default layers for each release: |
| 308 | |
| 309 | .. code-block:: xml |
| 310 | |
| 311 | <!-- Default project layers for each release --> |
| 312 | <object model="orm.releasedefaultlayer" pk="1"> |
| 313 | <field rel="ManyToOneRel" to="orm.release" name="release">1</field> |
| 314 | <field type="CharField" name="layer_name">openembedded-core</field> |
| 315 | </object> |
| 316 | |
| 317 | The 'pk' values in the example above should start at "1" and increment |
| 318 | uniquely. You can use the same layer name in multiple releases. |
| 319 | |
| 320 | Defining Layer Definitions |
| 321 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 322 | |
| 323 | Layer definitions are the most complex. The following defines each of |
| 324 | the layers, and then defines the exact layer version of the layer used |
| 325 | for each respective release. You must have one ``orm.layer`` entry for |
| 326 | each layer. Then, with each entry you need a set of |
| 327 | ``orm.layer_version`` entries that connects the layer with each release |
| 328 | that includes the layer. In general all releases include the layer. |
| 329 | |
| 330 | .. code-block:: xml |
| 331 | |
| 332 | <object model="orm.layer" pk="1"> |
| 333 | <field type="CharField" name="name">openembedded-core</field> |
| 334 | <field type="CharField" name="layer_index_url"></field> |
| 335 | <field type="CharField" name="vcs_url">git://git.yoctoproject.org/poky</field> |
| 336 | <field type="CharField" name="vcs_web_url">http://git.yoctoproject.org/cgit/cgit.cgi/poky</field> |
| 337 | <field type="CharField" name="vcs_web_tree_base_url">http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> |
| 338 | <field type="CharField" name="vcs_web_file_base_url">http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/%path%?h=%branch%</field> |
| 339 | </object> |
| 340 | <object model="orm.layer_version" pk="1"> |
| 341 | <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field> |
| 342 | <field type="IntegerField" name="layer_source">0</field> |
| 343 | <field rel="ManyToOneRel" to="orm.release" name="release">1</field> |
| 344 | <field type="CharField" name="branch">&DISTRO_NAME_NO_CAP;</field> |
| 345 | <field type="CharField" name="dirpath">meta</field> |
| 346 | </object> <object model="orm.layer_version" pk="2"> |
| 347 | <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field> |
| 348 | <field type="IntegerField" name="layer_source">0</field> |
| 349 | <field rel="ManyToOneRel" to="orm.release" name="release">2</field> |
| 350 | <field type="CharField" name="branch">HEAD</field> |
| 351 | <field type="CharField" name="commit">HEAD</field> |
| 352 | <field type="CharField" name="dirpath">meta</field> |
| 353 | </object> |
| 354 | <object model="orm.layer_version" pk="3"> |
| 355 | <field rel="ManyToOneRel" to="orm.layer" name="layer">1</field> |
| 356 | <field type="IntegerField" name="layer_source">0</field> |
| 357 | <field rel="ManyToOneRel" to="orm.release" name="release">3</field> |
| 358 | <field type="CharField" name="branch">master</field> |
| 359 | <field type="CharField" name="dirpath">meta</field> |
| 360 | </object> |
| 361 | |
| 362 | The layer "pk" values above must be unique, and typically start at "1". The |
| 363 | layer version "pk" values must also be unique across all layers, and typically |
| 364 | start at "1". |
| 365 | |
| 366 | Remote Toaster Monitoring |
| 367 | ========================= |
| 368 | |
| 369 | Toaster has an API that allows remote management applications to |
| 370 | directly query the state of the Toaster server and its builds in a |
| 371 | machine-to-machine manner. This API uses the |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 372 | `REST <https://en.wikipedia.org/wiki/Representational_state_transfer>`__ |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 373 | interface and the transfer of JSON files. For example, you might monitor |
| 374 | a build inside a container through well supported known HTTP ports in |
| 375 | order to easily access a Toaster server inside the container. In this |
| 376 | example, when you use this direct JSON API, you avoid having web page |
| 377 | parsing against the display the user sees. |
| 378 | |
| 379 | Checking Health |
| 380 | --------------- |
| 381 | |
| 382 | Before you use remote Toaster monitoring, you should do a health check. |
| 383 | To do this, ping the Toaster server using the following call to see if |
| 384 | it is still alive:: |
| 385 | |
| 386 | http://host:port/health |
| 387 | |
| 388 | Be sure to provide values for host and port. If the server is alive, you will |
| 389 | get the response HTML: |
| 390 | |
| 391 | .. code-block:: html |
| 392 | |
| 393 | <!DOCTYPE html> |
| 394 | <html lang="en"> |
| 395 | <head><title>Toaster Health</title></head> |
| 396 | <body>Ok</body> |
| 397 | </html> |
| 398 | |
| 399 | Determining Status of Builds in Progress |
| 400 | ---------------------------------------- |
| 401 | |
| 402 | Sometimes it is useful to determine the status of a build in progress. |
| 403 | To get the status of pending builds, use the following call:: |
| 404 | |
| 405 | http://host:port/toastergui/api/building |
| 406 | |
| 407 | Be sure to provide values for host and port. The output is a JSON file that |
| 408 | itemizes all builds in progress. This file includes the time in seconds since |
| 409 | each respective build started as well as the progress of the cloning, parsing, |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 410 | and task execution. Here is sample output for a build in progress: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 411 | |
| 412 | .. code-block:: JSON |
| 413 | |
| 414 | {"count": 1, |
| 415 | "building": [ |
| 416 | {"machine": "beaglebone", |
| 417 | "seconds": "463.869", |
| 418 | "task": "927:2384", |
| 419 | "distro": "poky", |
| 420 | "clone": "1:1", |
| 421 | "id": 2, |
| 422 | "start": "2017-09-22T09:31:44.887Z", |
| 423 | "name": "20170922093200", |
| 424 | "parse": "818:818", |
| 425 | "project": "my_rocko", |
| 426 | "target": "core-image-minimal" |
| 427 | }] |
| 428 | } |
| 429 | |
| 430 | The JSON data for this query is returned in a |
| 431 | single line. In the previous example the line has been artificially |
| 432 | split for readability. |
| 433 | |
| 434 | Checking Status of Builds Completed |
| 435 | ----------------------------------- |
| 436 | |
| 437 | Once a build is completed, you get the status when you use the following |
| 438 | call:: |
| 439 | |
| 440 | http://host:port/toastergui/api/builds |
| 441 | |
| 442 | Be sure to provide values for host and port. The output is a JSON file that |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 443 | itemizes all complete builds, and includes build summary information. Here |
| 444 | is sample output for a completed build: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 445 | |
| 446 | .. code-block:: JSON |
| 447 | |
| 448 | {"count": 1, |
| 449 | "builds": [ |
| 450 | {"distro": "poky", |
| 451 | "errors": 0, |
| 452 | "machine": "beaglebone", |
| 453 | "project": "my_rocko", |
| 454 | "stop": "2017-09-22T09:26:36.017Z", |
| 455 | "target": "quilt-native", |
| 456 | "seconds": "78.193", |
| 457 | "outcome": "Succeeded", |
| 458 | "id": 1, |
| 459 | "start": "2017-09-22T09:25:17.824Z", |
| 460 | "warnings": 1, |
| 461 | "name": "20170922092618" |
| 462 | }] |
| 463 | } |
| 464 | |
| 465 | The JSON data for this query is returned in a single line. In the |
| 466 | previous example the line has been artificially split for readability. |
| 467 | |
| 468 | Determining Status of a Specific Build |
| 469 | -------------------------------------- |
| 470 | |
| 471 | Sometimes it is useful to determine the status of a specific build. To |
| 472 | get the status of a specific build, use the following call:: |
| 473 | |
| 474 | http://host:port/toastergui/api/build/ID |
| 475 | |
| 476 | Be sure to provide values for |
| 477 | host, port, and ID. You can find the value for ID from the Builds |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 478 | Completed query. See the ":ref:`toaster-manual/reference:checking status of builds completed`" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 479 | section for more information. |
| 480 | |
| 481 | The output is a JSON file that itemizes the specific build and includes |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 482 | build summary information. Here is sample output for a specific |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 483 | build: |
| 484 | |
| 485 | .. code-block:: JSON |
| 486 | |
| 487 | {"build": |
| 488 | {"distro": "poky", |
| 489 | "errors": 0, |
| 490 | "machine": "beaglebone", |
| 491 | "project": "my_rocko", |
| 492 | "stop": "2017-09-22T09:26:36.017Z", |
| 493 | "target": "quilt-native", |
| 494 | "seconds": "78.193", |
| 495 | "outcome": "Succeeded", |
| 496 | "id": 1, |
| 497 | "start": "2017-09-22T09:25:17.824Z", |
| 498 | "warnings": 1, |
| 499 | "name": "20170922092618", |
| 500 | "cooker_log": "/opt/user/poky/build-toaster-2/tmp/log/cooker/beaglebone/build_20170922_022607.991.log" |
| 501 | } |
| 502 | } |
| 503 | |
| 504 | The JSON data for this query is returned in a single line. In the |
| 505 | previous example the line has been artificially split for readability. |
| 506 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 507 | Useful Commands |
| 508 | =============== |
| 509 | |
| 510 | In addition to the web user interface and the scripts that start and |
William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame^] | 511 | stop Toaster, command-line commands are available through the ``manage.py`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 512 | management script. You can find general documentation on ``manage.py`` |
| 513 | at the |
| 514 | `Django <https://docs.djangoproject.com/en/2.2/topics/settings/>`__ |
| 515 | site. However, several ``manage.py`` commands have been created that are |
| 516 | specific to Toaster and are used to control configuration and back-end |
| 517 | tasks. You can locate these commands in the |
| 518 | :term:`Source Directory` (e.g. ``poky``) at |
| 519 | ``bitbake/lib/manage.py``. This section documents those commands. |
| 520 | |
| 521 | .. note:: |
| 522 | |
| 523 | - When using ``manage.py`` commands given a default configuration, |
| 524 | you must be sure that your working directory is set to the |
| 525 | :term:`Build Directory`. Using |
| 526 | ``manage.py`` commands from the Build Directory allows Toaster to |
| 527 | find the ``toaster.sqlite`` file, which is located in the Build |
| 528 | Directory. |
| 529 | |
| 530 | - For non-default database configurations, it is possible that you |
| 531 | can use ``manage.py`` commands from a directory other than the |
| 532 | Build Directory. To do so, the ``toastermain/settings.py`` file |
| 533 | must be configured to point to the correct database backend. |
| 534 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 535 | ``buildslist`` |
| 536 | -------------- |
| 537 | |
| 538 | The ``buildslist`` command lists all builds that Toaster has recorded. |
| 539 | Access the command as follows: |
| 540 | |
| 541 | .. code-block:: shell |
| 542 | |
| 543 | $ bitbake/lib/toaster/manage.py buildslist |
| 544 | |
| 545 | The command returns a list, which includes numeric |
| 546 | identifications, of the builds that Toaster has recorded in the current |
| 547 | database. |
| 548 | |
| 549 | You need to run the ``buildslist`` command first to identify existing |
| 550 | builds in the database before using the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 551 | :ref:`toaster-manual/reference:\`\`builddelete\`\`` command. Here is an |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 552 | example that assumes default repository and build directory names: |
| 553 | |
| 554 | .. code-block:: shell |
| 555 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 556 | $ cd poky/build |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 557 | $ python ../bitbake/lib/toaster/manage.py buildslist |
| 558 | |
| 559 | If your Toaster database had only one build, the above |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 560 | :ref:`toaster-manual/reference:\`\`buildslist\`\`` |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 561 | command would return something like the following:: |
| 562 | |
| 563 | 1: qemux86 poky core-image-minimal |
| 564 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 565 | ``builddelete`` |
| 566 | --------------- |
| 567 | |
| 568 | The ``builddelete`` command deletes data associated with a build. Access |
| 569 | the command as follows: |
| 570 | |
| 571 | .. code-block:: |
| 572 | |
| 573 | $ bitbake/lib/toaster/manage.py builddelete build_id |
| 574 | |
| 575 | The command deletes all the build data for the specified |
| 576 | build_id. This command is useful for removing old and unused data from |
| 577 | the database. |
| 578 | |
| 579 | Prior to running the ``builddelete`` command, you need to get the ID |
| 580 | associated with builds by using the |
Andrew Geissler | 09209ee | 2020-12-13 08:44:15 -0600 | [diff] [blame] | 581 | :ref:`toaster-manual/reference:\`\`buildslist\`\`` command. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 582 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 583 | ``perf`` |
| 584 | -------- |
| 585 | |
| 586 | The ``perf`` command measures Toaster performance. Access the command as |
| 587 | follows: |
| 588 | |
| 589 | .. code-block:: shell |
| 590 | |
| 591 | $ bitbake/lib/toaster/manage.py perf |
| 592 | |
| 593 | The command is a sanity check that returns page loading times in order to |
| 594 | identify performance problems. |
| 595 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 596 | ``checksettings`` |
| 597 | ----------------- |
| 598 | |
| 599 | The ``checksettings`` command verifies existing Toaster settings. Access |
| 600 | the command as follows: |
| 601 | |
| 602 | .. code-block:: shell |
| 603 | |
| 604 | $ bitbake/lib/toaster/manage.py checksettings |
| 605 | |
| 606 | Toaster uses settings that are based on the database to configure the |
| 607 | building tasks. The ``checksettings`` command verifies that the database |
| 608 | settings are valid in the sense that they have the minimal information |
| 609 | needed to start a build. |
| 610 | |
| 611 | In order for the ``checksettings`` command to work, the database must be |
| 612 | correctly set up and not have existing data. To be sure the database is |
| 613 | ready, you can run the following: |
| 614 | |
| 615 | .. code-block:: shell |
| 616 | |
| 617 | $ bitbake/lib/toaster/manage.py syncdb |
| 618 | $ bitbake/lib/toaster/manage.py migrate orm |
| 619 | $ bitbake/lib/toaster/manage.py migrate bldcontrol |
| 620 | |
| 621 | After running these commands, you can run the ``checksettings`` command. |
| 622 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 623 | ``runbuilds`` |
| 624 | ------------- |
| 625 | |
| 626 | The ``runbuilds`` command launches scheduled builds. Access the command |
| 627 | as follows: |
| 628 | |
| 629 | .. code-block:: shell |
| 630 | |
| 631 | $ bitbake/lib/toaster/manage.py runbuilds |
| 632 | |
| 633 | The ``runbuilds`` command checks if scheduled builds exist in the database |
| 634 | and then launches them per schedule. The command returns after the builds |
| 635 | start but before they complete. The Toaster Logging Interface records and |
| 636 | updates the database when the builds complete. |