diff --git a/arras4_core_impl/lib/execute/CMakeLists.txt b/arras4_core_impl/lib/execute/CMakeLists.txt index 42cf5ad..7fbd7a1 100644 --- a/arras4_core_impl/lib/execute/CMakeLists.txt +++ b/arras4_core_impl/lib/execute/CMakeLists.txt @@ -48,9 +48,13 @@ target_link_libraries(${LibName} ${PROJECT_NAME}::chunking ${PROJECT_NAME}::core_messages ${PROJECT_NAME}::network - cgroup ) +if(EXISTS /usr/lib64/libcgroup.so) + target_link_libraries(${LibName} PUBLIC cgroup) + target_compile_definitions(${LibName} PRIVATE ARRAS_ENABLE_CGROUP) +endif() + target_include_directories(${LibName} PUBLIC $ diff --git a/arras4_core_impl/lib/execute/ControlGroup.h b/arras4_core_impl/lib/execute/ControlGroup.h index 2ba0b88..97d03b1 100644 --- a/arras4_core_impl/lib/execute/ControlGroup.h +++ b/arras4_core_impl/lib/execute/ControlGroup.h @@ -4,7 +4,11 @@ #ifndef __COMPUTATION_GROUP_H__ #define __COMPUTATION_GROUP_H__ +#ifdef ARRAS_ENABLE_CGROUP #include +#else +#include "cgroup_stubs.h" +#endif #include #include #include // for std::string diff --git a/arras4_core_impl/lib/execute/SConscript b/arras4_core_impl/lib/execute/SConscript index dc3a8c5..3caf325 100644 --- a/arras4_core_impl/lib/execute/SConscript +++ b/arras4_core_impl/lib/execute/SConscript @@ -1,5 +1,5 @@ Import('env') -from os import path +import os # -------------------------------------------------------------------------- name = 'execute' @@ -28,7 +28,9 @@ publicHeaders = [ env.DWAInstallInclude(publicHeaders, 'execute') -env.AppendUnique(LIBS = ['cgroup']) +if os.path.isfile('/usr/lib64/libcgroup.so'): + env.AppendUnique(LIBS = ['cgroup']) + env.AppendUnique(CPPDEFINES=['ARRAS_ENABLE_CGROUP']) env.DWAUseComponents(components) lib = env.DWASharedLibrary(name, sources) diff --git a/arras4_core_impl/lib/execute/cgroup_stubs.h b/arras4_core_impl/lib/execute/cgroup_stubs.h new file mode 100644 index 0000000..a0f90b1 --- /dev/null +++ b/arras4_core_impl/lib/execute/cgroup_stubs.h @@ -0,0 +1,154 @@ + +enum { + ECGROUPNOTCOMPILED = 50000, + ECGEOF = 50023 +}; + +struct cgroup { + int stub; +}; + +struct cgroup_controller { + int stub; +}; + +struct cgroup_stat { + char name[1]; + char value[1]; +}; + +inline int +cgroup_init(void) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_get_subsys_mount_point(const char *controller, char **mount_point) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_create_cgroup(struct cgroup *cgroup, int ignore_ownership) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_get_task_begin(const char *cgroup, const char *controller, void **handle, + pid_t *pid) +{ + return 0; +} + +inline int +cgroup_get_task_end(void **handle) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_attach_task_pid(struct cgroup *cgroup, pid_t tid) +{ + return ECGROUPNOTCOMPILED; +} + +inline const char * +cgroup_strerror(int code) +{ + static char errorstr[] = "cgroups are disabled"; + return errorstr; +} + +inline struct cgroup_controller * +cgroup_get_controller(struct cgroup *cgroup, const char *name) +{ + return nullptr; +} + +inline struct cgroup_controller * +cgroup_add_controller(struct cgroup *cgroup, + const char *name) +{ + return nullptr; +} + +inline int +cgroup_get_value_uint64(struct cgroup_controller *controller, + const char *name, u_int64_t *value) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_get_value_int64(struct cgroup_controller *controller, + const char *name, int64_t *value) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_add_value_int64(struct cgroup_controller *controller, + const char *name, int64_t value) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_add_value_uint64(struct cgroup_controller *controller, + const char *name, u_int64_t value) +{ + return ECGROUPNOTCOMPILED; +} + +inline struct cgroup * +cgroup_new_cgroup(const char *name) +{ + return nullptr; +} + +inline int +cgroup_get_cgroup(struct cgroup *cgroup) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_modify_cgroup(struct cgroup *cgroup) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_delete_cgroup(struct cgroup *cgroup, int ignore_migration) +{ + return ECGROUPNOTCOMPILED; +} + +inline void +cgroup_free(struct cgroup **cgroup) +{ +} + +inline int +cgroup_read_stats_begin(const char *controller, const char *path, void **handle, + struct cgroup_stat *stat) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_read_stats_next(void **handle, struct cgroup_stat *stat) +{ + return ECGROUPNOTCOMPILED; +} + +inline int +cgroup_read_stats_end(void **handle) +{ + return ECGROUPNOTCOMPILED; +} + + + diff --git a/arras4_network/lib/httpserver/HttpServer.cc b/arras4_network/lib/httpserver/HttpServer.cc index 44e4144..b5547d0 100644 --- a/arras4_network/lib/httpserver/HttpServer.cc +++ b/arras4_network/lib/httpserver/HttpServer.cc @@ -56,13 +56,13 @@ ResponseState::ResponseState(struct MHD_Connection* aConnection, const char* aUr { } -int +MHD_Result handleError(struct MHD_Connection* aConnection, unsigned int statusCode, const std::string& responseMsg, enum MHD_ResponseMemoryMode mode) { - int rtn = MHD_NO; + MHD_Result rtn = MHD_NO; struct MHD_Response* resp = MHD_create_response_from_buffer(responseMsg.size() + 1, const_cast(responseMsg.c_str()), mode); @@ -73,7 +73,7 @@ handleError(struct MHD_Connection* aConnection, return rtn; } -int +MHD_Result dispatch( void* aData, struct MHD_Connection* aConnection, @@ -116,7 +116,7 @@ dispatch( return MHD_YES; } - int rtn = MHD_NO; + MHD_Result rtn = MHD_NO; try { HttpServer* server = static_cast(aData); ResponseState* state = static_cast(*aPtr); @@ -393,12 +393,12 @@ HttpServer::~HttpServer() if (mDaemon) MHD_stop_daemon(mDaemon); } -int +MHD_Result HttpServer::_complete(HttpServerResponse& aResp) { return aResp.queue(); } -static int +static MHD_Result key_value_iterator(void* aCls, enum MHD_ValueKind aKind, const char* aKey, const char* aVal) { diff --git a/arras4_network/lib/httpserver/HttpServer.h b/arras4_network/lib/httpserver/HttpServer.h index d2bf75a..70236e4 100644 --- a/arras4_network/lib/httpserver/HttpServer.h +++ b/arras4_network/lib/httpserver/HttpServer.h @@ -10,8 +10,9 @@ #include #include -struct MHD_Daemon; -struct MHD_Connection; +#include +// struct MHD_Daemon; +// struct MHD_Connection; namespace arras4 { namespace network { @@ -37,7 +38,7 @@ namespace arras4 { // internal-use only void _prepare(HttpServerRequest&, struct MHD_Connection*); - int _complete(HttpServerResponse&); + MHD_Result _complete(HttpServerResponse&); private: MHD_Daemon* mDaemon; diff --git a/arras4_network/lib/httpserver/HttpServerResponse.cc b/arras4_network/lib/httpserver/HttpServerResponse.cc index a853e13..99fbbdf 100644 --- a/arras4_network/lib/httpserver/HttpServerResponse.cc +++ b/arras4_network/lib/httpserver/HttpServerResponse.cc @@ -31,7 +31,7 @@ HttpServerResponse::write(const std::string& aStringData) } -int +MHD_Result HttpServerResponse::queue() { struct MHD_Response* response = nullptr; diff --git a/arras4_network/lib/httpserver/HttpServerResponse.h b/arras4_network/lib/httpserver/HttpServerResponse.h index 1084e75..19d82fb 100644 --- a/arras4_network/lib/httpserver/HttpServerResponse.h +++ b/arras4_network/lib/httpserver/HttpServerResponse.h @@ -5,6 +5,7 @@ #define __ARRAS4_HTTPSERVERRESPONSE_H__ #include "httpserver_types.h" +#include struct MHD_Connection; @@ -46,7 +47,7 @@ class HttpServerResponse std::string mText; ServerResponseCode mCode; - int queue(); + MHD_Result queue(); }; } diff --git a/package.py b/package.py index b33c6bc..2c64d82 100644 --- a/package.py +++ b/package.py @@ -11,7 +11,7 @@ def version(): """ Increment the build in the version. """ - _version = '4.10.2' + _version = '4.10.3' from rezbuild import earlybind return earlybind.version(this, _version) @@ -35,30 +35,25 @@ def version(): ['os-CentOS-7', 'refplat-vfx2019.3'], ['os-CentOS-7', 'refplat-vfx2020.3'], ['os-CentOS-7', 'refplat-vfx2021.0'], - ['os-CentOS-7', 'refplat-vfx2022.0'] + ['os-CentOS-7', 'refplat-vfx2022.0'], + ['os-rocky-9', 'refplat-vfx2021.0'], + ['os-rocky-9', 'refplat-vfx2022.0'], ] sconsTargets = {} for variant in variants: sconsTargets[variant[0]] = ['@install', '@doxygen'] -requires = [ - 'uuid-1.0.0', - 'boost', - 'curl_no_ldap-7.49.1', - 'jsoncpp-0.6.0', - 'libmicrohttpd-0.9.37.x.0' -] - private_build_requires = [ build_system_pbr, 'cppunit', - 'gcc' + 'gcc-6.3.x|9.3.x' ] if build_system is 'cmake': def commands(): prependenv('CMAKE_MODULE_PATH', '{root}/lib64/cmake') + prependenv('CMAKE_PREFIX_PATH', '{root}') prependenv('LD_LIBRARY_PATH', '{root}/lib64') prependenv('PATH', '{root}/bin') prependenv('ARRAS_SESSION_PATH', '{root}/sessions') @@ -71,3 +66,20 @@ def commands(): uuid = '2625d822-f8b4-4e3d-8106-007c2b9f42c2' config_version = 0 + +@early() +def requires(): + # Requirements that apply to both pipeX and job environments + requires = [ + 'uuid-1.0.0', + 'boost', + 'curl_no_ldap-7.49.1.x.2', + 'jsoncpp-0.6.0', + 'libmicrohttpd-0.9.71.x.1', + 'breakpad-1499' + ] + if building: + from rezbuild import earlybind + requires.extend(earlybind.get_compiler(build_variant_requires)) + + return requires