Toaster database: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
[[Category:Toaster]]
[[Category:Toaster]]
[[File:Toaster_orm_graph.png|thumb|ORM diagram]]
[[File:Toaster_orm_graph.png|thumb|ORM diagram]]
Toaster Uses [https://docs.djangoproject.com/en/dev/topics/db/models/ Django and it's [https://en.wikipedia.org/wiki/Object-relational_mapping ORM] for database interaction.]
Toaster Uses [https://docs.djangoproject.com/en/dev/topics/db/models/ Django and it's [https://en.wikipedia.org/wiki/Object-relational_mapping ORM] for database interaction.


The database table/model definitions can be found in the [http://cgit.openembedded.org/bitbake/tree/lib/toaster/orm/models.py orm/models.py] file.
The database table/model definitions can be found in the [http://cgit.openembedded.org/bitbake/tree/lib/toaster/orm/models.py orm/models.py] file.
Line 9: Line 9:


=== Build data ===
=== Build data ===
Build data is Layers, Layer_Versions, Recipes, Machines, Packages, Dependencies and all other objects that are output by a build. '''Once it is created it is never edited or updated'''. Unless deleted by the user.
Build data is Layers, Layer_Versions, Recipes, Machines, Packages, Dependencies and all other objects that are output by running a build of a recipe. '''Once it is created it is never edited or updated'''. Unless deleted by the user.


=== Configuration data ===
=== Configuration data ===
Configuration data is data which is provided to configure an openembedded based project, again this is stored as Layers, Layer_Versions, Recipes, Machines etc.
Configuration data is data which is provided by Toaster to configure an openembedded based project in Toaster, like Build data this is stored as Layers, Layer_Versions, Recipes and Machines etc. The configuration data can be produced by fetching it from the [http://layers.openembedded.org Layer Index] (the toaster start up script attempts to do this for you at first run) from importing information from the toasterconf.json file, importing Layer definitions into Projects via the Import layer page and also from running a build.
 


=== Project data ===  
=== Project data ===  
Line 42: Line 43:


This is a special kind of Recipe which has two additional fields; base_recipe and project. base_recipe is the Recipe in which the Custom recipe has been based on and will translate to the 'required' recipe to inherit recipe metadata from and project because this custom recipe belongs to a certain project that has been created.
This is a special kind of Recipe which has two additional fields; base_recipe and project. base_recipe is the Recipe in which the Custom recipe has been based on and will translate to the 'required' recipe to inherit recipe metadata from and project because this custom recipe belongs to a certain project that has been created.
== Package ==
A Package is the representation of packages produced by a Recipe when it has been built. Package data is almost always Build data since we don't know about packages until they have been produced. The exception is when the package data is used as configuration data to Customise a recipe by adding and removing known packages.
Package N - Recipe 1


== Target ==
== Target ==


When you build a recipe a Target object is created which contains the Recipe name, Build object for the build data and the Task that you're asking bitbake to do (default is build the recipe).
When you build a recipe a Target object is created which contains the Recipe name, Build object for the build data to go into and the Task that you're asking bitbake to do (default is build the recipe).

Revision as of 11:54, 6 November 2015

ORM diagram

Toaster Uses Django and it's [https://en.wikipedia.org/wiki/Object-relational_mapping ORM for database interaction.

The database table/model definitions can be found in the orm/models.py file. We also have additional models defined for the build controller, these generally the 'behind the scene' way to translate toaster information into the build controller process.

Categories of data in Toaster

Build data

Build data is Layers, Layer_Versions, Recipes, Machines, Packages, Dependencies and all other objects that are output by running a build of a recipe. Once it is created it is never edited or updated. Unless deleted by the user.

Configuration data

Configuration data is data which is provided by Toaster to configure an openembedded based project in Toaster, like Build data this is stored as Layers, Layer_Versions, Recipes and Machines etc. The configuration data can be produced by fetching it from the Layer Index (the toaster start up script attempts to do this for you at first run) from importing information from the toasterconf.json file, importing Layer definitions into Projects via the Import layer page and also from running a build.


Project data

Some data is designated project specific, such as user imported Layer, CustomImageRecipe, Project variables and Builds.

Top level objects

There are many intermediate tables in Toaster's database, see diagram. Below are the most top level objects on which everything else depends.

Layer and Layer_Version

A Layer_Version is the object in which most other objects relate to in Toaster. Every Layer_Version belongs to a Layer object which contains the common metadata for each 'version' or revision of the Layer.

An example would be that we have a Layer called 'meta-openembedded' which has 3 Layer_Versions; one Layer_Version which is set to the release 'dizzy' one on 'fido' and one on 'master' (in most cases these correspond to git branch names)

Layer 1 - N Layer_Version Layer_Version 1 - N Recipe

Recipe

Recipes contain the information about a collection or particular piece of software. This can be the name, version and description and what distribution packages are created by the recipe. Layer_Versions are the containers of recipes and Recipes are the containers of packages.

When a recipe that belongs to a Layer_Version is built the build property for the Layer_Version is set. When this is set this object is considered part of the "build history" and should never be changed or edited after this point. When the Build is not set this data is considered configuration data i.e. data which is used to configure a project using the openembedded metadata. An example of such data is data that has come from the openembedded Layer index or an imported layer.


Recipe N - 1 Layer_Version Recipe 1 - N Package

CustomImageRecipe

This is a special kind of Recipe which has two additional fields; base_recipe and project. base_recipe is the Recipe in which the Custom recipe has been based on and will translate to the 'required' recipe to inherit recipe metadata from and project because this custom recipe belongs to a certain project that has been created.

Package

A Package is the representation of packages produced by a Recipe when it has been built. Package data is almost always Build data since we don't know about packages until they have been produced. The exception is when the package data is used as configuration data to Customise a recipe by adding and removing known packages.

Package N - Recipe 1

Target

When you build a recipe a Target object is created which contains the Recipe name, Build object for the build data to go into and the Task that you're asking bitbake to do (default is build the recipe).