diff --git a/module_build_service/scheduler/default_modules.py b/module_build_service/scheduler/default_modules.py index 0e984eea..71038d87 100644 --- a/module_build_service/scheduler/default_modules.py +++ b/module_build_service/scheduler/default_modules.py @@ -355,8 +355,11 @@ def _get_rpms_in_external_repo(repo_url, arches, cache_dir_name): # Add a separate repo for each architecture for arch in arches: - repo_name = "repo_{}".format(arch) - repo_arch_url = repo_url.replace("$arch", arch) + # Convert arch to canon_arch. This handles cases where Koji "i686" arch is mapped to + # "i386" when generating RPM repository. + canon_arch = koji.canonArch(arch) + repo_name = "repo_{}".format(canon_arch) + repo_arch_url = repo_url.replace("$arch", canon_arch) base.repos.add_new_repo(repo_name, dnf_conf, baseurl=[repo_arch_url]) # Load one repo at a time instead of running `base.update_cache()` so that we know which # repo fails to load if one does diff --git a/tests/test_scheduler/test_default_modules.py b/tests/test_scheduler/test_default_modules.py index cae70b94..4462a723 100644 --- a/tests/test_scheduler/test_default_modules.py +++ b/tests/test_scheduler/test_default_modules.py @@ -398,10 +398,12 @@ def test_get_rpms_in_external_repo(mock_makedirs, mock_dnf_base): RPM("aarch64", 0, "python", "1.el8", "3.7"), RPM("x86_64", 0, "python", "1.el8", "2.7"), RPM("x86_64", 0, "python", "1.el8", "3.7"), + RPM("i686", 0, "python", "1.el8", "2.7"), + RPM("i686", 0, "python", "1.el8", "3.7"), ] external_repo_url = "http://domain.local/repo/latest/$arch/" - arches = ["aarch64", "x86_64"] + arches = ["aarch64", "x86_64", "i686"] cache_dir_name = "module-el-build-12" rv = default_modules._get_rpms_in_external_repo(external_repo_url, arches, cache_dir_name) @@ -410,9 +412,16 @@ def test_get_rpms_in_external_repo(mock_makedirs, mock_dnf_base): "python-0:3.7-1.el8.aarch64", "python-0:2.7-1.el8.x86_64", "python-0:3.7-1.el8.x86_64", + "python-0:2.7-1.el8.i686", + "python-0:3.7-1.el8.i686", } assert rv == expected + # Test that i686 is mapped to i386 using the koji.canonArch(). + mock_dnf_base.return_value.repos.add_new_repo.assert_called_with( + 'repo_i386', mock_dnf_base.return_value.conf, + baseurl=['http://domain.local/repo/latest/i386/']) + def test_get_rpms_in_external_repo_invalid_repo_url(): """