refactor: normalize passing distro and other template vars
Currently, distro
and other template vars are passed manually around which is error-prone, for example rendering a template that uses
{% if distro.match('foo') %}
without passing distro
results in
E jinja2.exceptions.UndefinedError: 'str object' has no attribute 'match'
Furthermore, #77 / !111 (closed) requires distro
check at pkgstyle function level (rpm.get_template_name()
) where it's not really available.
Refactor distro
and other template vars passing so that:
-
tvars are always available during template render -
tvars are easily accessible to consumers of a template -
tvars are set in one place only (or in as few as makes sense)