parent
4fccaa40d7
commit
2eca4875cd
@ -1,25 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(build-packages CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
|
||||
|
||||
add_library(common SHARED common.cpp)
|
||||
target_link_libraries(common yaml-cpp)
|
||||
|
||||
add_library(update_maintainer SHARED update_maintainer.cpp)
|
||||
|
||||
add_executable(build-packages main.cpp)
|
||||
target_link_libraries(build-packages common update_maintainer PkgConfig::LIBGIT2 yaml-cpp)
|
||||
|
||||
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
|
||||
install(TARGETS common LIBRARY DESTINATION lib)
|
||||
install(TARGETS update_maintainer LIBRARY DESTINATION lib)
|
||||
install(TARGETS build-packages RUNTIME DESTINATION .)
|
@ -1,10 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
|
||||
std::string parse_version(const std::filesystem::path &changelog_path);
|
||||
void run_command(const std::vector<std::string> &cmd, const std::optional<std::filesystem::path> &cwd = std::nullopt, bool show_output=false);
|
||||
void clean_old_logs(const std::filesystem::path &log_dir, int max_age_seconds=86400);
|
||||
void create_tarball(const std::string &name, const std::filesystem::path &source_dir, const std::vector<std::string> &exclusions);
|
@ -1,4 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
void update_maintainer(const std::string &debian_directory, bool verbose=false);
|
@ -0,0 +1,75 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(lubuntuci CXX)
|
||||
|
||||
# Set C++ standard
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Specify output directories
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
# Find required packages
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(LIBGIT2 REQUIRED IMPORTED_TARGET libgit2)
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
# Locate Launchpadlib
|
||||
# Assuming Launchpadlib is installed in /srv/lubuntu-ci/repos/ci-tools/lib/
|
||||
# Adjust the path if necessary
|
||||
find_library(LAUNCHPADLIB_LIB NAMES launchpadlib liblaunchpad REQUIRED PATHS /srv/lubuntu-ci/repos/ci-tools/lib/ NO_DEFAULT_PATH)
|
||||
if(NOT LAUNCHPADLIB_LIB)
|
||||
message(FATAL_ERROR "launchpadlib not found")
|
||||
endif()
|
||||
|
||||
# Include directories for Launchpadlib
|
||||
include_directories(/srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
|
||||
|
||||
# Create the shared library liblubuntuci.so
|
||||
add_library(lubuntuci SHARED common.cpp utilities.cpp)
|
||||
target_include_directories(lubuntuci PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(lubuntuci PRIVATE yaml-cpp)
|
||||
|
||||
# Ensure liblubuntuci has proper RPATH
|
||||
set_target_properties(lubuntuci PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH TRUE
|
||||
INSTALL_RPATH "$ORIGIN/lib"
|
||||
)
|
||||
|
||||
# build-packages executable
|
||||
add_executable(build-packages build-packages.cpp)
|
||||
target_link_libraries(build-packages PRIVATE lubuntuci PkgConfig::LIBGIT2 yaml-cpp ${LIBGIT2_LIBRARIES} ${YAML_CPP_LIBRARIES} ${LAUNCHPADLIB_LIB})
|
||||
|
||||
# fetch-indexes executable
|
||||
add_executable(fetch-indexes fetch-indexes.cpp utilities.cpp)
|
||||
target_include_directories(fetch-indexes PRIVATE ${CURL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
|
||||
target_link_libraries(fetch-indexes PRIVATE lubuntuci CURL::libcurl ZLIB::ZLIB yaml-cpp ${LAUNCHPADLIB_LIB})
|
||||
|
||||
# update-maintainer executable
|
||||
add_executable(update-maintainer update-maintainer.cpp)
|
||||
# Link only necessary libraries, avoiding liblubuntuci
|
||||
target_include_directories(update-maintainer PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} /srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
|
||||
target_link_libraries(update-maintainer PRIVATE yaml-cpp ${LAUNCHPADLIB_LIB})
|
||||
|
||||
# Ensure executables have proper RPATH
|
||||
set_target_properties(build-packages fetch-indexes update-maintainer PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH TRUE
|
||||
INSTALL_RPATH "$ORIGIN/lib"
|
||||
)
|
||||
|
||||
# Install targets
|
||||
install(TARGETS lubuntuci
|
||||
LIBRARY DESTINATION lib
|
||||
)
|
||||
|
||||
install(TARGETS build-packages fetch-indexes update-maintainer
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
# Install headers
|
||||
install(FILES common.h update-maintainer.h utilities.h
|
||||
DESTINATION include/lubuntuci
|
||||
)
|
@ -1,3 +1,18 @@
|
||||
// Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include "common.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
#include <optional>
|
||||
|
||||
std::string parse_version(const std::filesystem::path &changelog_path);
|
||||
void run_command(const std::vector<std::string> &cmd, const std::optional<std::filesystem::path> &cwd = std::nullopt, bool show_output=false);
|
||||
void clean_old_logs(const std::filesystem::path &log_dir, int max_age_seconds=86400);
|
||||
void create_tarball(const std::string &name, const std::filesystem::path &source_dir, const std::vector<std::string> &exclusions);
|
@ -0,0 +1,19 @@
|
||||
// Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
void update_maintainer(const std::string &debian_directory, bool verbose=false);
|
@ -1,17 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(fetch-indexes)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(YAML-CPP REQUIRED)
|
||||
include_directories(${CURL_INCLUDE_DIRS})
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
include_directories(${YAML_CPP_INCLUDE_DIR})
|
||||
include_directories(/srv/lubuntu-ci/repos/ci-tools/include/launchpadlib-cpp)
|
||||
|
||||
add_executable(fetch-indexes main.cpp utilities.cpp)
|
||||
|
||||
target_link_libraries(fetch-indexes ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} yaml-cpp /srv/lubuntu-ci/repos/ci-tools/lib/liblaunchpad.so)
|
Loading…
Reference in new issue