RFE: distro release/version specific packaging
It's convenient to have shared packaging sources across compatible distros as seen in Knot DNS and Knot Resolver and opposed to having a separate branch for each distro release as seen downstream, especially because we support many different distros so we'd need to maintain same files across tens of branches otherwise.
However, fine-tuning for a specific distro release or version is sometimes required for example here and also Knot DNS requested ability to provide different service files for older distros including different source package layout.
distro-based templating
apkg
already supports templating of packaging files through jinja2
as well as distro detection so distro information should be made available from templates to allow distro release/version conditionals such as:
{% if distro.name is 'Ubuntu' and distro.version is '16.04' %}
echo 'code specific for Ubuntu 16.04'
{% endif %}
distro-based template selection
Providing distro info in templates should be sufficient for small diffs but in case of entirely different files and even source package layout it's preferable to have multiple different templates in distro/pkg
, for example:
project
└── distro
└── pkg
├── deb <- default tempalte for debian-based systems
├── debian-9 <- template for Debian 9 Stretch
└── ubuntu-16.04 <- template for Ubuntu 16.04 Xenial Xerus
A mechanism to properly map distro to appropriate template is needed. I'll start with a simple prefix matching and see if anything more complicated is required.
TODO
-
create a stable interface for distro info (probably new class ApkgDistro
) -
make distro info available in templates -
implement a generic mechanism to select templates from distro/pkg/*
based on distro