pdhaliwal added a comment.

I understand that `.git/logs/HEAD` acts as a dependency for `vcs_revision_h` 
target. However, problem here is that cmake fails when it tries to create 
`.git/logs/HEAD` in read-only filesystem.

I had following ideas for solving above issue,

1. Skip creating `.git/logs/HEAD` whenever a cmake variable (say, 
LLVM_SKIP_VC_HEAD_CHECK) is turned `On`.
2. Remove the creation of `.git/logs/HEAD`.
  - So, in cases of normal checkout, `.git/logs/HEAD` will added as dependency 
to generation script and hence latter will not be triggered for every build.
  - In case of `repo` based checkout, the file will not be created and hence 
will not be a dependency to generation script. In this scenario, script will be 
triggered for every build, but will not generate header if HEAD does not change 
as GenerateVersionFromVCS.cmake#L49 
<https://github.com/llvm/llvm-project/blob/969c63a2ecfb536062ff2174645abe31e4036067/llvm/cmake/modules/GenerateVersionFromVCS.cmake#L49>
 will take care.
3. Another way is to gracefully handle the `file` write error, for which I 
don't think there is a portable way. (which @scott.linder also suggested)
4. Last way will be to check if we have write permissions, which again is also 
not portable.

Please suggest if there might exist some other solution. This patch simply 
implements solution number 2.

Also, could you elaborate more on "avoid running `git rev-parse HEAD` for every 
build"? I think it should not harm the build time in such a bad way or maybe I 
am missing something.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79400/new/

https://reviews.llvm.org/D79400



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to