Re: [PATCH 2/9] cmake: chmod +x the bin-wrappers/* & SCRIPT_{SH,PERL} & git-p4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ævar

On 21/10/2022 10:44, Ævar Arnfjörð Bjarmason wrote:
diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
index fd0c6ef4971..464c41a1fdf 100644
--- a/contrib/buildsystems/CMakeLists.txt
+++ b/contrib/buildsystems/CMakeLists.txt
@@ -836,6 +836,7 @@ foreach(script ${git_shell_scripts})
  	string(REPLACE "@@PERL@@" "${PERL_PATH}" content "${content}")
  	string(REPLACE "@@PAGER_ENV@@" "LESS=FRX LV=-c" content "${content}")
  	file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+	execute_process(COMMAND chmod +x ${CMAKE_BINARY_DIR}/${script})

I think it would be nicer to add a write_script function

function(write_script path content)
       file(WRITE ${path} ${content})
file(CHMOD ${path} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
endfunction()

and then do

-       file(WRITE ${CMAKE_BINARY_DIR}/${script} ${content})
+       write_script(${CMAKE_BINARY_DIR}/${script} "${content}")

rather than executing chmod each time

Best Wishes

Phillip



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux