| |
@@ -763,27 +763,46 @@
|
| |
"""
|
| |
# Extract any digits in the branch name to determine the EL version
|
| |
version = ''.join([i for i in branch if re.match(r'\d', i)])
|
| |
- url = f'https://infrastructure.fedoraproject.org/repo/json/pkg_el{version}.json'
|
| |
- rv = requests_wrapper(
|
| |
- url, timeout=60, service_name='infrastructure.fedoraproject.org')
|
| |
- rv_json = get_request_json(rv, 'getting the list of official EL packages')
|
| |
- # Remove noarch from this because noarch is treated specially
|
| |
- all_arches = set(rv_json['arches']) - set(['noarch'])
|
| |
- # On EL6, also remove ppc and i386 as many packages will
|
| |
- # have these arches missing and cause false positives
|
| |
- if int(version) == 6:
|
| |
- all_arches = all_arches - set(['ppc', 'i386'])
|
| |
- # On EL7 and later, also remove ppc and i686 as many packages will
|
| |
- # have these arches missing and cause false positives
|
| |
- elif int(version) >= 7:
|
| |
- all_arches = all_arches - set(['ppc', 'i686'])
|
| |
- for pkg_name, pkg_info in rv_json['packages'].items():
|
| |
- # If the EL package is noarch only or is available on all supported
|
| |
- # arches, then don't allow an EPEL branch
|
| |
- if pkg_name == name:
|
| |
- pkg_arches = set(pkg_info['arch'])
|
| |
- if pkg_arches == set(['noarch']) or not (all_arches - pkg_arches):
|
| |
- return False
|
| |
+
|
| |
+ # Starting with epel9 and epel9-next, check against CentOS compose metadata.
|
| |
+ if int(version) >= 9:
|
| |
+ # Currently we only have a latest symlink. In the future we'll need
|
| |
+ # separate latest symlinks that include the major version.
|
| |
+ # https://bugzilla.redhat.com/show_bug.cgi?id=2005139
|
| |
+ url = 'https://composes.stream.centos.org/production/latest-CentOS-Stream/compose/metadata/rpms.json'
|
| |
+ rv = requests_wrapper(url, timeout=60, service_name='composes.stream.centos.org')
|
| |
+ rv_json = get_request_json(rv, 'getting the list of official EL packages')
|
| |
+ pkg_names = {
|
| |
+ # convert name-epoch:version-release.arch key to just the name
|
| |
+ nevra.rsplit('.', maxsplit=1)[0].rsplit('-', maxsplit=2)[0]
|
| |
+ # only packages from these repos are forbidden in epel
|
| |
+ for repo in ['BaseOS', 'AppStream', 'CRB']
|
| |
+ for arch in rv_json['payload']['rpms'][repo].keys()
|
| |
+ for nevra in rv_json['payload']['rpms'][repo][arch].keys()
|
| |
+ }
|
| |
+ if name in pkg_names:
|
| |
+ return False
|
| |
+ else:
|
| |
+ url = f'https://infrastructure.fedoraproject.org/repo/json/pkg_el{version}.json'
|
| |
+ rv = requests_wrapper(url, timeout=60, service_name='infrastructure.fedoraproject.org')
|
| |
+ rv_json = get_request_json(rv, 'getting the list of official EL packages')
|
| |
+ # Remove noarch from this because noarch is treated specially
|
| |
+ all_arches = set(rv_json['arches']) - set(['noarch'])
|
| |
+ # On EL6, also remove ppc and i386 as many packages will
|
| |
+ # have these arches missing and cause false positives
|
| |
+ if int(version) == 6:
|
| |
+ all_arches = all_arches - set(['ppc', 'i386'])
|
| |
+ # On EL7 and later, also remove ppc and i686 as many packages will
|
| |
+ # have these arches missing and cause false positives
|
| |
+ elif int(version) >= 7:
|
| |
+ all_arches = all_arches - set(['ppc', 'i686'])
|
| |
+ for pkg_name, pkg_info in rv_json['packages'].items():
|
| |
+ # If the EL package is noarch only or is available on all supported
|
| |
+ # arches, then don't allow an EPEL branch
|
| |
+ if pkg_name == name:
|
| |
+ pkg_arches = set(pkg_info['arch'])
|
| |
+ if pkg_arches == set(['noarch']) or not (all_arches - pkg_arches):
|
| |
+ return False
|
| |
return True
|
| |
|
| |
|
| |