From: Andrei Pavel Date: Wed, 3 Nov 2021 18:08:46 +0000 (+0200) Subject: [#2112] hammer.py: support for Arch Linux X-Git-Tag: Kea-2.1.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feb04cd86e31c73061facf5a97f935fd410c8f0b;p=thirdparty%2Fkea.git [#2112] hammer.py: support for Arch Linux --- diff --git a/hammer.py b/hammer.py index dc5a7ec24f..2aeae005d3 100755 --- a/hammer.py +++ b/hammer.py @@ -81,7 +81,8 @@ SYSTEMS = { '3.11', '3.12', '3.13', - ] + ], + 'arch': [] } # pylint: disable=C0326 @@ -248,8 +249,21 @@ def get_system_revision(): if '=' in l: key, val = l.split('=', 1) vals[key.strip()] = val.strip() - system = vals['ID'] - revision = vals['VERSION_ID'] + + for i in ['ID', 'ID_LIKE']: + if i in vals and vals[i] in SYSTEMS: + system = vals[i] + break + if system is None: + raise Exception('cannot determine system') + + for i in ['VERSION_ID', 'BUILD_ID']: + if i in vals: + revision = vals[i] + break + if revision is None: + raise Exception('cannot determine revision') + if system == 'alpine': revision = revision.rsplit('.', 1)[0] else: @@ -261,7 +275,10 @@ def get_system_revision(): revision = revision.replace('"', '') if '"' in system: system = system.replace('"', '') - return system.lower(), revision + + system = system.lower() + print('Running on:', system, revision) + return system, revision class ExecutionError(Exception): @@ -467,6 +484,8 @@ def install_pkgs(pkgs, timeout=60, env=None, check_times=False, pkg_cache={}): cmd = 'sudo pkg install -y' elif system == 'alpine': cmd = 'sudo apk add' + elif system == 'arch': + cmd = 'sudo pacman -S --needed --noconfirm --overwrite \'*\'' else: raise NotImplementedError('no implementation for %s' % system) @@ -1362,7 +1381,7 @@ def _install_freeradius_client(system, revision, features, env, check_times): install_pkgs('nettle-devel', env=env, check_times=check_times) elif system in ['alpine', 'debian', 'ubuntu']: install_pkgs('nettle-dev', env=env, check_times=check_times) - elif system in ['freebsd']: + elif system in ['arch', 'freebsd']: install_pkgs('nettle', env=env, check_times=check_times) else: raise NotImplementedError('no implementation for %s' % system) @@ -1815,6 +1834,13 @@ def prepare_system_local(features, check_times): else: execute('sudo adduser %s abuild' % current_user) + elif system == 'arch': + if 'netconf' in features: + deferred_functions.extend([ + _install_libyang_from_sources, + _install_sysrepo_from_sources, + ]) + else: raise NotImplementedError('no implementation for %s' % system) @@ -1911,6 +1937,8 @@ def _build_binaries_and_run_ut(system, revision, features, tarball_path, env, ch cmd += ' --with-gtest-source=/usr/src/googletest-release-1.10.0/googletest/' else: cmd += ' --with-gtest-source=/usr/src/googletest/googletest' + elif system == 'arch': + pass else: raise NotImplementedError('no implementation for %s' % system) if 'docs' in features and not (system == 'rhel' and revision == '8'): @@ -2270,6 +2298,9 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times _build_alpine_apk(system, revision, features, tarball_path, env, check_times, dry_run, pkg_version, pkg_isc_version, repo_url) + elif system in ['arch']: + pass + else: raise NotImplementedError('no implementation for %s' % system) @@ -2282,6 +2313,8 @@ def _build_native_pkg(system, revision, features, tarball_path, env, check_times elif system in ['alpine']: #execute('mv kea-src/* %s' % pkgs_dir) execute('mv kea-pkg/* %s' % pkgs_dir) + elif system in ['arch']: + pass else: raise NotImplementedError('no implementation for %s' % self.system) @@ -2410,6 +2443,8 @@ def _install_vagrant(ver=RECOMMENDED_VAGRANT_VERSION, upgrade=False): execute(cmd) execute('sudo dpkg -i /tmp/%s' % deb) os.unlink('/tmp/%s' % deb) + elif system in ['arch']: + pass else: # TODO: check for packages here: https://www.vagrantup.com/downloads.html raise NotImplementedError('no implementation for %s' % system)