3.5 KiB
How to work with package aliases
A pacakge alias is a "flavour" of a package that can substitute a normal package. For example, "ext_qt" package may have multiple flavours, like "ext_qt-debug", "ext_qt-asan" or "ext_qt-quickcontrols2". The main requirement for a package flavour is full binary compatibility with the original package. That is, packages depending on the original package much be able to consume a flavour package without full recompilation.
We use package flavours for several purposes:
- provide a debugging versions of a package (or ASAN-capable)
- build a package with a different set of flags, needed for a specific merge request
Create a flavour of a package
Imagine we would like to create a flavour of a Qt package. To implement that we need to do the follwoing:
- Add a CMake option in
ext_qt/CMakeLists.txt. Make sure that the option is disabled by default.
if (QT_ENABLE_MY_OPTION)
# TODO: do something that changes the build process of Qt
endif ()
- Create a separate folder for your flavour of the package (
ext_qt-myoption) and add a special.kde-ci-override.ymlfile with the follwoing content:
Options:
cmake-options: "-DQT_ENABLE_MY_OPTION=ON"
-
Create metadata for the new package flavour:
-
Copy
repo-metadata/projects-invent/base/qtfolder intorepo-metadata/projects-invent/base/qt-myoption -
Edit
metadata.ymlany replace allqtintoqt-myoption -
Make sure that
repopathis also changes, since this field is used as a unique key by the scripts internally -
Add line
reuse-directory: ext_qtto make sure the project reuses the recipe of the main packageWhen package is being built, the build script will copy the content of
ext_qtintoext_qt-myoptionand apply the cahnges from.kde-ci-override.ymlto.kde-ci.yml, which was copied from the original project.
-
-
Add the package flavour to
latest/developer-packages.ymlseed file, to make sure it is rebuilt on full rebuilds. -
Build the newly added package:
-
Open the pipeline job
custom_publish_<platform>(click on the name, not on the "start" button) -
On the job's page set the job input:
- input:
KRITA_STAGE_DEP - value:
base/qt-myoption
- input:
-
Start the job
-
Connect the package flavour to the Krita build
After the package flavour has been built, you need to instruct Krita to deploy it during the build process.
-
Open
.kde-ci.ymlfile in Krita repository -
Add the alias statement to substiture
ext_qtpackage with your custom flavourext_qt-myoption:
PackageAliases:
ext_qt: ext_qt-myoption
- Save and push into your branch/MR. All CI jobs will now use
ext_qt-myoptionpackage when building your MR.
Note on paltform-specific flavours
If your flavour is available only on a specifc platform, you can add it via declaring an environment variable in the corresponding jobs in .gitlab-ci.yml file in Krita repository:
.windows-build-base:
variables:
KDECI_PACKAGE_ALIASES_YAML: "{ ext_qt : ext_qt-myoption }"
Though this method it not recommended, since it makes it difficult to reproduce the environment locally.
Note on merging package flavours into master
Please do not merge flavoured packaged into master! It may break development environment for people and create a lot of troubles for people, who are not familiar with the changes. Make sure that all your changes are merged into "mainstream" package before the MR is merged into master.