#!/usr/bin/env bash # This script pulls all repositories selected with llvm-projs and rebases the # current branch on top of the new master. . llvm-common safe_run verify_env function repo_sync () { project=$1 repo_dir=$2 worktree_dir=$3 if [ ! -d $repo_dir ]; then echo " + Not updating $project (couldn't find source directory)" return; fi if [ ! -d $worktree_dir ]; then echo " + Not updating $project (couldn't find worktree directory)" return; fi echo " + Updating $project" # To pull master, we must be in the repo dir (we shouldn't checkout master in # the worktree dirs - by default, master lives in the repo dir) cd $repo_dir safe_run git-refresh # To rebase the current branch, we must be in the worktree dir (we shouldn't # checkout the current branch in the repo dir, because it is already checked # out in the worktree dir) cd $worktree_dir safe_run git-rebase } prog=`basename $0` clang=false rt=false libcxx=false libcxxabi=false libunwind=false linker=false debug=false tests=false web=false clang_workdir=$LLVM_SRC/tools/clang rt_workdir=$LLVM_SRC/projects/compiler-rt libcxx_workdir=$LLVM_SRC/projects/libcxx libcxxabi_workdir=$LLVM_SRC/projects/libcxxabi libunwind_workdir=$LLVM_SRC/projects/libunwind lld_workdir=$LLVM_SRC/tools/lld lldb_workdir=$LLVM_SRC/tools/lldb test_workdir=$LLVM_SRC/projects/test-suite if [ -d $clang_workdir ]; then clang=true; fi if [ -d $rt_workdir ]; then rt=true; fi if [ -d $libcxx_workdir ]; then libcxx=true; fi if [ -d $libcxxabi_workdir ]; then libcxxabi=true; fi if [ -d $libunwind_workdir ]; then libunwind=true; fi if [ -d $lld_workdir ]; then linker=true; fi if [ -d $lldb_workdir ]; then debug=true; fi if [ -d $test_workdir ]; then tests=true; fi while getopts "wa" opt; do case $opt in w) web=true ;; a) clang=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 llvm_repos=$LLVM_ROOT/repos # Compulsory updates repo_sync LLVM $llvm_repos/llvm $LLVM_SRC if $clang; then repo_sync Clang $llvm_repos/clang $clang_workdir fi if $rt; then repo_sync RT $llvm_repos/compiler-rt $rt_workdir fi if $libcxx; then repo_sync LibC++ $llvm_repos/libcxx $libcxx_workdir fi if $libcxxabi; then repo_sync LibC++ABI $llvm_repos/libcxxabi $libcxxabi_workdir fi if $libunwind; then repo_sync LibUnwind $llvm_repos/libunwind $libunwind_workdir fi if $linker; then repo_sync Linker $llvm_repos/lld $lld_workdir fi if $debug; then repo_sync Debugger $llvm_repos/lldb $lldb_workdir fi if $tests; then repo_sync Test-Suite $llvm_repos/test-suite $test_workdir repo_sync LNT $llvm_repos/lnt $llvm_repos/lnt repo_sync Zorg $llvm_repos/zorg $llvm_repos/zorg fi # These are pure SVN repos, not enabled with -a # You have to manually force with -w if $web; then if [ -d $llvm_repos/www ]; then echo " + Updating WWW" cd $llvm_repos/www $llvm_repos/www svn up fi if [ -d $llvm_repos/pubs ]; then echo " + Updating Pubs" cd $llvm_repos/pubs $llvm_repos/pubs svn up fi fi