aboutsummaryrefslogtreecommitdiff
path: root/helpers/llvm-sync
blob: 0374221f30e44aac495c9a4e80b260ec3b329013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash

# This script checks out all repositories from upstream and pushes master
# to the origin repo on Linaro's Git server, rebasing all local branches,
# but *not* pushing them, too.

. llvm-common

function repo_sync () {
  if [ ! -d $2 ]; then
    echo " + Not updating $1 (couldn't find source directory)"
    return;
  fi
  echo " + Updating $1"
  cd $2
  branch=`get_branch`
  safe_run git-refresh
  safe_run git-rebase-all $branch
}

prog=`basename $0`
clang=false
cextra=false
rt=false
libcxx=false
libcxxabi=false
libunwind=false
linker=false
debug=false
tests=false
web=false
if [ -d $LLVM_SRC/tools/clang ]; then clang=true; fi
if [ -d $LLVM_SRC/tools/clang/tools/extra ]; then cextra=true; fi
if [ -d $LLVM_SRC/projects/compiler-rt ]; then rt=true; fi
if [ -d $LLVM_SRC/projects/libcxx ]; then libcxx=true; fi
if [ -d $LLVM_SRC/projects/libcxxabi ]; then libcxxabi=true; fi
if [ -d $LLVM_SRC/projects/libunwind ]; then libunwind=true; fi
if [ -d $LLVM_SRC/tools/lld ]; then linker=true; fi
if [ -d $LLVM_SRC/tools/lldb ]; then debug=true; fi
if [ -d $LLVM_SRC/projects/test-suite ]; then tests=true; fi

while getopts "wa" opt; do
  case $opt in
    w)
      web=true
      ;;
    a)
      clang=true
      cextra=true
      rt=true
      libcxx=true
      libcxxabi=true
      libunwind=true
      linker=true
      debug=true
      tests=true
      ;;
    *)
      echo "Syntax: $prog [-(w)eb pages] [-(a)ll]"
      echo "Syncs the repos that are currently linked into the llvm source tree"
      echo "-w forces sync for the web repos (which are never linked)"
      echo "-a forces sync for non-web repos that are not linked"
      exit 1
      ;;
  esac
done

# Compulsory updates
repo_sync LLVM $LLVM_SRC

if $clang; then
  repo_sync Clang $LLVM_SRC/../clang
fi

# Optional updates
if $cextra; then
  repo_sync ClangToolsExtra $LLVM_SRC/../clang-tools-extra
fi

if $rt; then
  repo_sync RT $LLVM_SRC/../compiler-rt
fi

if $libcxx; then
  repo_sync LibC++ $LLVM_SRC/../libcxx
fi

if $libcxxabi; then
  repo_sync LibC++ABI $LLVM_SRC/../libcxxabi
fi

if $libunwind; then
  repo_sync LibUnwind $LLVM_SRC/../libunwind
fi

if $linker; then
  repo_sync Linker $LLVM_SRC/../lld
fi

if $debug; then
  repo_sync Debugger $LLVM_SRC/../lldb
fi

if $tests; then
  repo_sync Test-Suite $LLVM_SRC/../test-suite
  repo_sync LNT $LLVM_SRC/../lnt
  repo_sync Zorg $LLVM_SRC/../zorg
fi

# These are pure SVN repos, not enabled with -a
# You have to manually force with -w
if $web; then
  if [ -d $LLVM_SRC/../www ]; then
    echo " + Updating WWW"
    cd $LLVM_SRC/../www
    svn up
  fi
  if [ -d $LLVM_SRC/../pubs ]; then
    echo " + Updating Pubs"
    cd $LLVM_SRC/../pubs
    svn up
  fi
fi