|
2 | 2 | Extract macro-expanded tag value (e.g., BuildArch) from given specfile. |
3 | 3 | """ |
4 | 4 |
|
| 5 | +import logging |
5 | 6 | import os |
6 | 7 | import tempfile |
| 8 | + |
7 | 9 | from copr_common.request import SafeRequest |
8 | | -import logging |
9 | 10 |
|
10 | 11 | from norpm.macrofile import system_macro_registry |
11 | 12 | from norpm.specfile import specfile_expand, ParserHooks |
|
14 | 15 |
|
15 | 16 | DEFAULT_OVERRIDE_URL = "https://raw.githubusercontent.com/praiskup/norpm-macro-overrides/refs/heads/main/distro-arch-specific.json" |
16 | 17 |
|
| 18 | +DEFAULT_TAG_MAP = { |
| 19 | + # TODO: extract rhel+epel into the datafile |
| 20 | + "epel-7": "rhel-7", |
| 21 | + "epel-8": "rhel-8", |
| 22 | + "epel-9": "rhel-9", |
| 23 | + "epel-10": "centos-stream+epel-10", |
| 24 | + # what do we do about custom-* chroots? |
| 25 | + "custom-0": "fedora-rawhide", |
| 26 | + "custom-1": "fedora-rawhide", |
| 27 | +} |
| 28 | + |
17 | 29 | class _TagHooks(ParserHooks): |
18 | 30 | """ Gather access to spec tags """ |
19 | 31 | def __init__(self, expanded_tags): |
@@ -44,7 +56,7 @@ def collapse_tag_values_cb(array_of_tag_values): |
44 | 56 | set: A set of all unique strings extracted from the tag definitions. |
45 | 57 | """ |
46 | 58 | concat = " ".join(array_of_tag_values) |
47 | | - return set(concat.split()) |
| 59 | + return list(set(concat.split())) |
48 | 60 |
|
49 | 61 |
|
50 | 62 | def extract_tags_from_specfile(specfile, extract_tags, override_database=None, |
@@ -121,10 +133,7 @@ def get_architecture_specific_tags(specfile, extract_tags, targets, |
121 | 133 |
|
122 | 134 | try: |
123 | 135 | for distro in targets: |
124 | | - ask = distro |
125 | | - if distro.startswith("custom-"): |
126 | | - # TODO: what do we do about custom-* chroots? |
127 | | - ask = "fedora-rawhide" |
| 136 | + ask = DEFAULT_TAG_MAP.get(distro, distro) |
128 | 137 | log.info("Extracting arch-specific tags for %s", distro) |
129 | 138 | architecture_tags[distro] = extract_tags_from_specfile( |
130 | 139 | specfile, |
|
0 commit comments