73
73
'8' : True ,
74
74
'9' : True ,
75
75
},
76
+ 'rocky' : {
77
+ '9' : True ,
78
+ },
76
79
'ubuntu' : {
77
80
'16.04' : False ,
78
81
'18.04' : True ,
@@ -275,6 +278,8 @@ def get_system_revision():
275
278
elif system == 'redhat' :
276
279
system = 'rhel'
277
280
revision = revision [0 ]
281
+ elif system == 'rocky' :
282
+ revision = revision [0 ]
278
283
elif system == 'centos' :
279
284
revision = revision [0 ]
280
285
if not system or not revision :
@@ -290,10 +295,14 @@ def get_system_revision():
290
295
291
296
for i in ['ID' , 'ID_LIKE' ]:
292
297
if i in vals :
293
- system_candidate = vals [i ].strip ('"' )
294
- if system_candidate in SYSTEMS :
295
- system = system_candidate
296
- break
298
+ system_candidates = vals [i ].strip ('"' ).split ()
299
+ for system_candidate in system_candidates :
300
+ if system_candidate in SYSTEMS :
301
+ system = system_candidate
302
+ break
303
+ else :
304
+ continue
305
+ break
297
306
if system is None :
298
307
raise Exception ('cannot determine system' )
299
308
@@ -304,7 +313,7 @@ def get_system_revision():
304
313
if revision is None :
305
314
raise Exception ('cannot determine revision' )
306
315
307
- if system in ['alpine' , 'rhel' ]:
316
+ if system in ['alpine' , 'rhel' , 'rocky' ]:
308
317
revision = revision .rsplit ('.' , 1 )[0 ]
309
318
else :
310
319
raise Exception ('cannot determine system or its revision' )
@@ -496,8 +505,8 @@ def install_pkgs(pkgs, timeout=60, env=None, check_times=False, pkg_cache=None):
496
505
pkg_cache = {}
497
506
498
507
# prepare cache if needed
499
- if not pkg_cache and system in ['centos' , 'rhel' , 'fedora' , 'debian' , 'ubuntu' ]:#, 'alpine']: # TODO: complete caching support for alpine
500
- if system in ['centos' , 'rhel' , 'fedora' ]:
508
+ if not pkg_cache and system in ['centos' , 'rhel' , 'fedora' , 'debian' , 'ubuntu' , 'rocky' ]:#, 'alpine']: # TODO: complete caching support for alpine
509
+ if system in ['centos' , 'rhel' , 'fedora' , 'rocky' ]:
501
510
pkg_cache .update (_prepare_installed_packages_cache_for_rpms ())
502
511
elif system in ['debian' , 'ubuntu' ]:
503
512
pkg_cache .update (_prepare_installed_packages_cache_for_debs ())
@@ -521,7 +530,7 @@ def install_pkgs(pkgs, timeout=60, env=None, check_times=False, pkg_cache=None):
521
530
log .info ('all packages already installed' )
522
531
return
523
532
524
- if system in ['centos' , 'fedora' , 'rhel' ]:
533
+ if system in ['centos' , 'fedora' , 'rhel' , 'rocky' ]:
525
534
if system in ['centos' , 'rhel' ] and revision == '7' :
526
535
execute ('sudo yum install -y dnf' )
527
536
cmd = 'sudo dnf -y install'
@@ -892,7 +901,7 @@ def run_build_and_test(self, tarball_path, jobs, pkg_version, pkg_isc_version, u
892
901
upload_cmd += ' -X POST -H "Content-Type: multipart/form-data" --data-binary "@%s" '
893
902
file_ext = 'deb' # include both '.deb' and '.ddeb' files
894
903
895
- elif self .system in ['fedora' , 'centos' , 'rhel' ]:
904
+ elif self .system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
896
905
upload_cmd += ' --upload-file %s '
897
906
file_ext = '.rpm'
898
907
@@ -1026,7 +1035,7 @@ def prepare_system(self):
1026
1035
1027
1036
# RPM-based distributions install libraries in /usr/local/lib64, but they
1028
1037
# tend to not look there at runtime without explicit mention in ld.so.conf.d.
1029
- if self .system in ['centos' , 'fedora' , 'rhel' ]:
1038
+ if self .system in ['centos' , 'fedora' , 'rhel' , 'rocky' ]:
1030
1039
self .execute ('sudo echo /usr/local/lib64 > /etc/ld.so.conf.d/kea.conf' )
1031
1040
# ldconfig only in case the change above was not there before system startup
1032
1041
self .execute ('sudo ldconfig' )
@@ -1058,7 +1067,7 @@ def prepare_system(self):
1058
1067
log .info ('' )
1059
1068
1060
1069
def prepare_for_boxing (self ):
1061
- if self .system in ['debian' , 'ubuntu' , 'fedora' , 'centos' , 'rhel' ]:
1070
+ if self .system in ['debian' , 'ubuntu' , 'fedora' , 'centos' , 'rhel' , 'rocky' ]:
1062
1071
# setup a script that on first boot will set machine-id
1063
1072
cmd = 'bash -c \' cat <<EOF | sudo tee /usr/lib/systemd/system/systemd-firstboot.service\n '
1064
1073
cmd += '[Unit]\n '
@@ -1107,11 +1116,11 @@ def _install_gtest_sources():
1107
1116
def _install_libyang_from_sources (ignore_errors = False ):
1108
1117
"""Install libyang from sources."""
1109
1118
for prefix in ['/usr' , '/usr/local' ]:
1110
- libyang_so = f'{ prefix } /lib/libyang.so'
1119
+ libyang_so_candidates = [ f'{ prefix } /lib/libyang.so' , f' { prefix } /lib64/libyang.so' ]
1111
1120
libyang_header = f'{ prefix } /include/libyang/version.h'
1112
- if (os .path .exists (libyang_so ) and os .path .exists (libyang_header ) and
1121
+ if (any ( os .path .exists (i ) for i in libyang_so_candidates ) and os .path .exists (libyang_header ) and
1113
1122
execute (f"grep -F '#define LY_VERSION_MAJOR 2' '{ libyang_header } '" , raise_error = False ) == 0 ):
1114
- log .info (f'libyang is already installed at { libyang_so } .' )
1123
+ log .info (f'libyang is already installed at { libyang_header } .' )
1115
1124
return
1116
1125
1117
1126
version = 'v2.1.4'
@@ -1139,11 +1148,11 @@ def _install_libyang_from_sources(ignore_errors = False):
1139
1148
def _install_sysrepo_from_sources (ignore_errors = False ):
1140
1149
"""Install sysrepo from sources."""
1141
1150
for prefix in ['/usr' , '/usr/local' ]:
1142
- sysrepo_so = f'{ prefix } /lib/libsysrepo.so'
1151
+ sysrepo_so_candidates = [ f'{ prefix } /lib/libsysrepo.so' , f' { prefix } /lib64/libsysrepo.so' ]
1143
1152
sysrepo_header = f'{ prefix } /include/sysrepo/version.h'
1144
- if (os .path .exists (sysrepo_so ) and os .path .exists (sysrepo_header ) and
1153
+ if (any ( os .path .exists (i ) for i in sysrepo_so_candidates ) and os .path .exists (sysrepo_header ) and
1145
1154
execute (f"grep -F '#define SR_VERSION_MAJOR 7' '{ sysrepo_header } '" , raise_error = False ) == 0 ):
1146
- log .info (f'sysrepo is already installed at { sysrepo_so } .' )
1155
+ log .info (f'sysrepo is already installed at { sysrepo_header } .' )
1147
1156
return
1148
1157
1149
1158
version = 'v2.2.12'
@@ -1174,9 +1183,9 @@ def _install_sysrepo_from_sources(ignore_errors = False):
1174
1183
1175
1184
def _install_libyang_cpp_from_sources (ignore_errors = False ):
1176
1185
"""Install libyang-cpp from sources."""
1177
- for prefix in ['/usr' , '/usr/local' ]:
1178
- libyang_cpp_so = f'{ prefix } /lib /libyang-cpp.so'
1179
- libyang_cpp_pc = f'{ prefix } /lib /pkgconfig/libyang-cpp.pc'
1186
+ for prefix_lib in ['/usr/lib ' , '/usr/lib64' , '/usr/ local/lib' , '/usr/local/lib64 ' ]:
1187
+ libyang_cpp_so = f'{ prefix_lib } /libyang-cpp.so'
1188
+ libyang_cpp_pc = f'{ prefix_lib } /pkgconfig/libyang-cpp.pc'
1180
1189
if (os .path .exists (libyang_cpp_so ) and os .path .exists (libyang_cpp_pc ) and
1181
1190
execute (f"grep -F 'Version: 1.1.0' '{ libyang_cpp_pc } '" , raise_error = False ) == 0 ):
1182
1191
log .info (f'libyang-cpp is already installed at { libyang_cpp_so } .' )
@@ -1206,9 +1215,9 @@ def _install_libyang_cpp_from_sources(ignore_errors = False):
1206
1215
1207
1216
def _install_sysrepo_cpp_from_sources (ignore_errors = False ):
1208
1217
"""Install sysrepo-cpp from sources."""
1209
- for prefix in ['/usr' , '/usr/local' ]:
1210
- sysrepo_cpp_so = f'{ prefix } /lib /libsysrepo-cpp.so'
1211
- sysrepo_cpp_pc = f'{ prefix } /lib /pkgconfig/sysrepo-cpp.pc'
1218
+ for prefix_lib in ['/usr/lib ' , '/usr/lib64' , '/usr/ local/lib' , '/usr/local/lib64 ' ]:
1219
+ sysrepo_cpp_so = f'{ prefix_lib } /libsysrepo-cpp.so'
1220
+ sysrepo_cpp_pc = f'{ prefix_lib } /pkgconfig/sysrepo-cpp.pc'
1212
1221
if (os .path .exists (sysrepo_cpp_so ) and os .path .exists (sysrepo_cpp_pc ) and
1213
1222
execute (f"grep -F 'Version: 1.1.0' '{ sysrepo_cpp_pc } '" , raise_error = False ) == 0 ):
1214
1223
log .info (f'sysrepo-cpp is already installed at { sysrepo_cpp_so } .' )
@@ -1331,7 +1340,7 @@ def _configure_mysql(system, revision, features):
1331
1340
# For all added files and directories, change owner to mysql.
1332
1341
execute ('sudo chown -R mysql:mysql {} {}' .format (cert_dir , kea_cnf ))
1333
1342
1334
- if system in ['debian' , 'fedora' , 'centos' , 'rhel' ]:
1343
+ if system in ['debian' , 'fedora' , 'centos' , 'rhel' , 'rocky' ]:
1335
1344
execute ('sudo systemctl enable mariadb.service' )
1336
1345
exit_code = execute ('sudo systemctl restart mariadb.service' , raise_error = False )
1337
1346
if exit_code != 0 :
@@ -1476,7 +1485,7 @@ def _configure_pgsql(system, revision, features):
1476
1485
# avoid the error:
1477
1486
# could not change as postgres user directory to "/home/jenkins": Permission denied
1478
1487
1479
- if system in ['fedora' , 'centos' , 'rhel' ]:
1488
+ if system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
1480
1489
# https://fedoraproject.org/wiki/PostgreSQL
1481
1490
exitcode = execute ('sudo ls /var/lib/pgsql/data/postgresql.conf' , raise_error = False )
1482
1491
if exitcode != 0 :
@@ -1589,8 +1598,8 @@ def _get_package_version(package: str):
1589
1598
cmd = "apk search --exact {0} | sed 's/{0}-//g'"
1590
1599
elif system in ['debian' , 'ubuntu' ]:
1591
1600
cmd = "apt-cache show {} | grep -F 'Version:' | cut -d ' ' -f 2"
1592
- elif system in ['centos' , 'fedora' , 'rhel' ]:
1593
- cmd = "dnf list {} | tr -s ' ' | cut -d ' ' -f 2 | tail -n 1"
1601
+ elif system in ['centos' , 'fedora' , 'rhel' , 'rocky' ]:
1602
+ cmd = "dnf list {} -y | tr -s ' ' | cut -d ' ' -f 2 | tail -n 1"
1594
1603
elif system == 'freebsd' :
1595
1604
cmd = "pkg search {0} | grep -Eo '^{0}-[0-9_,\.]+' | sed 's/{0}-//g'"
1596
1605
elif system == 'arch' :
@@ -1791,6 +1800,42 @@ def link_pg_config():
1791
1800
1792
1801
install_pkgs (packages , env = env , timeout = 120 , check_times = check_times )
1793
1802
1803
+ # prepare rocky
1804
+ elif system == 'rocky' :
1805
+ install_pkgs ('epel-release' , env = env , check_times = check_times )
1806
+
1807
+ packages = ['autoconf' , 'automake' , 'bison' , 'boost-devel' , 'flex' , 'gcc-c++' ,
1808
+ 'libtool' , 'log4cplus-devel' , 'make' ,
1809
+ 'openssl-devel' ]
1810
+
1811
+ if 'docs' in features :
1812
+ packages .extend (['python3-sphinx' , 'python3-sphinx_rtd_theme' ])
1813
+
1814
+ if 'native-pkg' in features :
1815
+ packages .extend (['bison' , 'flex' , 'python3-devel' , 'rpm-build' ])
1816
+
1817
+ if 'mysql' in features :
1818
+ packages .extend (['mariadb' , 'mariadb-server' , 'mariadb-connector-c-devel' ])
1819
+
1820
+ if 'pgsql' in features :
1821
+ packages .extend (['postgresql' , 'postgresql-server' , 'postgresql-server-devel' ])
1822
+
1823
+ if 'gssapi' in features :
1824
+ packages .extend (['krb5-devel' ])
1825
+
1826
+ if 'ccache' in features :
1827
+ packages .extend (['ccache' ])
1828
+
1829
+ if 'netconf' in features :
1830
+ packages .extend (['cmake' , 'git' , 'pcre2-devel' ])
1831
+
1832
+ if 'unittest' in features :
1833
+ packages .append ('wget' )
1834
+ deferred_functions .append (_install_gtest_sources )
1835
+
1836
+ execute ('sudo dnf config-manager --set-enabled crb' )
1837
+ install_pkgs (packages , env = env , timeout = 120 , check_times = check_times )
1838
+
1794
1839
# prepare ubuntu
1795
1840
elif system == 'ubuntu' :
1796
1841
_apt_update (system , revision , env = env , check_times = check_times , attempts = 3 , sleep_time_after_attempt = 10 )
@@ -2037,7 +2082,7 @@ def _prepare_ccache_if_needed(system, ccache_dir, env):
2037
2082
if ccache_dir is not None :
2038
2083
if system in ['debian' , 'ubuntu' ]:
2039
2084
ccache_bin_path = '/usr/lib/ccache/'
2040
- elif system in ['centos' , 'rhel' , 'fedora' ]:
2085
+ elif system in ['centos' , 'rhel' , 'fedora' , 'rocky' ]:
2041
2086
ccache_bin_path = '/usr/lib64/ccache'
2042
2087
env ['CC' ] = 'ccache gcc'
2043
2088
env ['CXX' ] = 'ccache g++'
@@ -2071,7 +2116,7 @@ def _build_binaries_and_run_ut(system, revision, features, tarball_path, env, ch
2071
2116
cmd += ' --with-pgsql'
2072
2117
if 'unittest' in features :
2073
2118
# prepare gtest switch - use downloaded gtest sources only if it is not present as native package
2074
- if system in ['centos' , 'fedora' , 'rhel' , 'freebsd' , 'alpine' ]:
2119
+ if system in ['centos' , 'fedora' , 'rhel' , 'freebsd' , 'alpine' , 'rocky' ]:
2075
2120
cmd += ' --with-gtest-source=/usr/src/googletest-release-1.10.0/googletest/'
2076
2121
elif system == 'debian' and revision == '8' :
2077
2122
cmd += ' --with-gtest-source=/usr/src/googletest-release-1.10.0/googletest/'
@@ -2390,7 +2435,7 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times
2390
2435
repo_url = _get_full_repo_url (repository_url , system , revision , pkg_version )
2391
2436
assert repo_url is not None
2392
2437
2393
- if system in ['fedora' , 'centos' , 'rhel' ]:
2438
+ if system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
2394
2439
_build_rpm (system , revision , features , tarball_path , env , check_times , dry_run ,
2395
2440
pkg_version , pkg_isc_version , repo_url )
2396
2441
@@ -2411,7 +2456,7 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times
2411
2456
if system in ['ubuntu' , 'debian' ]:
2412
2457
execute ('mv kea-src/isc-kea_* %s' % pkgs_dir )
2413
2458
execute ('mv kea-src/*deb %s' % pkgs_dir )
2414
- elif system in ['fedora' , 'centos' , 'rhel' ]:
2459
+ elif system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
2415
2460
execute ('mv pkgs/* %s' % pkgs_dir )
2416
2461
elif system in ['alpine' ]:
2417
2462
# Don't move files if the source and the target locations are the same.
@@ -2529,7 +2574,7 @@ def ssh(provider, system, revision):
2529
2574
2530
2575
def _install_vagrant (ver = RECOMMENDED_VAGRANT_VERSION , upgrade = False ):
2531
2576
system , _ = get_system_revision ()
2532
- if system in ['fedora' , 'centos' , 'rhel' ]:
2577
+ if system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
2533
2578
if upgrade :
2534
2579
execute ('sudo yum remove -y vagrant' )
2535
2580
execute ('mkdir -p ~/.hammer-tmp' )
@@ -2960,7 +3005,7 @@ def upload_to_repo(args, pkgs_dir):
2960
3005
upload_cmd += ' -X POST -H "Content-Type: multipart/form-data" --data-binary "@%s" '
2961
3006
file_ext = 'deb' # include both '.deb' and '.ddeb' files
2962
3007
2963
- elif system in ['fedora' , 'centos' , 'rhel' ]:
3008
+ elif system in ['fedora' , 'centos' , 'rhel' , 'rocky' ]:
2964
3009
upload_cmd += ' --upload-file %s '
2965
3010
file_ext = '.rpm'
2966
3011
0 commit comments