Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 3 | # This script pulls all repositories selected with llvm-projs and rebases the |
| 4 | # current branch on top of the new master. |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 5 | |
| 6 | . llvm-common |
| 7 | |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 8 | safe_run verify_env |
| 9 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 10 | function repo_sync () { |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 11 | project=$1 |
| 12 | repo_dir=$2 |
| 13 | worktree_dir=$3 |
| 14 | |
| 15 | if [ ! -d $repo_dir ]; then |
| 16 | echo " + Not updating $project (couldn't find source directory)" |
Diana Picus | 09cd9b6 | 2016-04-25 18:04:06 +0300 | [diff] [blame] | 17 | return; |
| 18 | fi |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 19 | |
| 20 | if [ ! -d $worktree_dir ]; then |
| 21 | echo " + Not updating $project (couldn't find worktree directory)" |
| 22 | return; |
| 23 | fi |
| 24 | |
| 25 | echo " + Updating $project" |
| 26 | |
| 27 | # To pull master, we must be in the repo dir (we shouldn't checkout master in |
| 28 | # the worktree dirs - by default, master lives in the repo dir) |
| 29 | cd $repo_dir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 30 | safe_run git-refresh |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 31 | |
| 32 | # To rebase the current branch, we must be in the worktree dir (we shouldn't |
| 33 | # checkout the current branch in the repo dir, because it is already checked |
| 34 | # out in the worktree dir) |
| 35 | cd $worktree_dir |
| 36 | safe_run git-rebase |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | prog=`basename $0` |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 40 | clang=false |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 41 | cextra=false |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 42 | rt=false |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 43 | libcxx=false |
| 44 | libcxxabi=false |
| 45 | libunwind=false |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 46 | linker=false |
| 47 | debug=false |
| 48 | tests=false |
| 49 | web=false |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 50 | |
| 51 | clang_workdir=$LLVM_SRC/tools/clang |
| 52 | extra_workdir=$LLVM_SRC/tools/clang/tools/extra |
| 53 | rt_workdir=$LLVM_SRC/projects/compiler-rt |
| 54 | libcxx_workdir=$LLVM_SRC/projects/libcxx |
| 55 | libcxxabi_workdir=$LLVM_SRC/projects/libcxxabi |
| 56 | libunwind_workdir=$LLVM_SRC/projects/libunwind |
| 57 | lld_workdir=$LLVM_SRC/tools/lld |
| 58 | lldb_workdir=$LLVM_SRC/tools/lldb |
| 59 | test_workdir=$LLVM_SRC/projects/test-suite |
| 60 | |
| 61 | if [ -d $clang_workdir ]; then clang=true; fi |
| 62 | if [ -d $extra_workdir ]; then cextra=true; fi |
| 63 | if [ -d $rt_workdir ]; then rt=true; fi |
| 64 | if [ -d $libcxx_workdir ]; then libcxx=true; fi |
| 65 | if [ -d $libcxxabi_workdir ]; then libcxxabi=true; fi |
| 66 | if [ -d $libunwind_workdir ]; then libunwind=true; fi |
| 67 | if [ -d $lld_workdir ]; then linker=true; fi |
| 68 | if [ -d $lldb_workdir ]; then debug=true; fi |
| 69 | if [ -d $test_workdir ]; then tests=true; fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 70 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 71 | while getopts "wa" opt; do |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 72 | case $opt in |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 73 | w) |
| 74 | web=true |
| 75 | ;; |
| 76 | a) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 77 | clang=true |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 78 | cextra=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 79 | rt=true |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 80 | libcxx=true |
| 81 | libcxxabi=true |
| 82 | libunwind=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 83 | linker=true |
| 84 | debug=true |
| 85 | tests=true |
| 86 | ;; |
| 87 | *) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 88 | echo "Syntax: $prog [-(w)eb pages] [-(a)ll]" |
| 89 | echo "Syncs the repos that are currently linked into the llvm source tree" |
| 90 | echo "-w forces sync for the web repos (which are never linked)" |
| 91 | echo "-a forces sync for non-web repos that are not linked" |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 92 | exit 1 |
| 93 | ;; |
| 94 | esac |
| 95 | done |
| 96 | |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 97 | llvm_repos=$LLVM_ROOT/repos |
| 98 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 99 | # Compulsory updates |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 100 | repo_sync LLVM $llvm_repos/llvm $LLVM_SRC |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 101 | |
| 102 | if $clang; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 103 | repo_sync Clang $llvm_repos/clang $clang_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 104 | fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 105 | |
| 106 | # Optional updates |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 107 | if $cextra; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 108 | repo_sync ClangToolsExtra $llvm_repos/clang-tools-extra $extra_workdir |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 109 | fi |
| 110 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 111 | if $rt; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 112 | repo_sync RT $llvm_repos/compiler-rt $rt_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 113 | fi |
| 114 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 115 | if $libcxx; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 116 | repo_sync LibC++ $llvm_repos/libcxx $libcxx_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 117 | fi |
| 118 | |
| 119 | if $libcxxabi; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 120 | repo_sync LibC++ABI $llvm_repos/libcxxabi $libcxxabi_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 121 | fi |
| 122 | |
| 123 | if $libunwind; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 124 | repo_sync LibUnwind $llvm_repos/libunwind $libunwind_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 125 | fi |
| 126 | |
| 127 | if $linker; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 128 | repo_sync Linker $llvm_repos/lld $lld_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 129 | fi |
| 130 | |
| 131 | if $debug; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 132 | repo_sync Debugger $llvm_repos/lldb $lldb_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 133 | fi |
| 134 | |
| 135 | if $tests; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 136 | repo_sync Test-Suite $llvm_repos/test-suite $test_workdir |
| 137 | repo_sync LNT $llvm_repos/lnt $llvm_repos/lnt |
| 138 | repo_sync Zorg $llvm_repos/zorg $llvm_repos/zorg |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 139 | fi |
| 140 | |
| 141 | # These are pure SVN repos, not enabled with -a |
| 142 | # You have to manually force with -w |
| 143 | if $web; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 144 | if [ -d $llvm_repos/www ]; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 145 | echo " + Updating WWW" |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 146 | cd $llvm_repos/www $llvm_repos/www |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 147 | svn up |
| 148 | fi |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 149 | if [ -d $llvm_repos/pubs ]; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 150 | echo " + Updating Pubs" |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame^] | 151 | cd $llvm_repos/pubs $llvm_repos/pubs |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 152 | svn up |
| 153 | fi |
| 154 | fi |