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 |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 41 | rt=false |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 42 | libcxx=false |
| 43 | libcxxabi=false |
| 44 | libunwind=false |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 45 | linker=false |
| 46 | debug=false |
| 47 | tests=false |
| 48 | web=false |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 49 | |
| 50 | clang_workdir=$LLVM_SRC/tools/clang |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 51 | rt_workdir=$LLVM_SRC/projects/compiler-rt |
| 52 | libcxx_workdir=$LLVM_SRC/projects/libcxx |
| 53 | libcxxabi_workdir=$LLVM_SRC/projects/libcxxabi |
| 54 | libunwind_workdir=$LLVM_SRC/projects/libunwind |
| 55 | lld_workdir=$LLVM_SRC/tools/lld |
| 56 | lldb_workdir=$LLVM_SRC/tools/lldb |
| 57 | test_workdir=$LLVM_SRC/projects/test-suite |
| 58 | |
| 59 | if [ -d $clang_workdir ]; then clang=true; fi |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 60 | if [ -d $rt_workdir ]; then rt=true; fi |
| 61 | if [ -d $libcxx_workdir ]; then libcxx=true; fi |
| 62 | if [ -d $libcxxabi_workdir ]; then libcxxabi=true; fi |
| 63 | if [ -d $libunwind_workdir ]; then libunwind=true; fi |
| 64 | if [ -d $lld_workdir ]; then linker=true; fi |
| 65 | if [ -d $lldb_workdir ]; then debug=true; fi |
| 66 | if [ -d $test_workdir ]; then tests=true; fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 67 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 68 | while getopts "wa" opt; do |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 69 | case $opt in |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 70 | w) |
| 71 | web=true |
| 72 | ;; |
| 73 | a) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 74 | clang=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 75 | rt=true |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 76 | libcxx=true |
| 77 | libcxxabi=true |
| 78 | libunwind=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 79 | linker=true |
| 80 | debug=true |
| 81 | tests=true |
| 82 | ;; |
| 83 | *) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 84 | echo "Syntax: $prog [-(w)eb pages] [-(a)ll]" |
| 85 | echo "Syncs the repos that are currently linked into the llvm source tree" |
| 86 | echo "-w forces sync for the web repos (which are never linked)" |
| 87 | echo "-a forces sync for non-web repos that are not linked" |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 88 | exit 1 |
| 89 | ;; |
| 90 | esac |
| 91 | done |
| 92 | |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 93 | llvm_repos=$LLVM_ROOT/repos |
| 94 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 95 | # Compulsory updates |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 96 | repo_sync LLVM $llvm_repos/llvm $LLVM_SRC |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 97 | |
| 98 | if $clang; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 99 | repo_sync Clang $llvm_repos/clang $clang_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 100 | fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 101 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 102 | if $rt; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 103 | repo_sync RT $llvm_repos/compiler-rt $rt_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 104 | fi |
| 105 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 106 | if $libcxx; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 107 | repo_sync LibC++ $llvm_repos/libcxx $libcxx_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 108 | fi |
| 109 | |
| 110 | if $libcxxabi; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 111 | repo_sync LibC++ABI $llvm_repos/libcxxabi $libcxxabi_workdir |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 112 | fi |
| 113 | |
| 114 | if $libunwind; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 115 | repo_sync LibUnwind $llvm_repos/libunwind $libunwind_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 116 | fi |
| 117 | |
| 118 | if $linker; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 119 | repo_sync Linker $llvm_repos/lld $lld_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 120 | fi |
| 121 | |
| 122 | if $debug; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 123 | repo_sync Debugger $llvm_repos/lldb $lldb_workdir |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 124 | fi |
| 125 | |
| 126 | if $tests; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 127 | repo_sync Test-Suite $llvm_repos/test-suite $test_workdir |
| 128 | repo_sync LNT $llvm_repos/lnt $llvm_repos/lnt |
| 129 | repo_sync Zorg $llvm_repos/zorg $llvm_repos/zorg |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 130 | fi |
| 131 | |
| 132 | # These are pure SVN repos, not enabled with -a |
| 133 | # You have to manually force with -w |
| 134 | if $web; then |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 135 | if [ -d $llvm_repos/www ]; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 136 | echo " + Updating WWW" |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 137 | cd $llvm_repos/www $llvm_repos/www |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 138 | svn up |
| 139 | fi |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 140 | if [ -d $llvm_repos/pubs ]; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 141 | echo " + Updating Pubs" |
Diana Picus | 72189fd | 2016-05-23 19:32:46 +0300 | [diff] [blame] | 142 | cd $llvm_repos/pubs $llvm_repos/pubs |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 143 | svn up |
| 144 | fi |
| 145 | fi |