Revert r245355 "Release script: correctly symlink clang-tools-extra into the build...
[oota-llvm.git] / utils / release / export.sh
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 projects="llvm cfe test-suite compiler-rt libcxx libcxxabi clang-tools-extra polly lldb lld openmp libunwind"
18 base_url="https://llvm.org/svn/llvm-project"
19
20 release=""
21 rc=""
22
23 function usage() {
24     echo "Export the SVN sources and build tarballs from them"
25     echo "usage: `basename $0`"
26     echo " "
27     echo "  -release <num> The version number of the release"
28     echo "  -rc <num>      The release candidate number"
29     echo "  -final         The final tag"
30 }
31
32 function export_sources() {
33     release_no_dot=`echo $release | sed -e 's,\.,,g'`
34     tag_dir="tags/RELEASE_$release_no_dot/$rc"
35
36     if [ "$rc" = "final" ]; then
37         rc=""
38     fi
39
40     for proj in $projects; do
41         echo "Exporting $proj ..."
42         svn export \
43             $base_url/$proj/$tag_dir \
44             $proj-$release$rc.src
45
46         echo "Creating tarball ..."
47         tar cfJ $proj-$release$rc.src.tar.xz $proj-$release$rc.src
48     done
49 }
50
51 while [ $# -gt 0 ]; do
52     case $1 in
53         -release | --release )
54             shift
55             release=$1
56             ;;
57         -rc | --rc )
58             shift
59             rc="rc$1"
60             ;;
61         -final | --final )
62             rc="final"
63             ;;
64         -h | -help | --help )
65             usage
66             exit 0
67             ;;
68         * )
69             echo "unknown option: $1"
70             usage
71             exit 1
72             ;;
73     esac
74     shift
75 done
76
77 if [ "x$release" = "x" ]; then
78     echo "error: need to specify a release version"
79     exit 1
80 fi
81
82 # Make sure umask is not overly restrictive.
83 umask 0022
84
85 export_sources
86 exit 0