1 #!/bin/sh 2 #===-- tag.sh - Tag the LLVM release candidates ----------------------------===# 3 # 4 # The LLVM Compiler Infrastructure 5 # 6 # This file is distributed under the University of Illinois Open Source 7 # License. 8 # 9 #===------------------------------------------------------------------------===# 10 # 11 # Create branches and release candidates for the LLVM release. 12 # 13 #===------------------------------------------------------------------------===# 14 15 set -e 16 17 release="" 18 rc="" 19 rebranch="no" 20 projects="llvm cfe dragonegg test-suite compiler-rt libcxx clang-tools-extra polly lldb" 21 22 base_url="https://llvm.org/svn/llvm-project" 23 24 function usage() { 25 echo "usage: `basename $0` -release <num> [-rebranch]" 26 echo "usage: `basename $0` -release <num> -rc <num>" 27 echo " " 28 echo " -release <num> The version number of the release" 29 echo " -rc <num> The release candidate number" 30 echo " -rebranch Remove existing branch, if present, before branching" 31 echo " -final Tag final release candidate" 32 } 33 34 function tag_version() { 35 set -x 36 for proj in $projects; do 37 if svn ls $base_url/$proj/branches/release_$release > /dev/null 2>&1 ; then 38 if [ $rebranch = "no" ]; then 39 continue 40 fi 41 svn remove -m "Removing old release_$release branch for rebranching." \ 42 $base_url/$proj/branches/release_$release 43 fi 44 svn copy -m "Creating release_$release branch" \ 45 $base_url/$proj/trunk \ 46 $base_url/$proj/branches/release_$release 47 done 48 set +x 49 } 50 51 function tag_release_candidate() { 52 set -x 53 for proj in $projects ; do 54 if ! svn ls $base_url/$proj/tags/RELEASE_$release > /dev/null 2>&1 ; then 55 svn mkdir -m "Creating release directory for release_$release." $base_url/$proj/tags/RELEASE_$release 56 fi 57 if ! svn ls $base_url/$proj/tags/RELEASE_$release/$rc > /dev/null 2>&1 ; then 58 svn copy -m "Creating release candidate $rc from release_$release branch" \ 59 $base_url/$proj/branches/release_$release \ 60 $base_url/$proj/tags/RELEASE_$release/$rc 61 fi 62 done 63 set +x 64 } 65 66 while [ $# -gt 0 ]; do 67 case $1 in 68 -release | --release ) 69 shift 70 release=$1 71 ;; 72 -rc | --rc ) 73 shift 74 rc="rc$1" 75 ;; 76 -rebranch | --rebranch ) 77 rebranch="yes" 78 ;; 79 -final | --final ) 80 rc="final" 81 ;; 82 -h | --help | -help ) 83 usage 84 exit 0 85 ;; 86 * ) 87 echo "unknown option: $1" 88 usage 89 exit 1 90 ;; 91 esac 92 shift 93 done 94 95 if [ "x$release" = "x" ]; then 96 echo "error: need to specify a release version" 97 echo 98 usage 99 exit 1 100 fi 101 102 release=`echo $release | sed -e 's,\.,,g'` 103 104 if [ "x$rc" = "x" ]; then 105 tag_version 106 else 107 tag_release_candidate 108 fi 109 110 exit 0 111