Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # This script checks out all repositories from upstream and pushes master |
| 4 | # to the origin repo on Linaro's Git server, rebasing all local branches, |
| 5 | # but *not* pushing them, too. |
| 6 | |
| 7 | . llvm-common |
| 8 | |
| 9 | function repo_sync () { |
Diana Picus | 09cd9b6 | 2016-04-25 18:04:06 +0300 | [diff] [blame] | 10 | if [ ! -d $2 ]; then |
| 11 | echo " + Not updating $1 (couldn't find source directory)" |
| 12 | return; |
| 13 | fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 14 | echo " + Updating $1" |
| 15 | cd $2 |
| 16 | branch=`get_branch` |
| 17 | safe_run git-refresh |
| 18 | safe_run git-rebase-all $branch |
| 19 | } |
| 20 | |
| 21 | prog=`basename $0` |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 22 | clang=false |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 23 | cextra=false |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 24 | rt=false |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 25 | libcxx=false |
| 26 | libcxxabi=false |
| 27 | libunwind=false |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 28 | linker=false |
| 29 | debug=false |
| 30 | tests=false |
| 31 | web=false |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 32 | if [ -d $LLVM_SRC/tools/clang ]; then clang=true; fi |
| 33 | if [ -d $LLVM_SRC/tools/clang/tools/extra ]; then cextra=true; fi |
| 34 | if [ -d $LLVM_SRC/projects/compiler-rt ]; then rt=true; fi |
| 35 | if [ -d $LLVM_SRC/projects/libcxx ]; then libcxx=true; fi |
| 36 | if [ -d $LLVM_SRC/projects/libcxxabi ]; then libcxxabi=true; fi |
| 37 | if [ -d $LLVM_SRC/projects/libunwind ]; then libunwind=true; fi |
| 38 | if [ -d $LLVM_SRC/tools/lld ]; then linker=true; fi |
| 39 | if [ -d $LLVM_SRC/tools/lldb ]; then debug=true; fi |
| 40 | if [ -d $LLVM_SRC/projects/test-suite ]; then tests=true; fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 41 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 42 | while getopts "wa" opt; do |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 43 | case $opt in |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 44 | w) |
| 45 | web=true |
| 46 | ;; |
| 47 | a) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 48 | clang=true |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 49 | cextra=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 50 | rt=true |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 51 | libcxx=true |
| 52 | libcxxabi=true |
| 53 | libunwind=true |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 54 | linker=true |
| 55 | debug=true |
| 56 | tests=true |
| 57 | ;; |
| 58 | *) |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 59 | echo "Syntax: $prog [-(w)eb pages] [-(a)ll]" |
| 60 | echo "Syncs the repos that are currently linked into the llvm source tree" |
| 61 | echo "-w forces sync for the web repos (which are never linked)" |
| 62 | echo "-a forces sync for non-web repos that are not linked" |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 63 | exit 1 |
| 64 | ;; |
| 65 | esac |
| 66 | done |
| 67 | |
| 68 | # Compulsory updates |
| 69 | repo_sync LLVM $LLVM_SRC |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 70 | |
| 71 | if $clang; then |
| 72 | repo_sync Clang $LLVM_SRC/../clang |
| 73 | fi |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 74 | |
| 75 | # Optional updates |
Diana Picus | 3124fb8 | 2016-04-25 15:37:25 +0300 | [diff] [blame] | 76 | if $cextra; then |
| 77 | repo_sync ClangToolsExtra $LLVM_SRC/../clang-tools-extra |
| 78 | fi |
| 79 | |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 80 | if $rt; then |
| 81 | repo_sync RT $LLVM_SRC/../compiler-rt |
| 82 | fi |
| 83 | |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 84 | if $libcxx; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 85 | repo_sync LibC++ $LLVM_SRC/../libcxx |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 86 | fi |
| 87 | |
| 88 | if $libcxxabi; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 89 | repo_sync LibC++ABI $LLVM_SRC/../libcxxabi |
Diana Picus | df02ca0 | 2016-05-03 13:44:42 +0300 | [diff] [blame] | 90 | fi |
| 91 | |
| 92 | if $libunwind; then |
Renato Golin | 94cc104 | 2016-04-26 11:02:23 +0100 | [diff] [blame] | 93 | repo_sync LibUnwind $LLVM_SRC/../libunwind |
| 94 | fi |
| 95 | |
| 96 | if $linker; then |
| 97 | repo_sync Linker $LLVM_SRC/../lld |
| 98 | fi |
| 99 | |
| 100 | if $debug; then |
| 101 | repo_sync Debugger $LLVM_SRC/../lldb |
| 102 | fi |
| 103 | |
| 104 | if $tests; then |
| 105 | repo_sync Test-Suite $LLVM_SRC/../test-suite |
| 106 | repo_sync LNT $LLVM_SRC/../lnt |
| 107 | repo_sync Zorg $LLVM_SRC/../zorg |
| 108 | fi |
| 109 | |
| 110 | # These are pure SVN repos, not enabled with -a |
| 111 | # You have to manually force with -w |
| 112 | if $web; then |
| 113 | if [ -d $LLVM_SRC/../www ]; then |
| 114 | echo " + Updating WWW" |
| 115 | cd $LLVM_SRC/../www |
| 116 | svn up |
| 117 | fi |
| 118 | if [ -d $LLVM_SRC/../pubs ]; then |
| 119 | echo " + Updating Pubs" |
| 120 | cd $LLVM_SRC/../pubs |
| 121 | svn up |
| 122 | fi |
| 123 | fi |