On RHEL using PostgresSQL from the PGSQL repo, the path can differ.#2146
On RHEL using PostgresSQL from the PGSQL repo, the path can differ.#2146tuxmaster5000 wants to merge 1 commit intobareos:masterfrom
Conversation
|
At least if we want to consider this, there's a missing pg-17 version in the list, and how do you want to manage that list dynamically without to rebuild each time PG will get release and retired ? changing onhold, nobuild label saving resource for the time of lowering the queue. |
|
I had first tried it with the asterisk as in the first entry. But that is not recognised by cmake. |
| PG_CTL | ||
| NAMES pg_ctl pg_ctl.exe | ||
| PATHS /usr/lib/postgresql/*/bin /usr/bin /bin REQUIRED | ||
| PATHS /usr/lib/postgresql/*/bin /usr/bin /bin /usr/pgsql-16/bin /usr/pgsql-15/bin /usr/pgsql-14/bin /usr/pgsql-13/bin /usr/pgsql-12/bin REQUIRED |
There was a problem hiding this comment.
as far as I can tell the proper solution for this is to first find_package(PostgreSQL). This should set PostgreSQL_FOUND, PostgreSQL_ROOT_DIRECTORIES and PostgreSQL_KNOWN_VERSIONS.
You can then, based on what FindPostgreSQL.cmake does, do
foreach(suffix ${PostgreSQL_KNOWN_VERSIONS})
if(WIN32)
list(APPEND PostgreSQL_PROGRAM_ADDITIONAL_SEARCH_SUFFIXES
"PostgreSQL/${suffix}/bin")
endif()
if(UNIX)
list(APPEND PostgreSQL_PROGRAM_ADDITIONAL_SEARCH_SUFFIXES
"postgresql${suffix}"
"postgresql@${suffix}"
"pgsql-${suffix}/bin")
endif()
endforeach()
and finally use find_program like this:
find_program(
PG_CTL
NAMES pg_ctl pg_ctl.exe
PATHS
# Look in other places.
${PostgreSQL_ROOT_DIRECTORIES}
PATH_SUFFIXES
postgresql
postgresql/bin
${PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES}
REQUIRED
)
However, if you don't need or don't want to run the postgresql systemtests, maybe it would be easier to not require this per se, but to disable the systemtests that rely on it if it is not present.
|
I stumbled across it because somehow the tests are always tried to be built when cmake is called. Since I mainly build this as an RPM package, I don't really need the tests. But somehow I'm too stupid to build it without the tests. |
|
I don't think there is a flag for this yet, but basically and then just put an You could then run cmake with |
|
Yes I will create an PR for it. The tests are only disables by default when not building the binaries. |
|
I have created one, which can make this obsolete. |
|
@tuxmaster5000 if this is obsolete, can i close this pr ? |
|
@sebsura , yes because without the tests, the problem does not exist. |
When using PosgresSQL from the official repos of postgresql.org, the path on RHEL can differ.
I think an back port to bareos 24 are also needed.
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality
Tests