Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[irods/irods#7265] Minor reorganization + CMake TLC (4-3-stable) #265

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 97 additions & 40 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,123 @@ set(IRODS_PACKAGE_REVISION "0")
include(IrodsCXXCompiler)
set(CMAKE_CXX_STANDARD ${IRODS_CXX_STANDARD})
set(CMAKE_MODULE_LINKER_FLAGS_INIT "-Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,defs")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,defs")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT "-Wl,--gc-sections -Wl,-z,combreloc")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT "-Wl,--gc-sections -Wl,-z,combreloc")
include(IrodsRunpathDefaults)

set(IRODS_TARGET_NAME_PREFIX irods_rule_engine_plugin)

project(irods_capability-storage_tiering
VERSION "${IRODS_PLUGIN_VERSION}"
LANGUAGES CXX)
VERSION "${IRODS_PLUGIN_VERSION}"
LANGUAGES CXX)

include(${IRODS_TARGETS_PATH})
include("${IRODS_TARGETS_PATH}")

include(GNUInstallDirs)
include(UseLibCXX)

if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build {Debug, Release}." FORCE)
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
endif()

set(IRODS_BUILD_WITH_WERROR OFF CACHE BOOL "Choose whether to compile with -Werror.")

if (IRODS_BUILD_WITH_WERROR)
add_compile_options(-Werror)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fpermissive>)
endif()

if (NOT DEFINED THREADS_PREFER_PTHREAD_FLAG)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
endif()
find_package(Threads REQUIRED)
find_package(nlohmann_json "3.6.1" REQUIRED)
find_package(OpenSSL REQUIRED)

# prepare IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME
if(IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "ubuntu" OR IRODS_LINUX_DISTRIBUTION_NAME STREQUAL "debian")
if (NOT IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME)
execute_process(
COMMAND "lsb_release" "-s" "-c"
RESULT_VARIABLE IRODS_EXECUTE_PROCESS_RESULT_LINUX_DISTRIBUTION_VERSION_CODENAME
OUTPUT_VARIABLE IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME
)
string(STRIP ${IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME} IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME)
if (NOT ${IRODS_EXECUTE_PROCESS_RESULT_LINUX_DISTRIBUTION_VERSION_CODENAME} STREQUAL "0")
message(FATAL_ERROR "Linux lsb_release shortname detection failed\n${IRODS_EXECUTE_PROCESS_RESULT_LINUX_DISTRIBUTION_VERSION_CODENAME}")
endif()
set(IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME ${IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME} CACHE STRING "Linux distribution version codename, e.g. {precise, wheezy, trusty, jessie, ...}." FORCE)
message(STATUS "Setting unspecified IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME to '${IRODS_LINUX_DISTRIBUTION_VERSION_CODENAME}'")
endif()
endif()
set(IRODS_POLICY_NAME "unified_storage_tiering")
set(IRODS_PLUGIN_TARGET_NAME "${IRODS_TARGET_NAME_PREFIX}-${IRODS_POLICY_NAME}")

string(REPLACE "_" "-" IRODS_POLICY_NAME_HYPHENS "${IRODS_POLICY_NAME}")
set(IRODS_POLICY_PACKAGE_COMPONENT "${IRODS_POLICY_NAME_HYPHENS}")

add_library(
"${IRODS_PLUGIN_TARGET_NAME}"
MODULE
"${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/storage_tiering.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/configuration.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/utilities.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/data_verification_utilities.cpp"
)
target_link_libraries(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
irods_common
irods_server
nlohmann_json::nlohmann_json
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_system.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_regex.so"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/lib/libboost_filesystem.so"
)
target_include_directories(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"${IRODS_EXTERNALS_FULLPATH_BOOST}/include"
)
target_compile_definitions(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
BOOST_SYSTEM_NO_DEPRECATED
RODS_SERVER
ENABLE_RE
${IRODS_COMPILE_DEFINITIONS}
${IRODS_COMPILE_DEFINITIONS_PRIVATE}
)
target_compile_options(
"${IRODS_PLUGIN_TARGET_NAME}"
PRIVATE
-Wno-write-strings
)

install(
TARGETS
"${IRODS_PLUGIN_TARGET_NAME}"
LIBRARY
DESTINATION "${IRODS_PLUGINS_DIRECTORY}/rule_engines"
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)

install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/test_plugin_unified_storage_tiering.py"
DESTINATION "${IRODS_HOME_DIRECTORY}/scripts/irods/test"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)

install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/run_unified_storage_tiering_plugin_test.py"
DESTINATION "${IRODS_HOME_DIRECTORY}/scripts"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)

install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/example_unified_tiering_invocation.r"
DESTINATION "${IRODS_HOME_DIRECTORY}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
COMPONENT "${IRODS_POLICY_PACKAGE_COMPONENT}"
)

