From d7636819c0d79688c5d6d257309b45615fc5882f Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Wed, 1 Nov 2023 17:59:24 -0600 Subject: [PATCH] rename scripts to have extensions for automatic syntax highlighting python scripts do not have standard shebangs that editors can use also fixes accidental creation of gufi_client_jail during make install gufi_jail should only exist on the server side --- .github/workflows/codecov.yml | 5 ++++ scripts/CMakeLists.txt | 29 ++++++++++++--------- scripts/{gufi_client => gufi_client.py} | 0 scripts/{gufi_find => gufi_find.py} | 0 scripts/{gufi_getfattr => gufi_getfattr.py} | 0 scripts/{gufi_ls => gufi_ls.py} | 0 scripts/{gufi_stat => gufi_stat.py} | 0 scripts/{gufi_stats => gufi_stats.py} | 0 8 files changed, 21 insertions(+), 13 deletions(-) rename scripts/{gufi_client => gufi_client.py} (100%) rename scripts/{gufi_find => gufi_find.py} (100%) rename scripts/{gufi_getfattr => gufi_getfattr.py} (100%) rename scripts/{gufi_ls => gufi_ls.py} (100%) rename scripts/{gufi_stat => gufi_stat.py} (100%) rename scripts/{gufi_stats => gufi_stats.py} (100%) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 2a3b571f3..180c6181d 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -132,6 +132,11 @@ jobs: coverage xml --omit="${{ github.workspace }}/build/contrib/hashes.py,${{ github.workspace }}/build/contrib/performance/performance_pkg/tests/*,${{ github.workspace }}/build/test/*,${{ github.workspace }}/build/test/regression/*,${{ github.workspace }}/build/test/unit/python/*" rm .coverage # If not removed, codecov will attempt to run coverage xml which will not account for our omissions + # add extensions back to renamed files + for script in gufi_find gufi_getfattr gufi_ls gufi_stat gufi_stats + do + sed -i "s/filename=\"scripts\/${script}\"/filename=\"scripts\/${script}.py\"/g;" coverage.xml + done - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5c6e3a408..9b503ace5 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -62,15 +62,13 @@ cmake_minimum_required(VERSION 3.1.0) -# gufi_* scripts +# gufi_*.py scripts set(TOOLS find getfattr ls stat stats - - jail # gufi_jail is used by sshd_config to prevent commands other than gufi_* from running ) # python libraries installed into bin for convenience @@ -82,32 +80,37 @@ set(LIBRARIES if (CLIENT) # add the paramiko source for installing # keep the trailing / to rename the directory - install(DIRECTORY ${DEP_BUILD_PREFIX}/paramiko-master/ DESTINATION lib/GUFI/paramiko COMPONENT Client) + install(DIRECTORY "${DEP_BUILD_PREFIX}/paramiko-master/" DESTINATION lib/GUFI/paramiko COMPONENT Client) endif() foreach(TOOL ${TOOLS}) - configure_file(gufi_${TOOL} gufi_${TOOL} @ONLY) + configure_file("gufi_${TOOL}.py" "gufi_${TOOL}" @ONLY) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gufi_${TOOL} DESTINATION bin COMPONENT Server) + install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gufi_${TOOL}" DESTINATION bin COMPONENT Server) - # when running make install, client files will not overwrite server files + # when building, client files WILL NOT overwrite server files + # when installing, client files WILL overwrite server files if (CLIENT) - configure_file(gufi_client gufi_client_${TOOL} @ONLY) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/gufi_client_${TOOL} - RENAME gufi_${TOOL} + configure_file("gufi_client.py" "gufi_client_${TOOL}" @ONLY) + install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gufi_client_${TOOL}" + RENAME "gufi_${TOOL}" DESTINATION bin COMPONENT Client) endif() endforeach() +# gufi_jail is used by sshd_config to prevent commands other than gufi_* from running +configure_file(gufi_jail gufi_jail @ONLY) +install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/gufi_jail" DESTINATION bin COMPONENT Server) + foreach(LIB ${LIBRARIES}) - configure_file(${LIB} ${LIB} @ONLY) + configure_file("${LIB}" "${LIB}" @ONLY) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${LIB} DESTINATION bin COMPONENT Server) + install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${LIB}" DESTINATION bin COMPONENT Server) # when running make install, client files will not overwrite server files if (CLIENT) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIB} DESTINATION bin COMPONENT Client) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LIB}" DESTINATION bin COMPONENT Client) endif() endforeach() diff --git a/scripts/gufi_client b/scripts/gufi_client.py similarity index 100% rename from scripts/gufi_client rename to scripts/gufi_client.py diff --git a/scripts/gufi_find b/scripts/gufi_find.py similarity index 100% rename from scripts/gufi_find rename to scripts/gufi_find.py diff --git a/scripts/gufi_getfattr b/scripts/gufi_getfattr.py similarity index 100% rename from scripts/gufi_getfattr rename to scripts/gufi_getfattr.py diff --git a/scripts/gufi_ls b/scripts/gufi_ls.py similarity index 100% rename from scripts/gufi_ls rename to scripts/gufi_ls.py diff --git a/scripts/gufi_stat b/scripts/gufi_stat.py similarity index 100% rename from scripts/gufi_stat rename to scripts/gufi_stat.py diff --git a/scripts/gufi_stats b/scripts/gufi_stats.py similarity index 100% rename from scripts/gufi_stats rename to scripts/gufi_stats.py