From 38b347f8f2c1d36063db564c6fdf12dd9c0d557a Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 28 Jul 2020 14:58:43 +0200 Subject: [PATCH] [libcalamares] Take ownership of the versioning headers - The sources were in src/calamares but processed and generated in libcalamares, which is weird at best. - Generate an "extended" version header. - Use the extended version in the logger and nowhere else. - While here, minor coding style cleanups The overall change here means that after running CMake, only Logger.cpp needs to be rebuilt (if the extended version has changed) and not a handful of other files that don't need the full version number, but do happen to include CalamaresVersion.h --- src/libcalamares/CMakeLists.txt | 4 +++- .../CalamaresVersion.h.in | 0 .../CalamaresVersionX.h.in | 0 src/libcalamares/utils/Logger.cpp | 14 ++++++-------- 4 files changed, 9 insertions(+), 9 deletions(-) rename src/{calamares => libcalamares}/CalamaresVersion.h.in (100%) rename src/{calamares => libcalamares}/CalamaresVersionX.h.in (100%) diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index 56bacb32a..8e209f8a3 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -27,8 +27,10 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h ) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../calamares/CalamaresVersion.h.in +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersion.h.in ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h ) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresVersionX.h.in + ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersionX.h ) set( OPTIONAL_PRIVATE_LIBRARIES "" ) set( OPTIONAL_PUBLIC_LIBRARIES "" ) diff --git a/src/calamares/CalamaresVersion.h.in b/src/libcalamares/CalamaresVersion.h.in similarity index 100% rename from src/calamares/CalamaresVersion.h.in rename to src/libcalamares/CalamaresVersion.h.in diff --git a/src/calamares/CalamaresVersionX.h.in b/src/libcalamares/CalamaresVersionX.h.in similarity index 100% rename from src/calamares/CalamaresVersionX.h.in rename to src/libcalamares/CalamaresVersionX.h.in diff --git a/src/libcalamares/utils/Logger.cpp b/src/libcalamares/utils/Logger.cpp index 72885d53f..5a2149f44 100644 --- a/src/libcalamares/utils/Logger.cpp +++ b/src/libcalamares/utils/Logger.cpp @@ -3,6 +3,7 @@ * SPDX-FileCopyrightText: 2010-2011 Christian Muehlhaeuser * SPDX-FileCopyrightText: 2014 Teo Mrnjavac * SPDX-FileCopyrightText: 2017 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later * * * Calamares is free software: you can redistribute it and/or modify @@ -18,15 +19,12 @@ * You should have received a copy of the GNU General Public License * along with Calamares. If not, see . * - * SPDX-License-Identifier: GPL-3.0-or-later - * License-Filename: LICENSE - * */ #include "Logger.h" -#include -#include +#include "CalamaresVersionX.h" +#include "utils/Dirs.h" #include #include @@ -35,10 +33,10 @@ #include #include -#include "CalamaresVersion.h" -#include "utils/Dirs.h" +#include +#include -#define LOGFILE_SIZE 1024 * 256 +static constexpr const int LOGFILE_SIZE = 1024 * 256; static std::ofstream logfile; static unsigned int s_threshold =