File: build_config.py

package info (click to toggle)
argparse-manpage 4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 536 kB
  • sloc: python: 2,755; makefile: 47; sh: 18
file content (48 lines) | stat: -rw-r--r-- 1,067 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# coding: utf-8

from jinja2 import Environment

template_string = """\
# This is development/testing only mock profile, not exactly the same as
# is used on copr builders;  but it is basically similar.  If you need an
# exact mock configuration (because you e.g. try to reproduce failed
# build), such configuration is put alongside the built RPMs.

include('/etc/mock/{{chroot}}.cfg')

config_opts['root'] = '{{project_id}}_{{chroot}}'
config_opts['chroot_additional_packages'] = '
{%- for pkg in additional_packages -%}
{%- if loop.last -%}
{{ pkg }}
{%- else -%}
{{ pkg }} {% endif -%}
{%- endfor -%}'

{% if repos %}
config_opts['yum.conf'] += \"\"\"
{% for repo in repos %}
[{{ repo.id }}]
name="{{ repo.name }}"
baseurl={{ repo.url }}
gpgcheck=0
enabled=1
skip_if_unavailable=1
metadata_expire=0
cost=1
best=1
{% endfor %}
\"\"\"
{% endif %}
"""

class MockProfile(object):
    def __init__(self, data):
        self.data = data

    def __str__(self):
        template = Environment().from_string(template_string)
        return template.render(self.data)