-
Notifications
You must be signed in to change notification settings - Fork 576
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
ATDM: Recursively set group and perms on install dir (ATDV-241) #7285
Changes from 4 commits
1ee206f
02ecb06
7d7e7fd
9be1576
c96bce4
37d4445
21112c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,7 @@ export ATDM_CONFIG_MPI_PRE_FLAGS="--bind-to;none" | |
|
||
export ATDM_CONFIG_WORKSPACE_BASE_DEFAULT=/home/atdm-devops-admin/jenkins | ||
export ATDM_CONFIG_TRIL_CMAKE_INSTALL_PREFIX_DATE_BASE_DEFAULT=/home/atdm-devops-admin/trilinos_installs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, that is pointing to |
||
export ATDM_CONFIG_MAKE_INSTALL_GROUP_DEFAULT=wg-run-as-atdm-devops | ||
export ATDM_CONFIG_INSTALL_PBP_RUNNER_DEFAULT=/home/atdm-devops-admin/tools/run-as-atdm-devops-admin | ||
|
||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,6 +206,7 @@ export ATDM_CONFIG_MPI_POST_FLAGS="-map-by;socket:PE=4" | |
|
||
export ATDM_CONFIG_WORKSPACE_BASE_DEFAULT=/home/atdm-devops-admin/jenkins | ||
export ATDM_CONFIG_TRIL_CMAKE_INSTALL_PREFIX_DATE_BASE_DEFAULT=/home/atdm-devops-admin/trilinos_installs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no such thing as |
||
export ATDM_CONFIG_MAKE_INSTALL_GROUP_DEFAULT=wg-run-as-atdm-devops | ||
export ATDM_CONFIG_INSTALL_PBP_RUNNER_DEFAULT=/home/atdm-devops-admin/tools/run-as-atdm-devops-admin | ||
|
||
# | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
INCLUDE(TribitsAddInstallGroupAndPermsFixups) | ||
|
||
TRIBITS_ADD_INSTALL_GROUP_AND_PERMS_FIXUPS() | ||
|
||
# NOTE: This is a workaround for a problem with an issue with CMake where you | ||
# must call install(SCRIPT ...) in a subdirectory added with | ||
# add_subdirectory() in order for CMake to run that install script after all | ||
# of the other subdirectories (which are TriBITS packages). As of CMake 3.14, | ||
# you can set the policy set_policy(CMP0082 NEW) which would have allowed us | ||
# to put this in the base TRIBITS_PROJECT_IMPL() macro. But since TriBITS is | ||
# not allowed to require CMake 3.14 yet, we must use this workaround. To make | ||
# super sure that this install(SCRIPTS ...) script will get called last, the | ||
# policy CMP0082 is set to NEW in the TribitsCMakePolicies.cmake file. In | ||
# automated testing of TriBITS, this seems to show that this custom script | ||
# runs after all of the other files get installed (even with CMake 3.11) and | ||
# passes the automated tests that ensures that the last file installed is | ||
# given the correct permissions! At least that is what happened with TriBITS. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/sh | ||
|
||
# | ||
# Configured inputs | ||
# | ||
|
||
# Base install dir and subdirs where last element in array gives CMAKE_INSTALL_PREFIX | ||
SET(projectInstallBaseDir "@PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR@") | ||
SET(projectSubdirPathsArray "@PROJECT_SUBDIR_PATHS_ARRAY@") | ||
# Group and permissions | ||
SET(PROJECT_MAKE_INSTALL_GROUP "@PROJECT_MAKE_INSTALL_GROUP@") | ||
SET(PROJECT_MAKE_INSTALL_PERMS_CHANGE "@PROJECT_MAKE_INSTALL_PERMS_CHANGE@") | ||
|
||
# Helper functions | ||
|
||
SET(CHMOD_CHGRP_IDX 0) | ||
|
||
FUNCTION(ECHO_AND_RUN_CMND) | ||
STRING(REPLACE ";" " " CMND_STR "${ARGN}") | ||
MESSAGE(STATUS "${CHMOD_CHGRP_IDX}: Running: ${CMND_STR}") | ||
EXECUTE_PROCESS(COMMAND ${ARGN} RESULT_VARIABLE RTN_CODE) | ||
IF (NOT RTN_CODE EQUAL 0) | ||
MESSAGE(SEND_ERROR "ERROR: Above command failed!") | ||
ENDIF() | ||
ENDFUNCTION() | ||
|
||
FUNCTION(SET_DIR_OWNER_AND_PERMS dirPath recurseFlag) | ||
|
||
IF (NOT "${PROJECT_MAKE_INSTALL_GROUP}" STREQUAL "") | ||
ECHO_AND_RUN_CMND( | ||
chgrp ${PROJECT_MAKE_INSTALL_GROUP} ${recurseFlag} "${dirPath}") | ||
ENDIF() | ||
|
||
IF (NOT "${PROJECT_MAKE_INSTALL_PERMS_CHANGE}" STREQUAL "") | ||
ECHO_AND_RUN_CMND( | ||
chmod ${PROJECT_MAKE_INSTALL_PERMS_CHANGE} ${recurseFlag} "${dirPath}") | ||
ENDIF() | ||
|
||
MATH(EXPR CHMOD_CHGRP_IDX "${CHMOD_CHGRP_IDX}+1") | ||
SET(CHMOD_CHGRP_IDX ${CHMOD_CHGRP_IDX} PARENT_SCOPE) | ||
|
||
ENDFUNCTION() | ||
|
||
# Executable script | ||
|
||
IF (EXISTS "${projectInstallBaseDir}") | ||
|
||
LIST(LENGTH projectSubdirPathsArray numSubDirs) | ||
|
||
# Get projectSubdirPathsArrayLessOne and CMAKE_INSTALL_PREFIX | ||
SET(projectSubdirPathsArrayLessOne "${projectSubdirPathsArray}") | ||
IF (numSubDirs GREATER 0) | ||
LIST(REMOVE_AT projectSubdirPathsArrayLessOne -1) | ||
ENDIF() | ||
|
||
# Loop over base dirs and set group and permissions and set CMAKE_INSTALL_PREFIX | ||
SET(dirPath "${projectInstallBaseDir}") | ||
IF (numSubDirs EQUAL 0) | ||
# The base dir is CMAKE_INSTALL_PREFIX | ||
SET(CMAKE_INSTALL_PREFIX "${dirPath}") | ||
ELSE() | ||
# Non-recursive set of the group and permissions | ||
SET_DIR_OWNER_AND_PERMS("${dirPath}" "") | ||
FOREACH(subDirEle ${projectSubdirPathsArrayLessOne}) | ||
SET(dirPath "${dirPath}/${subDirEle}") | ||
SET_DIR_OWNER_AND_PERMS("${dirPath}" "") | ||
ENDFOREACH() | ||
# Append last subdir which gives CMAKE_INSTALL_PREFIX | ||
LIST(GET projectSubdirPathsArray -1 lastSubdir) | ||
SET(CMAKE_INSTALL_PREFIX "${dirPath}/${lastSubdir}") | ||
ENDIF() | ||
|
||
# Recursive set of group and permsisions on CMAKE_INSTALL_PREFIX | ||
SET_DIR_OWNER_AND_PERMS("${CMAKE_INSTALL_PREFIX}" "-R") | ||
|
||
ELSE() | ||
|
||
MESSAGE(FATAL_ERROR | ||
"" | ||
"*** ERROR: The directory:" | ||
"***" | ||
"*** ${projectInstallBaseDir}" | ||
"***" | ||
"*** does not exist so can't fix group and permissions!" | ||
"***" | ||
"" | ||
) | ||
|
||
ENDIF() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
INCLUDE(Join) | ||
INCLUDE(TribitsFilepathHelpers) | ||
|
||
|
||
FUNCTION(TRIBITS_CONFIGURE_SET_INSTALLED_GROUP_AND_PERMS_FILE TARGET_FILE) | ||
|
||
SET(PROJECT_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR | ||
"${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}") | ||
|
||
TRIBITS_GET_DIR_ARRAY_BELOW_BASE_DIR( | ||
"${${PROJECT_NAME}_SET_GROUP_AND_PERMISSIONS_ON_INSTALL_BASE_DIR}" | ||
"${CMAKE_INSTALL_PREFIX}" | ||
PROJECT_SUBDIR_PATHS_ARRAY | ||
) | ||
|
||
SET(PROJECT_MAKE_INSTALL_GROUP "${${PROJECT_NAME}_MAKE_INSTALL_GROUP}") | ||
|
||
SET(group_perms "") | ||
IF (${PROJECT_NAME}_MAKE_INSTALL_GROUP_WRITABLE) | ||
SET(group_perms "g+rwX") | ||
ELSEIF (${PROJECT_NAME}_MAKE_INSTALL_GROUP_READABLE) | ||
SET(group_perms "g+rX") | ||
ENDIF() | ||
|
||
SET(other_perms "") | ||
IF (${PROJECT_NAME}_MAKE_INSTALL_WORLD_READABLE) | ||
SET(other_perms "o+rX") | ||
ENDIF() | ||
|
||
JOIN(PROJECT_MAKE_INSTALL_PERMS_CHANGE "," FALSE | ||
${group_perms} ${other_perms} ) | ||
|
||
SET(tribits_install_src | ||
"${${PROJECT_NAME}_TRIBITS_DIR}/${TRIBITS_CMAKE_INSTALLATION_FILES_DIR}") | ||
CONFIGURE_FILE( | ||
"${tribits_install_src}/set_installed_group_and_permissions.cmake.in" | ||
"${TARGET_FILE}" @ONLY ) | ||
|
||
ENDFUNCTION() | ||
|
||
|
||
FUNCTION(TRIBITS_ADD_INSTALL_GROUP_AND_PERMS_FIXUPS) | ||
|
||
IF (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
|
||
SET(set_installed_group_and_permissions_file | ||
"${PROJECT_BINARY_DIR}/set_installed_group_and_permissions.cmake") | ||
|
||
TRIBITS_CONFIGURE_SET_INSTALLED_GROUP_AND_PERMS_FILE( | ||
"${set_installed_group_and_permissions_file}" ) | ||
|
||
# Fix up install for default 'install' command | ||
INSTALL(SCRIPT "${set_installed_group_and_permissions_file}") | ||
|
||
ENDIF() | ||
|
||
ENDFUNCTION() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already set by https://github.com/trilinos/Trilinos/pull/7285/files#diff-34f163da6699ffe6dc9b9bca2b421e78R33, could that cause a data race?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no race going on (this is not parallel code). Might be better to remove these vars from common/toss3/environment_new.sh since TOSS-3 is an OS system env, not a particular cluster.