Skip to content

Commit

Permalink
cmake: generate debian data to binary dir
Browse files Browse the repository at this point in the history
Instead of just generating all the files for the debian build into the
debian directory, we now generate them into CMAKE_BINARY_DIR and only
copy them when the generate-debian-control target is built (that already
regenerates the main control file).
  • Loading branch information
arogge authored and BareosBot committed Mar 12, 2024
1 parent ce8eb3a commit 84668bd
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 60 deletions.
55 changes: 0 additions & 55 deletions .gitignore
Expand Up @@ -15,58 +15,3 @@ webui/tests/regress/webui-bsock-connection-test
webui/tests/regress/webui-bsock-connection-test-tls
webui/tests/regress/webui-bsock-connection-test-tls.php
webui/version.php

# Ignore files created by core/cmake/BareosConfigureFile.cmake
# can be regenerated by running the following command:
# find debian/ core/src/defaultconfigs -name '*.in' -print | sed -e 's/\.in$//' | sort
debian/bareos-bconsole.install
debian/bareos-bconsole.postinst
debian/bareos-common.install
debian/bareos-common.postinst
debian/bareos-common.preinst
debian/bareos-contrib-director-python-plugins.install
debian/bareos-contrib-filedaemon-python-plugins.install
debian/bareos-database-common.config
debian/bareos-database-common.install
debian/bareos-database-common.postinst
debian/bareos-database-postgresql.dirs
debian/bareos-database-postgresql.install
debian/bareos-database-tools.install
debian/bareos-database-tools.postinst
debian/bareos-director.install
debian/bareos-director.postinst
debian/bareos-director.preinst
debian/bareos-director-python3-plugin.install
debian/bareos-director-python-plugins-common.install
debian/bareos-director.service
debian/bareos-filedaemon-glusterfs-plugin.install
debian/bareos-filedaemon.install
debian/bareos-filedaemon-ldap-python-plugin.install
debian/bareos-filedaemon-libcloud-python-plugin.install
debian/bareos-filedaemon-mariabackup-python-plugin.install
debian/bareos-filedaemon-percona-xtrabackup-python-plugin.install
debian/bareos-filedaemon-postgresql-python-plugin.install
debian/bareos-filedaemon.postinst
debian/bareos-filedaemon.preinst
debian/bareos-filedaemon-python3-plugin.install
debian/bareos-filedaemon-python-plugins-common.install
debian/bareos-filedaemon.service
debian/bareos-storage-droplet.install
debian/bareos-storage-fifo.install
debian/bareos-storage-glusterfs.install
debian/bareos-storage.install
debian/bareos-storage.postinst
debian/bareos-storage.preinst
debian/bareos-storage-python3-plugin.install
debian/bareos-storage-python-plugins-common.install
debian/bareos-storage.service
debian/bareos-storage-tape.install
debian/bareos-storage-tape.postinst
debian/bareos-tools.install
debian/bareos-tools.postinst
debian/bareos-traymonitor.install
debian/bareos-traymonitor.postinst
debian/bareos-universal-client.install
debian/bareos-universal-client.postinst
debian/bareos-universal-client.preinst
debian/univention-bareos.postinst
6 changes: 5 additions & 1 deletion cmake/BareosConfigureFile.cmake
Expand Up @@ -21,7 +21,7 @@
# to its template or into the corresponding CMAKE_CURRENT_BINARY_DIR

function(bareos_configure_file)
cmake_parse_arguments(ARG "IN_TREE;COPY" "" "FILES;GLOB_RECURSE" ${ARGN})
cmake_parse_arguments(ARG "IN_TREE;COPY" "" "FILES;GLOB;GLOB_RECURSE" ${ARGN})
set(file_list "")
if(ARG_FILES)
list(APPEND file_list ${ARG_FILES})
Expand All @@ -31,6 +31,10 @@ function(bareos_configure_file)
file(GLOB_RECURSE glob_lst ${ARG_GLOB_RECURSE})
list(APPEND file_list ${glob_lst})
endif()
if(ARG_GLOB)
file(GLOB glob_lst ${ARG_GLOB})
list(APPEND file_list ${glob_lst})
endif()
foreach(in_file ${file_list})
if(ARG_IN_TREE)
set(out_file "${in_file}")
Expand Down
2 changes: 0 additions & 2 deletions core/CMakeLists.txt
Expand Up @@ -728,8 +728,6 @@ else()
endif()

include(BareosConfigureFile)
bareos_configure_file(GLOB_RECURSE "${CMAKE_SOURCE_DIR}/debian/*.in" IN_TREE)

bareos_configure_file(
GLOB_RECURSE "${CMAKE_CURRENT_SOURCE_DIR}/src/defaultconfigs/*" COPY
)
Expand Down
12 changes: 11 additions & 1 deletion core/cmake/BareosGenerateDebianInfo.cmake
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2018-2023 Bareos GmbH & Co. KG
# Copyright (C) 2018-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -97,6 +97,16 @@ else()

endif()

include(BareosConfigureFile)
bareos_configure_file(GLOB "${CMAKE_SOURCE_DIR}/debian/*.in")

file(GLOB templated_file_path_list "${CMAKE_BINARY_DIR}/debian/*")
set(DEBIAN_TEMPLATED_FILE_LIST "")
foreach(templated_file_path ${templated_file_path_list})
get_filename_component(templated_file ${templated_file_path} NAME)
list(APPEND DEBIAN_TEMPLATED_FILE_LIST "${templated_file}")
endforeach()

configure_file(
${CMAKE_SOURCE_DIR}/core/cmake/generate-debian-control.cmake.in
${CMAKE_BINARY_DIR}/generate-debian-control.cmake @ONLY
Expand Down
8 changes: 7 additions & 1 deletion core/cmake/generate-debian-control.cmake.in
@@ -1,6 +1,6 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2021-2021 Bareos GmbH & Co. KG
# Copyright (C) 2021-2024 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
Expand Down Expand Up @@ -35,3 +35,9 @@ foreach(snippet @DEBIAN_CONTROL_SNIPPETS@)
file(READ "control.${snippet}" content)
file(APPEND control "${content}\n\n")
endforeach()

set(SRC_DIR @CMAKE_BINARY_DIR@/debian)
set(DST_DIR @CMAKE_SOURCE_DIR@/debian)
foreach(templated_file @DEBIAN_TEMPLATED_FILE_LIST@)
file(COPY "${SRC_DIR}/${templated_file}" DESTINATION "${DST_DIR}")
endforeach()

0 comments on commit 84668bd

Please sign in to comment.