| 1 |
.. _building-build-with-profiles: |
| 2 |
|
| 3 |
Building Images with Profiles |
| 4 |
============================= |
| 5 |
|
| 6 |
{kiwi} supports so-called *profiles* inside the XML image description. Profiles |
| 7 |
act as namespaces for additional settings to be applied on top of the |
| 8 |
defaults. For further details, see :ref:`image-profiles`. |
| 9 |
|
| 10 |
|
| 11 |
Local Builds |
| 12 |
------------ |
| 13 |
|
| 14 |
To execute local {kiwi} builds with a specific, selected profile, add the |
| 15 |
command line flag `--profile=$PROFILE_NAME`: |
| 16 |
|
| 17 |
.. code:: shell-session |
| 18 |
|
| 19 |
$ sudo kiwi-ng --type oem --profile libvirt system build \ |
| 20 |
--description kiwi/build-tests/{exc_description_vagrant} \ |
| 21 |
--set-repo {exc_repo_leap} \ |
| 22 |
--target-dir /tmp/myimage |
| 23 |
|
| 24 |
Consult the manual page of :file:`kiwi` for further details: |
| 25 |
:ref:`db_commands_kiwi_synopsis`. |
| 26 |
|
| 27 |
|
| 28 |
Building with the Open Build Service |
| 29 |
------------------------------------ |
| 30 |
|
| 31 |
The Open Build Service (OBS) supports profiles via the `multibuild |
| 32 |
<https://openbuildservice.org/help/manuals/obs-user-guide/cha.obs.multibuild.html>`_ |
| 33 |
feature. |
| 34 |
|
| 35 |
To enable and use the profiles, follow these steps: |
| 36 |
|
| 37 |
#. Add the following XML comment to your :file:`config.xml`: |
| 38 |
|
| 39 |
.. code:: xml |
| 40 |
|
| 41 |
<!-- OBS-Profiles: @BUILD_FLAVOR@ --> |
| 42 |
|
| 43 |
It must be added before the opening `<image>` element and after the |
| 44 |
`<?xml?>` element, e.g.: |
| 45 |
|
| 46 |
.. code:: xml |
| 47 |
|
| 48 |
<?xml version="1.0" encoding="utf-8"?> |
| 49 |
<!-- OBS-Profiles: @BUILD_FLAVOR@ --> |
| 50 |
<image schemaversion="{schema_version}" name="{exc_image_base_name_vagrant}"> |
| 51 |
<!-- snip --> |
| 52 |
</image> |
| 53 |
|
| 54 |
#. Add a file :file:`_multibuild` into your package's repository with the |
| 55 |
following contents: |
| 56 |
|
| 57 |
.. code:: xml |
| 58 |
|
| 59 |
<multibuild> |
| 60 |
<flavor>profile_1</flavor> |
| 61 |
<flavor>profile_2</flavor> |
| 62 |
</multibuild> |
| 63 |
|
| 64 |
Add a line ``<flavor>$PROFILE</flavor>`` for each profile that |
| 65 |
you want OBS to build. |
| 66 |
|
| 67 |
|
| 68 |
Note that, by default, OBS excludes the build **without** any profile |
| 69 |
enabled. |
| 70 |
|
| 71 |
Running a build of a multibuild-enabled repository via :file:`osc` can be |
| 72 |
achieved via the `-M $PROFILE` flag: |
| 73 |
|
| 74 |
.. code:: shell-session |
| 75 |
|
| 76 |
$ osc build -M $PROFILE |