From cc8bea5554973a85f56c5533d8e78ede1445ac77 Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Tue, 22 Aug 2023 21:35:38 +0200 Subject: [PATCH] fix CI and COPR (#60) * fix GitHub actions CI by fixing the version of Conan (otherwise Conan 2.0 would be picked up -- and we're not ready yet) and black * fix COPR builds for centos-7/8/9 and fedora up to 38; fedora 39 is failing due to presence of Python 3.12 having the "imp" module deprecated (and that's needed by Conan 1.xx) --- .github/workflows/main.yml | 4 +++- collector/spec/collector.spec | 14 +++++++++----- collector/src/Makefile | 6 +++--- collector/src/fast_file_reader.h | 1 + collector/src/logger.h | 1 + conanfile.txt | 2 ++ 6 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65a2bfa8..0af85f96 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,8 +15,10 @@ jobs: - uses: actions/checkout@v2 - name: install debian-packaged dependencies run: sudo apt install -y libgtest-dev libbenchmark-dev libfmt-dev tidy git python3 python3-dateutil python3-pip + + # NOTE: prometheus-cpp & its dependencies wants at least Conan 1.51.0 - name: install pypi-packaged dependencies - run: sudo pip3 install pytest black conan + run: sudo pip3 install pytest 'black==22.8.0' 'conan==1.60.2' # NOTE: since we later run "make" using the normal "builder" user, we must use Conan using that same user (so avoid the "sudo"!!) - name: install Conan-packaged dependencies diff --git a/collector/spec/collector.spec b/collector/spec/collector.spec index d3986779..f635e2b9 100644 --- a/collector/spec/collector.spec +++ b/collector/spec/collector.spec @@ -17,12 +17,15 @@ Requires: fmt # cmake3, # python3-pip, # python3-setuptools, -# perl -# requirements for libprometheus and its build system (Conan-based, cmake3-based); +# perl, +# perl-IPC-Cmd, +# perl-Digest-SHA +# requirements for prometheus-cpp 3rd party lib and its build system (Conan-based, cmake3-based); # note that for some reason from FC35 and up we also need to request 'setuptools' pypi to install # successfully the 'conan' pypi, and we install it with python3-setuptools -# perl is instead required from FC35 upward to build OpenSSL Conan package successfully -BuildRequires: gcc-c++, make, git, gtest-devel, fmt-devel, zlib-devel, cmake3, python3-pip, python3-setuptools, perl +# perl* are instead required from FC35 upward to build OpenSSL Conan package successfully + +BuildRequires: gcc-c++, make, git, gtest-devel, fmt-devel, zlib-devel, cmake3, python3-pip, python3-setuptools, perl, perl-IPC-Cmd, perl-Digest-SHA # Disable automatic debug package creation: it fails within Fedora 28, 29 and 30 for the lack # of debug info files apparently: @@ -42,8 +45,9 @@ echo "[Inside RPM prep] running setup" # prometheus-cpp, since that library is not, unfortunately, packaged by Fedora/COPR # NOTE: prometheus-cpp & its dependencies wants at least Conan 1.51.0 echo "[Inside RPM build] installing Conan" -pip3 install 'conan==1.51.2' +pip3 install --user 'conan==1.60.2' echo "[Inside RPM build] bootstrapping Conan" +export PATH="$HOME/.local/bin:$PATH" conan profile new %{buildroot}/cmonitor_rpmbuild --detect conan profile update settings.compiler.libcxx=libstdc++11 %{buildroot}/cmonitor_rpmbuild conan remote list diff --git a/collector/src/Makefile b/collector/src/Makefile index 4ff56be9..d4595cdf 100644 --- a/collector/src/Makefile +++ b/collector/src/Makefile @@ -7,9 +7,9 @@ ROOT_DIR:=$(shell readlink -f $(THIS_DIR)/../..) include $(ROOT_DIR)/Constants.mk include $(ROOT_DIR)/Prometheus-Support.mk -# IMPORTANT: we do require c++11, i.e. GCC 4.8.1 or higher; -# Centos7 which is one of the oldest-supported distributions provides gcc 4.8.5 so we -# cannot move to e.g. c++14/17/20 yet +# IMPORTANT: Centos7 which is one of the oldest-supported distributions provides gcc 4.8.5; +# GCC 4.8.x is able to build C++11 but not e.g. C++14/17/20 yet... so we will stay with C++11 +# till Centos7 has to be supported... # IMPORTANT#2: -fPIC is required to build on fedora-rawhide CXXFLAGS += -Wall -Werror -Wno-switch-bool -std=c++11 -fPIC $(DEFS) diff --git a/collector/src/fast_file_reader.h b/collector/src/fast_file_reader.h index a520864e..cafbe219 100644 --- a/collector/src/fast_file_reader.h +++ b/collector/src/fast_file_reader.h @@ -25,6 +25,7 @@ // Includes //------------------------------------------------------------------------------ +#include #include #include #include diff --git a/collector/src/logger.h b/collector/src/logger.h index 3f332bd8..fc401bf3 100644 --- a/collector/src/logger.h +++ b/collector/src/logger.h @@ -23,6 +23,7 @@ // Includes //------------------------------------------------------------------------------ +#include #include #include #include diff --git a/conanfile.txt b/conanfile.txt index 6cda241c..d6705ab3 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -4,6 +4,8 @@ # [requires] + # prometheus-cpp 1.1.0 cannot be used because it supports only C++14 onward; however the compiler shipping with Centos7 + # supports at most the C++11 dialect... so till we want to support Centos7, we need to stick with prometheus-cpp 1.0.0 prometheus-cpp/1.0.0@ [options]