Skip to content

Commit e5cc54e

Browse files
committed
fallbacks & non-serializable set() fix
1 parent 4a049fb commit e5cc54e

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

rpmbuild/copr_rpmbuild/extract_specfile_tags.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Extract macro-expanded tag value (e.g., BuildArch) from given specfile.
33
"""
44

5+
import logging
56
import os
67
import tempfile
8+
79
from copr_common.request import SafeRequest
8-
import logging
910

1011
from norpm.macrofile import system_macro_registry
1112
from norpm.specfile import specfile_expand, ParserHooks
@@ -14,6 +15,17 @@
1415

1516
DEFAULT_OVERRIDE_URL = "https://raw.githubusercontent.com/praiskup/norpm-macro-overrides/refs/heads/main/distro-arch-specific.json"
1617

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+
1729
class _TagHooks(ParserHooks):
1830
""" Gather access to spec tags """
1931
def __init__(self, expanded_tags):
@@ -44,7 +56,7 @@ def collapse_tag_values_cb(array_of_tag_values):
4456
set: A set of all unique strings extracted from the tag definitions.
4557
"""
4658
concat = " ".join(array_of_tag_values)
47-
return set(concat.split())
59+
return list(set(concat.split()))
4860

4961

5062
def extract_tags_from_specfile(specfile, extract_tags, override_database=None,
@@ -121,10 +133,7 @@ def get_architecture_specific_tags(specfile, extract_tags, targets,
121133

122134
try:
123135
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)
128137
log.info("Extracting arch-specific tags for %s", distro)
129138
architecture_tags[distro] = extract_tags_from_specfile(
130139
specfile,

0 commit comments

Comments
 (0)