From dfd3deb5b22dd49b887d6fa41cad0c1ebc525ebf Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 9 Jul 2021 11:04:04 +0800 Subject: [PATCH] cmake: install mgr module separately instead of installing the whole directory, install mgr modules individually, so it's more clear that what EXCLUDE pattern is used in which mgr module. this improves the maintability and readability. in future, we should only install the artifacts. with this change, we can specify the include pattern only for dashboard mgr module so that, for instance, only .js, .html and .css files are installed. Signed-off-by: Kefu Chai --- src/pybind/mgr/CMakeLists.txt | 82 ++++++++++++++++++++++-------- src/pybind/mgr/rook/CMakeLists.txt | 5 ++ 2 files changed, 67 insertions(+), 20 deletions(-) diff --git a/src/pybind/mgr/CMakeLists.txt b/src/pybind/mgr/CMakeLists.txt index b68daf925892..0852adb79e64 100644 --- a/src/pybind/mgr/CMakeLists.txt +++ b/src/pybind/mgr/CMakeLists.txt @@ -1,6 +1,26 @@ +set(mgr_module_install_excludes + REGEX "CMakeLists.txt" EXCLUDE + REGEX "\\.gitignore" EXCLUDE + REGEX "tox.ini" EXCLUDE + REGEX "requirements.*\.txt" EXCLUDE + REGEX "constraints.*\.txt" EXCLUDE + REGEX "tests/.*" EXCLUDE) + if(WITH_MGR_DASHBOARD_FRONTEND) add_subdirectory(dashboard) endif() + +install(DIRECTORY dashboard + DESTINATION ${CEPH_INSTALL_DATADIR}/mgr + ${mgr_module_install_excludes} + REGEX "node_modules" EXCLUDE + REGEX "cypress.*" EXCLUDE + REGEX "\.coveragerc" EXCLUDE + REGEX "\.editorconfig" EXCLUDE + REGEX "\..*lintrc" EXCLUDE + REGEX "\.browserslistrc" EXCLUDE + REGEX "\.prettier*" EXCLUDE) + if(WITH_MGR_ROOK_CLIENT) add_subdirectory(rook) endif() @@ -11,23 +31,45 @@ endif() # Location needs to match default setting for mgr_module_path, currently: # OPTION(mgr_module_path, OPT_STR, CEPH_INSTALL_DATADIR "/mgr") -install(DIRECTORY - ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CEPH_INSTALL_DATADIR} - REGEX "CMakeLists.txt" EXCLUDE - REGEX "\\.gitignore" EXCLUDE - REGEX ".*\\.pyi" EXCLUDE - REGEX "hello/.*" EXCLUDE - REGEX "tests/.*" EXCLUDE - REGEX "rook/rook-client-python.*" EXCLUDE - REGEX "osd_perf_query/.*" EXCLUDE - REGEX "tox.ini" EXCLUDE - REGEX "requirements.*\.txt" EXCLUDE - REGEX "constraints.*\.txt" EXCLUDE - REGEX "node_modules" EXCLUDE - REGEX "cypress.*" EXCLUDE - REGEX "\.coveragerc" EXCLUDE - REGEX "\.editorconfig" EXCLUDE - REGEX "\..*lintrc" EXCLUDE - REGEX "\.browserslistrc" EXCLUDE - REGEX "\.prettier*" EXCLUDE) +set(mgr_modules + alerts + balancer + cephadm + crash + # dashboard (optional) + devicehealth + diskprediction_local + # hello is an example for developers, not for user + influx + insights + iostat + k8sevents + localpool + mds_autoscaler + mirroring + nfs + orchestrator + osd_perf_query + osd_support + pg_autoscaler + progress + prometheus + rbd_support + restful + # rook (optional) + selftest + snap_schedule + stats + status + telegraf + telemetry + # tests (for testing purpose only) + test_orchestrator + volumes + zabbix) + +install(DIRECTORY ${mgr_modules} + DESTINATION ${CEPH_INSTALL_DATADIR}/mgr + ${mgr_module_install_excludes}) +install(FILES mgr_module.py mgr_util.py + DESTINATION ${CEPH_INSTALL_DATADIR}/mgr) diff --git a/src/pybind/mgr/rook/CMakeLists.txt b/src/pybind/mgr/rook/CMakeLists.txt index 206e165e6890..79e4e9a2eb5b 100644 --- a/src/pybind/mgr/rook/CMakeLists.txt +++ b/src/pybind/mgr/rook/CMakeLists.txt @@ -13,3 +13,8 @@ ExternalProject_Add(mgr-rook-client INSTALL_COMMAND "") add_dependencies(ceph-mgr mgr-rook-client) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DESTINATION ${CEPH_INSTALL_DATADIR}/mgr + ${mgr_module_install_excludes} + REGEX "rook-client-python.*" EXCLUDE) -- 2.47.3