Update ceph package

- drop unnecessary deps
- change the gating test case...
- fix licence field
- fmt-header build

Resolves: rhbz#1961080
This commit is contained in:
Boris Ranto 2021-07-26 23:48:44 +02:00
parent 5cfc0ab543
commit 8adc9880ff
5 changed files with 289 additions and 5 deletions

View File

@ -0,0 +1,52 @@
From 00e90946e6ffc0bb5bf11f02d6fd8993974e8159 Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Sat, 24 Jul 2021 00:09:58 +0800
Subject: [PATCH 1/3] osdc/Objecter: move LingerOp's ctor to .cc
so the linkage of fmt::fmt does not spill out to other compilation
units.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
src/osdc/Objecter.cc | 7 +++++++
src/osdc/Objecter.h | 6 +-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc
index d935b73adb9..da25c584f79 100644
--- a/src/osdc/Objecter.cc
+++ b/src/osdc/Objecter.cc
@@ -4722,6 +4722,13 @@ void Objecter::handle_command_reply(MCommandReply *m)
m->put();
}
+Objecter::LingerOp::LingerOp(Objecter *o, uint64_t linger_id)
+ : objecter(o),
+ linger_id(linger_id),
+ watch_lock(ceph::make_shared_mutex(
+ fmt::format("LingerOp::watch_lock #{}", linger_id)))
+{}
+
void Objecter::submit_command(CommandOp *c, ceph_tid_t *ptid)
{
shunique_lock sul(rwlock, ceph::acquire_unique);
diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h
index 5af605913c0..163a3359de7 100644
--- a/src/osdc/Objecter.h
+++ b/src/osdc/Objecter.h
@@ -2304,11 +2304,7 @@ public:
watch_pending_async.pop_front();
}
- explicit LingerOp(Objecter *o, uint64_t linger_id)
- : objecter(o), linger_id(linger_id),
- watch_lock(ceph::make_shared_mutex(
- fmt::format("LingerOp::watch_lock #{}", linger_id))) {}
-
+ LingerOp(Objecter *o, uint64_t linger_id);
const LingerOp& operator=(const LingerOp& r) = delete;
LingerOp(const LingerOp& o) = delete;
--
2.31.1

View File

