# Import shared settings from pungi_general.conf
from pungi_general import *
# Import multilib settings from pungi_multilib.conf
from pungi_multilib import *

# PRODUCT INFO
skip_phases = ["buildinstall", "extra_files"]
release_version = '[[ release.version_int ]]'
release_type = 'updates[% if request.name == 'testing' %]-testing[% endif %]'
old_composes_per_release_type = True
release_name = '[[ release.id_prefix.title() ]]'
release_short = '[[ release.id_prefix.title() ]]'

# GENERAL SETTINGS
comps_file = {
    'scm': 'git',
    'repo': 'https://pagure.io/fedora-comps.git',
    'branch': 'main', # defaults to cvs/HEAD or git/main
    'file': 'comps-[[ release.branch ]].xml',
    'command': 'make',
}
variants_file='variants.xml'
sigkeys = [
[% if release.version_int == 38 %]
    'eb10b464',
[% elif release.version_int == 39 %]
    '18B8e74c',
[% elif release.version_int == 40 %]
    'a15B79cc',
[% elif release.version_int == 41 %]
    'e99d6ad1',
[% elif release.version_int == 6 %]
    '0608b895',
[% elif release.version_int == 7 %]
    '352C64E5',
[% elif release.version_int == 8 %]
    '2f86d6a1'
[% elif release.version_int == 9 %]
    '3228467c',
[% endif %]
{% if env == "staging" %}
    None
{% endif %}
]
comps_filter_environments = False

# RUNROOT settings
runroot = True
runroot_channel = 'compose'
runroot_tag = 'f[[ release.version_int ]]-build'

# PKGSET
pkgset_koji_tag = '[[ id ]]'
pkgset_koji_inherit = False
pkgset_allow_reuse = False

# GATHER
gather_method = 'deps'
gather_backend = 'dnf'
check_deps = False
repoclosure_backend = 'dnf'

# CREATEREPO
[% if cr_config.drpms_enabled %]
createrepo_deltas = [
    ('^Everything$', {'*': True})
]
[% else %]
createrepo_deltas = [
    ('^Everything$', {'*': False})
]
[% endif %]
createrepo_database = True
createrepo_extra_args = [
[% if cr_config.zchunk %]
    '--zck', '--zck-dict-dir=/usr/share/fedora-repo-zdicts/f[[ release.version_int ]]',
[% endif %]
[% if cr_config.repodata_comp %]
[% if cr_config.general_comp %]
    '--general-compress-type=[[ cr_config.repodata_comp ]]',
[% else %]
    '--compress-type=[[ cr_config.repodata_comp ]]',
[% endif %]
[% endif %]
]

# CHECKSUMS
media_checksums = ['sha256']
media_checksum_one_file = True
media_checksum_base_filename = 'Fedora-%(variant)s-%(version)s-%(date)s.%(respin)s-%(arch)s'
#jigdo
create_jigdo = False

additional_packages = [
    ('^Everything$', {
        '*': [
            '*',
            '*-debuginfo',
        ],
    }),
]
multilib = [
    ('^Everything$', {
        'x86_64': ['devel', 'runtime'],
         's390x': ['devel', 'runtime']
    })
]
filter_packages = []

createiso_skip = [
        ('^Everything$', {
            '*': True,
            'src': True
        }),
    ]

