[PATCH] D101446: [llvm] Improve export.sh with help and snapshot
Konrad Wilhelm Kleine via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 24 08:16:24 PDT 2021
kwk added a comment.
@tstellar What do you think of fetching the `CMakeLists.txt` file from github?
================
Comment at: llvm/utils/release/export.sh:85
+ # Determine the release by fetching the version from LLVM's CMakeLists.txt.
+ [ -n "$snapshot" ] && release=$(grep -ioP 'set\(\s*LLVM_VERSION_(MAJOR|MINOR|PATCH)\s\K[0-9]+' $llvm_src_dir/llvm/CMakeLists.txt | paste -sd '.')
+
----------------
kwk wrote:
> tstellar wrote:
> > This is getting the release version from the LLVM source that contains export.sh, but it should be getting the version from the source that will be packaged.
> Oh boy, that's a very good catch!
I wonder if we can live with a solution that is backed by the fact that LLVM source lives on github. Then it is a matter of fetching a branch or a particular revision (NOT the local mirror/branch naming). To to a snapshot of one particular revision we could do this:
```
curl -s https://raw.githubusercontent.com/llvm/llvm-project/bcc29e0fcf24a74ef0ec68365afb020787ab0a88/llvm/CMakeLists.txt | grep -ioP 'set\(\s*LLVM_VERSION_(MAJOR|MINOR|PATCH)\s\K[0-9]+' | paste -sd '.'
```
And for the `main` branch we would do this:
```
curl -s https://raw.githubusercontent.com/llvm/llvm-project/main/llvm/CMakeLists.txt | grep -ioP 'set\(\s*LLVM_VERSION_(MAJOR|MINOR|PATCH)\s\K[0-9]+' | paste -sd '.'
```
Feel free to copy this to your local shell to try it out. Of course, the help text needs to be adjusted so that no one used their local remote and branch naming schemes.
The limitation of this approach is that you cannot release something that only you have locally, which is probably not a good practice anyways.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101446/new/
https://reviews.llvm.org/D101446
More information about the llvm-commits
mailing list