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