Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metadata to drop more #427

Merged
merged 1 commit into from
Nov 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 19 additions & 13 deletions bin/clean-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ import os
import json

# Note range is exclusive so the last number is not in the list
UNSUPPORTED_EL = {str(i) for i in range(3, 6)}
UNSUPPORTED = {
'CentOS': [str(i) for i in range(3, 6)],
'Debian': [str(i) for i in range(3, 8)],
'Fedora': [str(i) for i in range(3, 25)],
'RedHat': [str(i) for i in range(3, 5)],
'CentOS': UNSUPPORTED_EL,
'Debian': {str(i) for i in range(3, 8)},
'Fedora': {str(i) for i in range(3, 25)},
'OracleLinux': UNSUPPORTED_EL,
'RedHat': UNSUPPORTED_EL,
'SLED': {'9', '10'},
'SLES': {'9', '10'},
'Scientific': UNSUPPORTED_EL,
'Ubuntu': {str(i) + m for i in range(4, 17) for m in ('.04', '.10')} - {'14.04', '16.04'},
}

Expand All @@ -22,15 +27,16 @@ for mod in os.listdir('modules'):
updated = False

for operatingsystem in metadata.get('operatingsystem_support', []):
for release in UNSUPPORTED.get(operatingsystem['operatingsystem'], []):
try:
index = operatingsystem['operatingsystemrelease'].index(release)
except (KeyError, ValueError):
pass
else:
print('Removing {}-{}'.format(operatingsystem['operatingsystem'], release))
del operatingsystem['operatingsystemrelease'][index]
updated = True
releases = set(operatingsystem.get('operatingsystemrelease', []))
for release in releases & UNSUPPORTED.get(operatingsystem['operatingsystem'], set()):
print('Removing {}-{}'.format(operatingsystem['operatingsystem'], release))
operatingsystem['operatingsystemrelease'].remove(release)
updated = True

if operatingsystem.get('operatingsystemrelease') == []:
print('Removing {}'.format(operatingsystem['operatingsystem']))
metadata['operatingsystem_support'].remove(operatingsystem)
updated = True

if updated:
print('Writing {}'.format(filename))
Expand Down