@ -0,0 +1,185 @@
From d8aa71fe943d379590e5d029357a12f667ad2a73 Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Fri, 23 Jul 2021 17:52:12 +0800
Subject: [PATCH 2/3] cmake: add an option "WITH_FMT_HEADER_ONLY"
in this change:
* an interface library named "fmt-header-only" is introduced. it brings
the support to the header only fmt library.
* fmt::fmt is renamed to fmt
* an option named "WITH_FMT_HEADER_ONLY" is introduced
* fmt::fmt is an alias of "fmt-header-only" if "WITH_FMT_HEADER_ONLY"
is "ON", and an alias of "fmt" otherwise.
because fmt is packaged in EPEL, while librados is packaged
in RHEL, so we cannot have fmt as a runtime dependency of librados.
to address this issue an option "WITH_FMT_HEADER_ONLY" is introduced, so
that we can enable it when building Ceph with the header version of fmt.
and the built packages won't have runtime dependency of fmt.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
cmake/modules/Findfmt.cmake | 22 ++++++++++++++++++++--
src/CMakeLists.txt | 11 +++++++++++
src/common/CMakeLists.txt | 1 +
src/mon/CMakeLists.txt | 5 ++++-
src/msg/CMakeLists.txt | 1 +
src/neorados/CMakeLists.txt | 2 ++
src/osd/CMakeLists.txt | 2 +-
src/tools/CMakeLists.txt | 2 +-
8 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/cmake/modules/Findfmt.cmake b/cmake/modules/Findfmt.cmake
index 747d924e901..734c2b0571c 100644
--- a/cmake/modules/Findfmt.cmake
+++ b/cmake/modules/Findfmt.cmake
@@ -35,9 +35,27 @@ mark_as_advanced(
fmt_VERSION_STRING)
if(fmt_FOUND AND NOT (TARGET fmt::fmt))
- add_library(fmt::fmt UNKNOWN IMPORTED)
- set_target_properties(fmt::fmt PROPERTIES
+ add_library(fmt-header-only INTERFACE)
+ set_target_properties(fmt-header-only PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
+ INTERFACE_COMPILE_DEFINITIONS FMT_HEADER_ONLY=1
+ INTERFACE_COMPILE_FEATURES cxx_std_11)
+
+ add_library(fmt UNKNOWN IMPORTED GLOBAL)
+ set_target_properties(fmt PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${fmt_INCLUDE_DIR}"
+ INTERFACE_COMPILE_FEATURES cxx_std_11
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "${fmt_LIBRARY}")
+
+ if(WITH_FMT_HEADER_ONLY)
+ # please note, this is different from how upstream defines fmt::fmt.
+ # in order to force 3rd party libraries to link against fmt-header-only if
+ # WITH_FMT_HEADER_ONLY is ON, we have to point fmt::fmt to fmt-header-only
+ # in this case.
+ add_library(fmt::fmt ALIAS fmt-header-only)
+ else()
+ add_library(fmt::fmt ALIAS fmt)
+ endif()
+
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2a80566150c..c4d73633ed8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -304,6 +304,7 @@ add_subdirectory(json_spirit)
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/xxHash")
include_directories(SYSTEM "${CMAKE_SOURCE_DIR}/src/rapidjson/include")
+option(WITH_FMT_HEADER_ONLY "use header-only version of fmt library" OFF)
find_package(fmt 6.0.0 QUIET)
if(fmt_FOUND)
include_directories(SYSTEM "${fmt_INCLUDE_DIR}")
@@ -360,6 +361,15 @@ if(WITH_SEASTAR)
add_subdirectory(crimson)
endif()
+function(compile_with_fmt target)
+ get_target_property(fmt_compile_definitions
+ fmt::fmt INTERFACE_COMPILE_DEFINITIONS)
+ if(fmt_compile_definitions)
+ target_compile_definitions(${target} PUBLIC
+ ${fmt_compile_definitions})
+ endif()
+endfunction()
+
set(libcommon_files
${CMAKE_BINARY_DIR}/src/include/ceph_ver.h
ceph_ver.c
@@ -396,6 +406,7 @@ endif()
set_source_files_properties(ceph_ver.c
APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h)
add_library(common-objs OBJECT ${libcommon_files})
+compile_with_fmt(common-objs)
if(WITH_JAEGER)
find_package(yaml-cpp 0.6.0)
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 6f29dfef350..7482b3d072a 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -177,6 +177,7 @@ target_compile_definitions(common-common-objs PRIVATE
"CEPH_LIBDIR=\"${CMAKE_INSTALL_FULL_LIBDIR}\""
"CEPH_PKGLIBDIR=\"${CEPH_INSTALL_FULL_PKGLIBDIR}\""
"CEPH_DATADIR=\"${CEPH_INSTALL_DATADIR}\"")
+compile_with_fmt(common-common-objs)
set(common_mountcephfs_srcs
armor.c
diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt
index 088fa6a0cdd..b4056fdb1ec 100644
--- a/src/mon/CMakeLists.txt
+++ b/src/mon/CMakeLists.txt
@@ -33,7 +33,10 @@ endif()
add_library(mon STATIC
${lib_mon_srcs})
-target_link_libraries(mon kv heap_profiler)
+target_link_libraries(mon
+ kv
+ heap_profiler
+ fmt::fmt)
if(WITH_JAEGER)
target_link_libraries(mon jaeger-base)
endif()
diff --git a/src/msg/CMakeLists.txt b/src/msg/CMakeLists.txt
index e6d0b589b42..9cca15c8155 100644
--- a/src/msg/CMakeLists.txt
+++ b/src/msg/CMakeLists.txt
@@ -38,6 +38,7 @@ if(HAVE_RDMA)
endif()
add_library(common-msg-objs OBJECT ${msg_srcs})
+compile_with_fmt(common-msg-objs)
target_include_directories(common-msg-objs PRIVATE ${OPENSSL_INCLUDE_DIR})
if(WITH_DPDK)
diff --git a/src/neorados/CMakeLists.txt b/src/neorados/CMakeLists.txt
index 50272374d2b..8695b48f0f9 100644
--- a/src/neorados/CMakeLists.txt
+++ b/src/neorados/CMakeLists.txt
@@ -1,7 +1,9 @@
add_library(neorados_objs OBJECT
RADOSImpl.cc)
+compile_with_fmt(neorados_objs)
add_library(neorados_api_obj OBJECT
RADOS.cc)
+compile_with_fmt(neorados_api_obj)
add_library(libneorados STATIC
$<TARGET_OBJECTS:neorados_api_obj>
diff --git a/src/osd/CMakeLists.txt b/src/osd/CMakeLists.txt
index 0d0ca63b347..373456fc65d 100644
--- a/src/osd/CMakeLists.txt
+++ b/src/osd/CMakeLists.txt
@@ -50,7 +50,7 @@ endif()
add_library(osd STATIC ${osd_srcs})
target_link_libraries(osd
PUBLIC dmclock::dmclock Boost::MPL
- PRIVATE os heap_profiler cpu_profiler ${CMAKE_DL_LIBS})
+ PRIVATE os heap_profiler cpu_profiler fmt::fmt ${CMAKE_DL_LIBS})
if(WITH_LTTNG)
add_dependencies(osd osd-tp pg-tp)
endif()
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 1a92898c571..fdfde4f34ef 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -20,7 +20,7 @@ if(NOT WIN32)
set(neorados_srcs
neorados.cc)
add_executable(neorados ${neorados_srcs})
- target_link_libraries(neorados libneorados spawn ${CMAKE_DL_LIBS})
+ target_link_libraries(neorados libneorados spawn fmt::fmt ${CMAKE_DL_LIBS})
#install(TARGETS neorados DESTINATION bin)
endif()
--
2.31.1

View File

@ -0,0 +1,40 @@
From 84b4c8fbff60f534ce14db050b321b8c7c62f7dd Mon Sep 17 00:00:00 2001
From: Kefu Chai <kchai@redhat.com>
Date: Fri, 23 Jul 2021 18:02:36 +0800
Subject: [PATCH 3/3] ceph.spec.in: build with header only fmt on RHEL
because fmt is packaged in EPEL, while librados is packaged
in RHEL, so we cannot have fmt as a runtime dependency of librados.
to address this issue, we should compile librados either with static library
or with header-only library of fmt. but because the fedora packaging
guideline does no encourage us to package static libraries, and it would
be complicated to package both static and dynamic library for fmt.
the simpler solution would be to compile Ceph with the header-only
version of fmt.
in this change, we compile ceph with the header-only version of fmt
on RHEL to address the runtime dependency issue.
Signed-off-by: Kefu Chai <kchai@redhat.com>
---
ceph.spec.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ceph.spec.in b/ceph.spec.in
index 718421ca901..fd7ebe92d8b 100644
--- a/ceph.spec.in
+++ b/ceph.spec.in
@@ -1335,6 +1335,9 @@ ${CMAKE} .. \
-DWITH_SYSTEM_PMDK:BOOL=ON \
%endif
-DBOOST_J=$CEPH_SMP_NCPUS \
+%if 0%{?rhel}
+ -DWITH_FMT_HEADER_ONLY:BOOL=ON \
+%endif
-DWITH_GRAFANA=ON
%if %{with cmake_verbose_logging}
--
2.31.1

View File

@ -64,7 +64,7 @@
#################################################################################
Name: ceph
Version: 16.2.4
Release: 2%{?dist}
Release: 3%{?dist}
%if 0%{?fedora} || 0%{?rhel}
Epoch: 2
%endif
@ -75,7 +75,7 @@ Epoch: 2
Summary: User space components of the Ceph file system
#License: LGPL-2.1 and LGPL-3.0 and CC-BY-SA-3.0 and GPL-2.0 and BSL-1.0 and BSD-3-Clause and MIT
License: (LGPLv2.1 or LGPLv3) and CC-BY-SA-3.0 and GPLv2 and Boost-1.0 and BSD and MIT
License: LGPLv2+ and CC-BY-SA-3.0 and GPLv2 and Boost and BSD and MIT
%if 0%{?suse_version}
Group: System/Filesystems
%endif
@ -91,6 +91,9 @@ Patch0009: 0009-librgw-notifications-initialize-kafka-and-amqp.patch
Patch0010: 0010-os-bluestore-strip-trailing-slash-for-directory-list.patch
Patch0011: 0011-src-test-rgw-amqp_mock.cc.patch
Patch0012: 0012-src-compressor-snappy-SnappyCompressor.h.patch
Patch0013: 0013-osdc-Objecter-move-LingerOp-s-ctor-to-.cc.patch
Patch0014: 0014-cmake-add-an-option-WITH_FMT_HEADER_ONLY.patch
Patch0015: 0015-ceph.spec.in-build-with-header-only-fmt-on-RHEL.patch
# ceph 14.0.1 does not support 32-bit architectures, bugs #1727788, #1727787
ExcludeArch: i686 armv7hl
%if 0%{?suse_version}
@ -135,7 +138,6 @@ BuildRequires: libcap-ng-devel
BuildRequires: fmt-devel >= 5.2.1
BuildRequires: pkgconfig(libudev)
BuildRequires: libnl3-devel
BuildRequires: liboath-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: make
@ -157,7 +159,6 @@ BuildRequires: valgrind-devel
BuildRequires: which
BuildRequires: xfsprogs
BuildRequires: xfsprogs-devel
BuildRequires: xmlstarlet
BuildRequires: lua-devel
BuildRequires: nasm
%if 0%{with amqp_endpoint}
@ -719,6 +720,7 @@ cd build
%if 0%{with ceph_test_package}
-DWITH_SYSTEM_GTEST=ON \
%endif
-DWITH_FMT_HEADER_ONLY=ON \
-DWITH_GRAFANA=OFF
%if %{with cmake_verbose_logging}
@ -1141,6 +1143,11 @@ fi
%{_includedir}/rados/objclass.h
%changelog
* Tue Jul 27 2021 Boris Ranto <branto@redhat.com> - 2:16.2.4-3
- Apply fmt-header-only patches
- Update licence field
- Drop unnecessary dependencies
* Wed Jun 16 2021 Mohan Boddu <mboddu@redhat.com> - 2:16.2.4-2
- Rebuilt for RHEL 9 BETA for openssl 3.0
Related: rhbz#1971065

View File

@ -3,4 +3,4 @@ product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
- !PassingTestCaseRule {test_case_name: osci.brew-build.installability.functional}