2 #===-- tag.sh - Tag the LLVM release candidates ----------------------------===#
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 #===------------------------------------------------------------------------===#
10 # Create branches and release candidates for the LLVM release.
12 #===------------------------------------------------------------------------===#
19 # All the projects that make it into the monorepo, plus test-suite.
20 projects
="monorepo-root cfe clang-tools-extra compiler-rt debuginfo-tests libclc libcxx libcxxabi libunwind lld lldb llgo llvm openmp parallel-libs polly pstl test-suite"
24 base_url
="https://llvm.org/svn/llvm-project"
27 echo "usage: `basename $0` -release <num> [-rebranch] [-revision <num>] [-dry-run]"
28 echo "usage: `basename $0` -release <num> -rc <num> [-dry-run]"
30 echo " -release <num> The version number of the release"
31 echo " -rc <num> The release candidate number"
32 echo " -rebranch Remove existing branch, if present, before branching"
33 echo " -final Tag final release candidate"
34 echo " -revision <num> Revision to branch off (default: HEAD)"
35 echo " -dry-run Make no changes to the repository, just print the commands"
43 for proj
in $projects; do
44 if svn
ls $base_url/$proj/branches
/release_
$branch_release > /dev
/null
2>&1 ; then
45 if [ $rebranch = "no" ]; then
48 remove_args
+=(rm "$proj/branches/release_$branch_release")
50 create_args
+=(cp ${revision} "$proj/trunk" "$proj/branches/release_$branch_release")
52 if [[ ${#remove_args[@]} -gt 0 ]]; then
53 message_prefix
="Removing and recreating"
55 message_prefix
="Creating"
57 if [[ ${#create_args[@]} -gt 0 ]]; then
58 ${dryrun} svnmucc
--root-url "$base_url" \
59 -m "$message_prefix release_$branch_release branch off revision ${revision}" \
60 "${remove_args[@]}" "${create_args[@]}"
65 tag_release_candidate
() {
68 for proj
in $projects ; do
69 if ! svn
ls $base_url/$proj/tags
/RELEASE_
$tag_release > /dev
/null
2>&1 ; then
70 create_args
+=(mkdir
"$proj/tags/RELEASE_$tag_release")
72 if ! svn
ls $base_url/$proj/tags
/RELEASE_
$tag_release/$rc > /dev
/null
2>&1 ; then
74 "$proj/branches/release_$branch_release"
75 "$proj/tags/RELEASE_$tag_release/$rc")
78 if [[ ${#create_args[@]} -gt 0 ]]; then
79 ${dryrun} svnmucc
--root-url "$base_url" \
80 -m "Creating release candidate $rc from release_$tag_release branch" \
86 while [ $# -gt 0 ]; do
88 -release |
--release )
96 -rebranch |
--rebranch )
102 -revision |
--revision )
106 -dry-run |
--dry-run )
109 -h |
--help |
-help )
114 echo "unknown option: $1"
122 if [ "$release" = "" ]; then
123 echo "error: need to specify a release version"
129 branch_release
=`echo $release | sed -e 's,\([0-9]*\.[0-9]*\).*,\1,' | sed -e 's,\.,,g'`
130 tag_release
=`echo $release | sed -e 's,\.,,g'`
132 if [ "$rc" = "" ]; then
135 if [ "$revision" != "HEAD" ]; then
136 echo "error: cannot use -revision with -rc"
142 tag_release_candidate