{# repo block used by every image #}
{% set repos = '[
                [% if request.name == "testing" %]
                    [# In the case of testing, also inject the last stable updates #]
                    "https://kojipkgs{{ env_suffix }}.fedoraproject.org/compose/updates/f[[ release.version_int ]]-updates/compose/Everything/$basearch/os/",
                [% endif %]
                [% if release.version_int == 41 %]
                    [# For F41 the compose location is going to be under /compose/branched/ #]
                    "https://kojipkgs{{ env_suffix }}.fedoraproject.org/compose/branched/latest-Fedora-[[ release.version_int ]]/compose/Everything/$basearch/os/"
                [% else %]
                    "https://kojipkgs{{ env_suffix }}.fedoraproject.org/compose/[[ release.version_int ]]/latest-Fedora-[[ release.version_int ]]/compose/Everything/$basearch/os/"
                [% endif %]
            ]' %}

[% if request.name == 'stable' %]
    [% set ostreeref = 'updates' %]
[% else %]
    [% set ostreeref = 'testing' %]
[% endif %]

{% if env != "staging" %}
[% if release.id_prefix == 'FEDORA' %]
ostree = {
    "^Silverblue$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        [% if release.version_int >= 39 %]
        "unified_core": True,
        "runroot_packages": ["selinux-policy-targeted"],
        [% endif %]
        "treefile": "fedora-silverblue.yaml",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "ostree_repo": "/mnt/koji/compose/ostree/repo",
        "ostree_ref": "fedora/[[ release.version_int ]]/${basearch}/[[ ostreeref ]]/silverblue",
        "tag_ref": False,
        "arches": ["x86_64", "ppc64le", "aarch64" ],
        "failable": ["x86_64", "ppc64le", "aarch64" ]
    },
    "^Kinoite$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        [% if release.version_int >= 39 %]
        "unified_core": True,
        "runroot_packages": ["selinux-policy-targeted"],
        [% endif %]
        "treefile": "fedora-kinoite.yaml",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "ostree_repo": "/mnt/koji/compose/ostree/repo",
        "ostree_ref": "fedora/[[ release.version_int ]]/${basearch}/[[ ostreeref ]]/kinoite",
        "tag_ref": False,
        "arches": ["x86_64", "ppc64le", "aarch64" ],
        "failable": ["x86_64", "ppc64le", "aarch64" ]
    },
    "^Sericea$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        [% if release.version_int >= 39 %]
        "unified_core": True,
        "runroot_packages": ["selinux-policy-targeted"],
        [% endif %]
        "treefile": "fedora-sericea.yaml",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "ostree_repo": "/mnt/koji/compose/ostree/repo",
        "ostree_ref": "fedora/[[ release.version_int ]]/${basearch}/[[ ostreeref ]]/sericea",
        "tag_ref": False,
        "arches": ["x86_64", "aarch64"],
        "failable": ["x86_64", "aarch64"]
    },
    [% if release.version_int >= 39 %]
    "^Onyx$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        "unified_core": True,
        "runroot_packages": ["selinux-policy-targeted"],
        "treefile": "fedora-onyx.yaml",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "ostree_repo": "/mnt/koji/compose/ostree/repo",
        "ostree_ref": "fedora/[[ release.version_int ]]/${basearch}/[[ ostreeref ]]/onyx",
        "tag_ref": False,
        "arches": ["x86_64"],
        "failable": ["x86_64"]
    },
    [% endif %]
}
[% if release.version_int >= 40 %]
ostree_container = {
    "^Silverblue$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "treefile": "fedora-silverblue.yaml",
        "arches": ["x86_64", "ppc64le", "aarch64"],
        "failable": ['*'],
    },
    "^Kinoite$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "treefile": "fedora-kinoite.yaml",
        "arches": ["x86_64", "ppc64le", "aarch64"],
        "failable": ['*'],
    },
    "^Sericea$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "treefile": "fedora-sericea.yaml",
        "arches": ["x86_64", "aarch64"],
        "failable": ['*'],
    },
    "^Onyx$": {
        "version": "!VERSION_FROM_VERSION_DATE_RESPIN",
        "config_url": "https://pagure.io/workstation-ostree-config.git",
        "config_branch": "f[[ release.version ]]",
        "repo": {{ repos }},
        "treefile": "fedora-onyx.yaml",
        "arches": ["x86_64"],
        "failable": ['*'],
    },
}
[% endif %]
[% endif %]

{% endif %}

translate_paths = [
   ('/mnt/koji/compose/', 'https://kojipkgs{{ env_suffix }}.fedoraproject.org/compose/'),
]
koji_profile = 'bodhi_koji'
link_type = 'hardlink-or-copy'
