2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 09:57:41 +00:00

[#2969] fix prepare-system in hammer.py

- fixes this error:

```
$ ./hammer.py prepare-system -p local -s fedora -r 36 -w all
  File "hammer.py", line 3031, in _check_system_revision
    msg = msg % (revision, "', '".join(revs))
TypeError: sequence item 0: expected str instance, tuple found
```

- also marks CentOS, FreeBSD 12, and Alpine 3.15 as unsupported
This commit is contained in:
Andrei Pavel 2023-11-06 12:59:08 +02:00
parent 81843f6f2d
commit cafead21a9
No known key found for this signature in database
GPG Key ID: D4E804481939CB21

132
hammer.py
View File

@ -50,65 +50,65 @@ import xml.etree.ElementTree as ET
# ... # ...
# } # }
SYSTEMS = { SYSTEMS = {
'fedora': [ 'fedora': {
( '27', False ), '27': False,
( '28', False ), '28': False,
( '29', False ), '29': False,
( '30', False ), '30': False,
( '31', False ), '31': False,
( '32', False ), '32': False,
( '33', False ), '33': False,
( '34', False ), '34': False,
( '35', False ), '35': False,
( '36', False ), '36': False,
( '37', True ), '37': True,
( '38', True ), '38': True,
], },
'centos': [ 'centos': {
( '7', False ), '7': False,
( '8', True ), '8': False,
( '9', True ), '9': False,
], },
'rhel': [ 'rhel': {
( '8', True ), '8': True,
( '9', True ), '9': True,
], },
'ubuntu': [ 'ubuntu': {
( '16.04', False ), '16.04': False,
( '18.04', True ), '18.04': True,
( '18.10', False ), '18.10': False,
( '19.04', False ), '19.04': False,
( '19.10', False ), '19.10': False,
( '20.04', True ), '20.04': True,
( '20.10', False ), '20.10': False,
( '21.04', False ), '21.04': False,
( '22.04', True ), '22.04': True,
], },
'debian': [ 'debian': {
( '8', False ), '8': False,
( '9', False ), '9': False,
( '10', True ), '10': True,
( '11', True ), '11': True,
( '12', True ), '12': True,
], },
'freebsd': [ 'freebsd': {
( '11.2', False ), '11.2': False,
( '11.4', False ), '11.4': False,
( '12.0', True ), '12.0': False,
( '12.1', True ), '12.1': False,
( '13.0', True ), '13.0': True,
], },
'alpine': [ 'alpine': {
( '3.10', False ), '3.10': False,
( '3.11', False ), '3.11': False,
( '3.12', False ), '3.12': False,
( '3.13', False ), '3.13': False,
( '3.14', False ), '3.14': False,
( '3.15', True ), '3.15': False,
( '3.16', True ), '3.16': True,
( '3.17', True ), '3.17': True,
], },
'arch': [] 'arch': {}
} }
# pylint: disable=C0326 # pylint: disable=C0326
@ -2990,12 +2990,20 @@ def _print_summary(results, features):
def _check_system_revision(system, revision): def _check_system_revision(system, revision):
if revision == 'all': if revision == 'all':
return return
revs = SYSTEMS[system] if system not in SYSTEMS.keys():
msg = "hammer.py error: argument -s/--system: invalid choice: '%s' (choose from '%s')"
msg = msg % (revision, "', '".join(SYSTEMS.keys()))
log.error(msg)
sys.exit(1)
revs = SYSTEMS[system].keys()
if revision not in revs: if revision not in revs:
msg = "hammer.py error: argument -r/--revision: invalid choice: '%s' (choose from '%s')" msg = "hammer.py error: argument -r/--revision: invalid choice: '%s' (choose from '%s')"
msg = msg % (revision, "', '".join(revs)) msg = msg % (revision, "', '".join(revs))
print(msg) log.error(msg)
sys.exit(1) sys.exit(1)
if not SYSTEMS[system][revision]:
log.warning(f'{system} ${revision} is no longer officially supported. ' \
'The script will continue in a best-effort manner.')
def _prepare_ccache_dir(ccache_dir, system, revision): def _prepare_ccache_dir(ccache_dir, system, revision):
@ -3123,7 +3131,7 @@ def build_cmd(args):
for provider in providers: for provider in providers:
for system in systems: for system in systems:
if args.revision == 'all': if args.revision == 'all':
revisions = SYSTEMS[system] revisions = SYSTEMS[system].keys()
else: else:
revisions = [args.revision] revisions = [args.revision]