blob: 0374221f30e44aac495c9a4e80b260ec3b329013 [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#!/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
9function repo_sync () {
Diana Picus09cd9b62016-04-25 18:04:06 +030010 if [ ! -d $2 ]; then
11 echo " + Not updating $1 (couldn't find source directory)"
12 return;
13 fi
Renato Golin94cc1042016-04-26 11:02:23 +010014 echo " + Updating $1"
15 cd $2
16 branch=`get_branch`
17 safe_run git-refresh
18 safe_run git-rebase-all $branch
19}
20
21prog=`basename $0`
Diana Picusdf02ca02016-05-03 13:44:42 +030022clang=false
Diana Picus3124fb82016-04-25 15:37:25 +030023cextra=false
Renato Golin94cc1042016-04-26 11:02:23 +010024rt=false
Diana Picusdf02ca02016-05-03 13:44:42 +030025libcxx=false
26libcxxabi=false
27libunwind=false
Renato Golin94cc1042016-04-26 11:02:23 +010028linker=false
29debug=false
30tests=false
31web=false
Diana Picusdf02ca02016-05-03 13:44:42 +030032if [ -d $LLVM_SRC/tools/clang ]; then clang=true; fi
33if [ -d $LLVM_SRC/tools/clang/tools/extra ]; then cextra=true; fi
34if [ -d $LLVM_SRC/projects/compiler-rt ]; then rt=true; fi
35if [ -d $LLVM_SRC/projects/libcxx ]; then libcxx=true; fi
36if [ -d $LLVM_SRC/projects/libcxxabi ]; then libcxxabi=true; fi
37if [ -d $LLVM_SRC/projects/libunwind ]; then libunwind=true; fi
38if [ -d $LLVM_SRC/tools/lld ]; then linker=true; fi
39if [ -d $LLVM_SRC/tools/lldb ]; then debug=true; fi
40if [ -d $LLVM_SRC/projects/test-suite ]; then tests=true; fi
Renato Golin94cc1042016-04-26 11:02:23 +010041
Diana Picusdf02ca02016-05-03 13:44:42 +030042while getopts "wa" opt; do
Renato Golin94cc1042016-04-26 11:02:23 +010043 case $opt in
Renato Golin94cc1042016-04-26 11:02:23 +010044 w)
45 web=true
46 ;;
47 a)
Diana Picusdf02ca02016-05-03 13:44:42 +030048 clang=true
Diana Picus3124fb82016-04-25 15:37:25 +030049 cextra=true
Renato Golin94cc1042016-04-26 11:02:23 +010050 rt=true
Diana Picusdf02ca02016-05-03 13:44:42 +030051 libcxx=true
52 libcxxabi=true
53 libunwind=true
Renato Golin94cc1042016-04-26 11:02:23 +010054 linker=true
55 debug=true
56 tests=true
57 ;;
58 *)
Diana Picusdf02ca02016-05-03 13:44:42 +030059 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 Golin94cc1042016-04-26 11:02:23 +010063 exit 1
64 ;;
65 esac
66done
67
68# Compulsory updates
69repo_sync LLVM $LLVM_SRC
Diana Picusdf02ca02016-05-03 13:44:42 +030070
71if $clang; then
72 repo_sync Clang $LLVM_SRC/../clang
73fi
Renato Golin94cc1042016-04-26 11:02:23 +010074
75# Optional updates
Diana Picus3124fb82016-04-25 15:37:25 +030076if $cextra; then
77 repo_sync ClangToolsExtra $LLVM_SRC/../clang-tools-extra
78fi
79
Renato Golin94cc1042016-04-26 11:02:23 +010080if $rt; then
81 repo_sync RT $LLVM_SRC/../compiler-rt
82fi
83
Diana Picusdf02ca02016-05-03 13:44:42 +030084if $libcxx; then
Renato Golin94cc1042016-04-26 11:02:23 +010085 repo_sync LibC++ $LLVM_SRC/../libcxx
Diana Picusdf02ca02016-05-03 13:44:42 +030086fi
87
88if $libcxxabi; then
Renato Golin94cc1042016-04-26 11:02:23 +010089 repo_sync LibC++ABI $LLVM_SRC/../libcxxabi
Diana Picusdf02ca02016-05-03 13:44:42 +030090fi
91
92if $libunwind; then
Renato Golin94cc1042016-04-26 11:02:23 +010093 repo_sync LibUnwind $LLVM_SRC/../libunwind
94fi
95
96if $linker; then
97 repo_sync Linker $LLVM_SRC/../lld
98fi
99
100if $debug; then
101 repo_sync Debugger $LLVM_SRC/../lldb
102fi
103
104if $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
108fi
109
110# These are pure SVN repos, not enabled with -a
111# You have to manually force with -w
112if $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
123fi