Skip to content

Commit

Permalink
Automatic snapshot commit from tribits at 362e27d
Browse files Browse the repository at this point in the history
Origin repo remote tracking branch: 'github/master'
Origin repo remote repo URL: 'github = [email protected]:TriBITSPub/TriBITS.git'

At commit:

commit 362e27deddda83fb4b2c78b0d32d036da2d93965
Author:  Roscoe A. Bartlett <[email protected]>
Date:    Tue Sep 22 10:09:42 2020 -0600
Summary: Fix stat command args for Linux (#7881)

This pulls in updates from the TriBITS PR:

* TriBITSPub/TriBITS#329
  • Loading branch information
bartlettroscoe committed Sep 22, 2020
1 parent d1617d2 commit 43a9454
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ 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}")
Expand All @@ -26,15 +28,21 @@ FUNCTION(ECHO_AND_RUN_CMND)
ENDIF()
ENDFUNCTION()


FUNCTION(SET_DIR_OWNER_AND_PERMS dirPath recurseFlag)

IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(STAT_ARG "-f") # MacOSX stat
IF (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
SET(STAT_ARGS "-f%Su") # MacOSX stat
ELSE()
SET(STAT_ARG "-c") # BinUtils stat
SET(STAT_ARGS "-c%U") # BinUtils stat
ENDIF()
# NOTE: Above, we can't have a space between the '-f' and '%Su' strings or
# the '-c' and '%U' strings. If you do, then you get a single space at the
# beginning of the returned owner name as ' <dirOwner>' instead of
# '<dirOwner>'. The automated tests on Linux and MacOSX don't pass if you
# don't have it this way.

EXECUTE_PROCESS(COMMAND stat ${STAT_ARG} %U "${dirPath}"
EXECUTE_PROCESS(COMMAND stat ${STAT_ARGS} "${dirPath}"
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE dirOwner)

Expand All @@ -46,12 +54,12 @@ 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}")
chgrp ${recurseFlag} ${PROJECT_MAKE_INSTALL_GROUP} "${dirPath}")
ENDIF()

IF (NOT "${PROJECT_MAKE_INSTALL_PERMS_CHANGE}" STREQUAL "")
ECHO_AND_RUN_CMND(
chmod ${PROJECT_MAKE_INSTALL_PERMS_CHANGE} ${recurseFlag} "${dirPath}")
chmod ${recurseFlag} ${PROJECT_MAKE_INSTALL_PERMS_CHANGE} "${dirPath}")
ENDIF()

ENDIF()
Expand All @@ -61,10 +69,12 @@ FUNCTION(SET_DIR_OWNER_AND_PERMS dirPath recurseFlag)

ENDFUNCTION()


#
# Executable script
#


IF (EXISTS "${projectInstallBaseDir}")

EXECUTE_PROCESS(COMMAND whoami
Expand Down

0 comments on commit 43a9454

Please sign in to comment.