[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:41:12 PDT 2021


kwk planned changes to this revision.
kwk added inline comments.


================
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:
> 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.
Or we could do this instead:


```
// Get CMakeListst.txt for a particular revision.

t=$(mktemp)
mv /path/to/llvm-project/llvm/CMakeLists.txt $t
git checkout <git-ref> -- /path/to/llvm-project/llvm/CMakeLists.txt

// Grep the Version from CMakeLists.txt
// ... the code exists here already.

// Restore from the backed up file:
mv $t /path/to/llvm-project/llvm/CMakeLists.txt

```

The downside is that we need to overwrite code in the local repo for a limited time frame. 


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