if (NOT CPACK_GENERATOR)
set(CPACK_GENERATOR ${IRODS_CPACK_GENERATOR} CACHE STRING "CPack generator to use, e.g. {DEB, RPM, TGZ}." FORCE)
message(STATUS "Setting unspecified CPACK_GENERATOR to ${CPACK_GENERATOR}. This is the correct setting for normal builds.")
set(CPACK_GENERATOR ${IRODS_CPACK_GENERATOR} CACHE STRING "CPack generator to use, e.g. {DEB, RPM, TGZ}." FORCE)
message(STATUS "Setting unspecified CPACK_GENERATOR to ${CPACK_GENERATOR}. This is the correct setting for normal builds.")
endif()

# CPACK_DEBIAN_PACKAGE_VERSION was previously a cache variable. Evict it.
Expand All @@ -74,6 +139,9 @@ list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INS
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}/scripts/irods")
list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "${CPACK_PACKAGING_INSTALL_PREFIX}${IRODS_HOME_DIRECTORY}/scripts/irods/test")

string(REPLACE "_" "-" IRODS_PLUGIN_TARGET_NAME_HYPHENS "${IRODS_PLUGIN_TARGET_NAME}")

set(CPACK_PACKAGE_NAME "${IRODS_PLUGIN_TARGET_NAME_HYPHENS}")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_COMPONENTS_GROUPING IGNORE)
Expand All @@ -85,25 +153,14 @@ set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF)
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "irods-server (= ${IRODS_VERSION}), irods-runtime (= ${IRODS_VERSION})")
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/packaging/postinst;")

set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_PACKAGE_LICENSE "BSD-3-Clause")
set(CPACK_RPM_PACKAGE_AUTOREQ 0)
set(CPACK_RPM_PACKAGE_AUTOPROV 0)
set(CPACK_RPM_FILE_NAME RPM-DEFAULT)
set(CPACK_RPM_PACKAGE_REQUIRES "irods-server = ${IRODS_VERSION}, irods-runtime = ${IRODS_VERSION}")

#set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)

include(${CMAKE_SOURCE_DIR}/unified_storage_tiering.cmake)
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packaging/postinst")

include(CPack)









Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef STORAGE_TIERING_CONFIGURATION_HPP
#define STORAGE_TIERING_CONFIGURATION_HPP
#ifndef IRODS_CAPABILITY_STORAGE_TIERING_CONFIGURATION_HPP
#define IRODS_CAPABILITY_STORAGE_TIERING_CONFIGURATION_HPP

#include <string>
#include <irods/rcMisc.h>
Expand Down Expand Up @@ -36,4 +36,4 @@ namespace irods {
};
} // namespace irods

#endif // STORAGE_TIERING_CONFIGURATION_HPP
#endif // IRODS_CAPABILITY_STORAGE_TIERING_CONFIGURATION_HPP
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef IRODS_CAPABILITY_STORAGE_TIERING_DATA_VERIFICATION_UTILITIES_HPP
#define IRODS_CAPABILITY_STORAGE_TIERING_DATA_VERIFICATION_UTILITIES_HPP

#include <irods/rcConnect.h>
#include <string>
#include "storage_tiering.hpp"
#include "irods/private/storage_tiering/storage_tiering.hpp"

namespace irods {
bool verify_replica_for_destination_resource(
Expand All @@ -15,4 +17,4 @@ namespace irods {

} // namespace irods


#endif // IRODS_CAPABILITY_STORAGE_TIERING_DATA_VERIFICATION_UTILITIES_HPP
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

#ifndef IRODS_CAPABILITY_STORAGE_TIERING_EXEC_AS_USER_HPP
#define IRODS_CAPABILITY_STORAGE_TIERING_EXEC_AS_USER_HPP

#include <functional>
#include <irods/rcConnect.h>
Expand Down Expand Up @@ -36,3 +37,5 @@ namespace irods {
} // exec_as_user

} // namespace irods

#endif // IRODS_CAPABILITY_STORAGE_TIERING_EXEC_AS_USER_HPP
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef MAKE_CONNECTION_HPP
#define MAKE_CONNECTION_HPP
#ifndef IRODS_STORAGE_TIERING_PROXY_CONNECTION_HPP
#define IRODS_STORAGE_TIERING_PROXY_CONNECTION_HPP

#include <irods/rcConnect.h>

Expand Down Expand Up @@ -39,4 +39,4 @@ namespace irods {
}


#endif // MAKE_CONNECTION_HPP
#endif // IRODS_STORAGE_TIERING_PROXY_CONNECTION_HPP
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@


#ifndef IRODS_STORAGE_TIERING_HPP
#define IRODS_STORAGE_TIERING_HPP
#ifndef IRODS_CAPABILITY_STORAGE_TIERING_HPP
#define IRODS_CAPABILITY_STORAGE_TIERING_HPP

#include <list>
#include <boost/any.hpp>
#include <string>

#include <irods/rcMisc.h>
#include "storage_tiering_configuration.hpp"
#include "irods/private/storage_tiering/configuration.hpp"

namespace irods {
using resource_index_map = std::map<std::string, std::string>;
Expand Down Expand Up @@ -186,5 +184,4 @@ namespace irods {
}; // class storage_tiering
}; // namespace irods

#endif // IRODS_STORAGE_TIERING_HPP

#endif // IRODS_CAPABILITY_STORAGE_TIERING_HPP
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef IRODS_CAPABILITY_STORAGE_TIERING_UTILITIES_HPP
#define IRODS_CAPABILITY_STORAGE_TIERING_UTILITIES_HPP

#include <irods/irods_re_plugin.hpp>
#include <irods/irods_exception.hpp>
Expand All @@ -22,3 +24,5 @@ namespace irods {
std::list<boost::any> _args);

} // namespace irods

