Skip to content

Commit

Permalink
cmake: fix default database driver setting
Browse files Browse the repository at this point in the history
The default database driver is now got from the configured
database options. To set the placeholder there, the
default_db_backend cmake variable needs to be set during build via

  -Ddefault_db_backend="XXX_REPLACE_WITH_DATABASE_DRIVER_XXX"
  • Loading branch information
pstorz committed Jul 13, 2020
1 parent 2d40cce commit 54bb56f
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/CMakeLists.txt
Expand Up @@ -794,6 +794,7 @@ message(" Statically Linked SD: ${support_static_sd} ")
message(" Statically Linked DIR: ${support_static_dir} ")
message(" Statically Linked CONS: ${support_static_cons} ")
message(" Database backends: ${db_backends} ")
message(" default_db_backend: ${default_db_backend} ")
message(" Database port: ${db_port} ")
message(" Database name: ${db_name} ")
message(" Database user: ${db_user} ")
Expand Down
6 changes: 4 additions & 2 deletions core/cmake/BareosSetVariableDefaults.cmake
Expand Up @@ -522,8 +522,10 @@ if(NOT client-only)
list(APPEND db_backends mysql)
endif()

# set first entry as default db backend
list(GET db_backends 0 default_db_backend)
if (NOT DEFINED default_db_backend)
# set first entry as default db backend if not already defined
list(GET db_backends 0 default_db_backend)
endif()
get_directory_property(hasParent PARENT_DIRECTORY)
if(hasParent)
set(DEFAULT_DB_TYPE ${default_db_backend} PARENT_SCOPE)
Expand Down
1 change: 1 addition & 0 deletions core/debian/rules
Expand Up @@ -77,6 +77,7 @@ define CONFIGURE_COMMON
-Dhostname="XXX_REPLACE_WITH_LOCAL_HOSTNAME_XXX" \
-Dincludes=yes \
-Drpath=no \
-Ddefault_db_backend="XXX_REPLACE_WITH_DATABASE_DRIVER_XXX" \
-DVERSION_STRING=$(BAREOS_VERSION)
endef

Expand Down
Expand Up @@ -129,6 +129,7 @@ CMAKE_ARGS+= -DCMAKE_VERBOSE_MAKEFILE=ON \
-Dsd-group=$(STORAGE_DAEMON_GROUP) \
-Dfd-user=$(FILE_DAEMON_USER) \
-Dfd-group=$(DAEMON_GROUP) \
-Ddefault_db_backend="XXX_REPLACE_WITH_DATABASE_DRIVER_XXX" \
-DVERSION_STRING=$(DISTVERSION)

post-install:
Expand Down
1 change: 1 addition & 0 deletions core/platforms/packaging/bareos.spec
Expand Up @@ -915,6 +915,7 @@ cmake .. \
-Dsystemd=yes \
%endif
-Dincludes=yes \
-Ddefault_db_backend="XXX_REPLACE_WITH_DATABASE_DRIVER_XXX" \
-DVERSION_STRING=%version

#Add flags
Expand Down
@@ -1,7 +1,7 @@
Catalog {
Name = MyCatalog
# dbdriver = "@DEFAULT_DB_TYPE@"
dbdriver = "XXX_REPLACE_WITH_DATABASE_DRIVER_XXX"
dbdriver = "@DEFAULT_DB_TYPE@"
# dbdriver = "XXX_REPLACE_WITH_DATABASE_DRIVER_XXX"
dbname = "@db_name@"
dbuser = "@db_user@"
dbpassword = "@db_password@"
Expand Down
1 change: 1 addition & 0 deletions regress/scripts/regress-config.in
Expand Up @@ -69,6 +69,7 @@ else
-Ddynamic-cats-backends=yes \
-Ddynamic-storage-backends=yes \
${TRAYMON}\
-Ddefault_db_backend="XXX_REPLACE_WITH_DATABASE_DRIVER_XXX" \
${VERSION_STRING}

fi
Expand Down

0 comments on commit 54bb56f

Please sign in to comment.