mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 18:08:16 +00:00
[#3470] hammer: install postgresql only if not already installed
This commit is contained in:
parent
dffb0d7baa
commit
04bd5f616f
24
hammer.py
24
hammer.py
@ -1956,14 +1956,22 @@ def install_packages_local(system, revision, features, check_times, ignore_error
|
|||||||
packages.extend(['mysql80-server', 'mysql80-client'])
|
packages.extend(['mysql80-server', 'mysql80-client'])
|
||||||
|
|
||||||
if 'pgsql' in features:
|
if 'pgsql' in features:
|
||||||
# Install the latest postgresql-client and postgresql-server.
|
# Install the latest postgresql-client and postgresql-server,
|
||||||
_, output = execute("pkg search postgresql | grep -E 'postgresql[0-9]+-client' | tail -n 1 | "
|
# unless any postgresql-client or postgresql-server version is already installed.
|
||||||
"cut -d ' ' -f 1 | cut -d '-' -f 1-2", capture=True)
|
for i in ['client', 'server']:
|
||||||
postgresql_client = output.strip()
|
# Check if already installed.
|
||||||
_, output = execute("pkg search postgresql | grep -E 'postgresql[0-9]+-server' | tail -n 1 | "
|
_, output = execute('pkg info', capture=True)
|
||||||
"cut -d ' ' -f 1 | cut -d '-' -f 1-2", capture=True)
|
m = re.search(f'postgresql[0-9]+-{i}', output)
|
||||||
postgresql_server = output.strip()
|
if m is None:
|
||||||
packages.extend([postgresql_client, postgresql_server])
|
# If not, go ahead and install.
|
||||||
|
_, output = execute('pkg search postgresql', capture=True)
|
||||||
|
found = re.findall(f'postgresql[0-9]+-{i}', output)
|
||||||
|
if len(found) == 0:
|
||||||
|
print(f'No postgresql[0-9]+-{i} found?')
|
||||||
|
sys.exit(1)
|
||||||
|
# There may be more matches. Results are sorted by pkg.
|
||||||
|
# Choose the last from the list which should be the latest version.
|
||||||
|
packages.append(found[-1])
|
||||||
|
|
||||||
if 'gssapi' in features:
|
if 'gssapi' in features:
|
||||||
packages.extend(['krb5-devel'])
|
packages.extend(['krb5-devel'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user