#endif // IRODS_CAPABILITY_STORAGE_TIERING_UTILITIES_HPP
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include "storage_tiering_configuration.hpp"
#include "irods/private/storage_tiering/configuration.hpp"
#include <irods/irods_server_properties.hpp>

namespace irods {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <irods/irods_query.hpp>
#include <irods/irods_resource_manager.hpp>
#include <irods/physPath.hpp>
#include "data_verification_utilities.hpp"
#include "storage_tiering_configuration.hpp"
#include "irods/private/storage_tiering/data_verification_utilities.hpp"
#include "irods/private/storage_tiering/configuration.hpp"

#include <irods/dataObjChksum.h>
#include <irods/fileStat.h>
Expand Down
10 changes: 5 additions & 5 deletions ...engine_plugin-unified_storage_tiering.cpp → src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// =-=-=-=-=-=-=-
// irods includes
#include <irods/irods_re_plugin.hpp>
#include "storage_tiering.hpp"
#include "irods/private/storage_tiering/storage_tiering.hpp"
#include <irods/irods_re_ruleexistshelper.hpp>
#include "storage_tiering_utilities.hpp"
#include "irods/private/storage_tiering/utilities.hpp"
#include <irods/irods_resource_backport.hpp>
#include "proxy_connection.hpp"
#include "irods/private/storage_tiering/proxy_connection.hpp"

#include <irods/rsModAVUMetadata.hpp>
#include <irods/rsOpenCollection.hpp>
Expand All @@ -16,9 +16,9 @@
#include <irods/dataObjTrim.h>
#include <irods/physPath.hpp>
#include <irods/apiNumber.h>
#include "data_verification_utilities.hpp"
#include "irods/private/storage_tiering/data_verification_utilities.hpp"
#include <irods/irods_server_api_call.hpp>
#include "exec_as_user.hpp"
#include "irods/private/storage_tiering/exec_as_user.hpp"

#include <irods/filesystem.hpp>
#include <irods/irods_query.hpp>
Expand Down
10 changes: 5 additions & 5 deletions storage_tiering.cpp → src/storage_tiering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

#include <irods/irods_server_properties.hpp>
#include <irods/irods_re_plugin.hpp>
#include "storage_tiering.hpp"
#include "storage_tiering_utilities.hpp"
#include "irods/private/storage_tiering/storage_tiering.hpp"
#include "irods/private/storage_tiering/utilities.hpp"
#include <irods/irods_query.hpp>
#include <irods/irods_virtual_path.hpp>
#include <irods/irods_hierarchy_parser.hpp>
#include <irods/irods_resource_manager.hpp>
#include <irods/irods_resource_backport.hpp>
#include <irods/query_processor.hpp>
#include "proxy_connection.hpp"
#include "irods/private/storage_tiering/proxy_connection.hpp"

#include <irods/modAVUMetadata.h>
#include <irods/rsExecMyRule.hpp>
Expand All @@ -20,9 +20,9 @@
#include <irods/rsReadCollection.hpp>
#include <irods/rsCloseCollection.hpp>

#include "data_verification_utilities.hpp"
#include "irods/private/storage_tiering/data_verification_utilities.hpp"

#include "exec_as_user.hpp"
#include "irods/private/storage_tiering/exec_as_user.hpp"

#include <boost/any.hpp>
#include <boost/regex.hpp>
Expand Down
2 changes: 1 addition & 1 deletion storage_tiering_utilities.cpp → src/utilities.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "storage_tiering_utilities.hpp"
#include "irods/private/storage_tiering/utilities.hpp"

#include <irods/rcMisc.h>

Expand Down
Loading
Loading