[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / utils / release / tag.sh
blob01922f405ea1e9a4eb368fca3d1aed6cc5003088
1 #!/bin/bash
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 #===------------------------------------------------------------------------===#
14 set -e
16 release=""
17 rc=""
18 rebranch="no"
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"
21 dryrun=""
22 revision="HEAD"
24 base_url="https://llvm.org/svn/llvm-project"
26 usage() {
27 echo "usage: `basename $0` -release <num> [-rebranch] [-revision <num>] [-dry-run]"
28 echo "usage: `basename $0` -release <num> -rc <num> [-dry-run]"
29 echo " "
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"
38 tag_version() {
39 local remove_args=()
40 local create_args=()
41 local message_prefix
42 set -x
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
46 continue
48 remove_args+=(rm "$proj/branches/release_$branch_release")
50 create_args+=(cp ${revision} "$proj/trunk" "$proj/branches/release_$branch_release")
51 done
52 if [[ ${#remove_args[@]} -gt 0 ]]; then
53 message_prefix="Removing and recreating"
54 else
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[@]}"
62 set +x
65 tag_release_candidate() {
66 local create_args=()
67 set -x
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
73 create_args+=(cp HEAD
74 "$proj/branches/release_$branch_release"
75 "$proj/tags/RELEASE_$tag_release/$rc")
77 done
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" \
81 "${create_args[@]}"
83 set +x
86 while [ $# -gt 0 ]; do
87 case $1 in
88 -release | --release )
89 shift
90 release=$1
92 -rc | --rc )
93 shift
94 rc="rc$1"
96 -rebranch | --rebranch )
97 rebranch="yes"
99 -final | --final )
100 rc="final"
102 -revision | --revision )
103 shift
104 revision="$1"
106 -dry-run | --dry-run )
107 dryrun="echo"
109 -h | --help | -help )
110 usage
111 exit 0
114 echo "unknown option: $1"
115 usage
116 exit 1
118 esac
119 shift
120 done
122 if [ "$release" = "" ]; then
123 echo "error: need to specify a release version"
124 echo
125 usage
126 exit 1
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
133 tag_version
134 else
135 if [ "$revision" != "HEAD" ]; then
136 echo "error: cannot use -revision with -rc"
137 echo
138 usage
139 exit 1
142 tag_release_candidate
145 exit 0