From 71e20279e923d33bee77fc13cbc9ba1ca1976f01 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Thu, 22 Jul 2021 15:49:51 +0800 Subject: [PATCH] rgw/rgw_lua: s/boost::filesystem/std::filesystem/ for less dependencies on 3rd party libraries, and to reduce the compilation time. Signed-off-by: Kefu Chai --- CMakeLists.txt | 2 +- src/rgw/CMakeLists.txt | 2 +- src/rgw/rgw_lua.cc | 8 ++++---- src/test/lazy-omap-stats/CMakeLists.txt | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2575598a6fe57..8e6d9a8343695 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -585,7 +585,7 @@ option(WITH_SYSTEM_BOOST "require and build with system Boost" OFF) # Boost::thread depends on Boost::atomic, so list it explicitly. set(BOOST_COMPONENTS atomic chrono thread system regex random program_options date_time - iostreams context coroutine filesystem) + iostreams context coroutine) set(BOOST_HEADER_COMPONENTS container) if(WITH_MGR) diff --git a/src/rgw/CMakeLists.txt b/src/rgw/CMakeLists.txt index e738875a7f08b..73364c3aedb39 100644 --- a/src/rgw/CMakeLists.txt +++ b/src/rgw/CMakeLists.txt @@ -282,7 +282,7 @@ endif() list(APPEND rgw_libs ${LUA_LIBRARIES}) if(WITH_RADOSGW_LUA_PACKAGES) - list(APPEND rgw_libs Boost::filesystem) + list(APPEND rgw_libs Boost::filesystem StdFilesystem::filesystem) endif() set(rgw_schedulers_srcs diff --git a/src/rgw/rgw_lua.cc b/src/rgw/rgw_lua.cc index 946a6ff814184..bd08f06bcd99b 100644 --- a/src/rgw/rgw_lua.cc +++ b/src/rgw/rgw_lua.cc @@ -6,8 +6,8 @@ #include "rgw_sal_rados.h" #include "rgw_lua.h" #ifdef WITH_RADOSGW_LUA_PACKAGES +#include #include -#include #include "rgw_lua_version.h" #endif @@ -196,10 +196,10 @@ int list_packages(const DoutPrefixProvider *dpp, rgw::sal::Store* store, optiona int install_packages(const DoutPrefixProvider *dpp, rgw::sal::Store* store, optional_yield y, packages_t& failed_packages, std::string& output) { // luarocks directory cleanup - boost::system::error_code ec; + std::error_code ec; const auto& luarocks_path = store->get_luarocks_path(); - boost::filesystem::remove_all(luarocks_path, ec); - if (ec.value() != 0 && ec.value() != ENOENT) { + if (!std::filesystem::remove_all(luarocks_path, ec) && + ec != std::errc::no_such_file_or_directory) { output.append("failed to clear luarock directory: "); output.append(ec.message()); output.append("\n"); diff --git a/src/test/lazy-omap-stats/CMakeLists.txt b/src/test/lazy-omap-stats/CMakeLists.txt index 636d24c4e82d4..1dac35469c237 100644 --- a/src/test/lazy-omap-stats/CMakeLists.txt +++ b/src/test/lazy-omap-stats/CMakeLists.txt @@ -4,7 +4,7 @@ add_executable(ceph_test_lazy_omap_stats main.cc lazy_omap_stats_test.cc) target_link_libraries(ceph_test_lazy_omap_stats - librados Boost::system Boost::filesystem ${UNITTEST_LIBS}) + librados Boost::system ${UNITTEST_LIBS}) install(TARGETS ceph_test_lazy_omap_stats DESTINATION ${CMAKE_INSTALL_BINDIR}) -- 2.39.5