Skip to content

Instantly share code, notes, and snippets.

@petrhosek
Created February 7, 2017 00:38
Show Gist options
  • Save petrhosek/731008a469ddbdabeaae3ae5f12772ed to your computer and use it in GitHub Desktop.
Save petrhosek/731008a469ddbdabeaae3ae5f12772ed to your computer and use it in GitHub Desktop.
Checkout LLVM from Git
#!/usr/bin/env bash
readonly REPOSITORIES=(
"http://llvm.org/git/llvm.git llvm llvm"
"http://llvm.org/git/clang.git cfe llvm/tools/clang"
"http://llvm.org/git/lld.git lld llvm/tools/lld"
"http://llvm.org/git/lldb.git lldb llvm/tools/lldb"
"http://llvm.org/git/compiler-rt.git compiler-rt llvm/runtimes/compiler-rt"
"http://llvm.org/git/libcxx.git libcxx llvm/projects/libcxx"
"http://llvm.org/git/libcxxabi.git libcxxabi llvm/projects/libcxxabi"
"http://llvm.org/git/libunwind.git libunwind llvm/projects/libunwind"
)
set -eo pipefail; [[ "$TRACE" ]] && set -x
usage() {
printf >&2 '%s: [-u username]\n' "$0" && exit 1
}
clone() {
git clone $1 $3
pushd $3
git svn init https://llvm.org/svn/llvm-project/$2/trunk --username=$USERNAME
git config svn-remote.svn.fetch :refs/remotes/origin/master
git svn rebase -l
popd
}
main() {
while getopts "h:u:" opt; do
case $opt in
h)
usage
;;
u)
USERNAME="$OPTARG"
;;
\? )
echo "Unknown option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
for i in "${REPOSITORIES[@]}"; do
clone $i
done
}
main "$@"
#!/usr/bin/env bash
readonly REPOSITORIES=(
"http://llvm.org/git/llvm.git llvm llvm"
"http://llvm.org/git/clang.git cfe llvm/tools/clang"
"http://llvm.org/git/lld.git lld llvm/tools/lld"
"http://llvm.org/git/lldb.git lldb llvm/tools/lldb"
"http://llvm.org/git/compiler-rt.git compiler-rt llvm/runtimes/compiler-rt"
"http://llvm.org/git/libcxx.git libcxx llvm/runtimes/libcxx"
"http://llvm.org/git/libcxxabi.git libcxxabi llvm/runtimes/libcxxabi"
"http://llvm.org/git/libunwind.git libunwind llvm/runtimes/libunwind"
)
set -eo pipefail; [[ "$TRACE" ]] && set -x
usage() {
printf >&2 '%s\n' "$0" && exit 1
}
fetch() {
pushd $3
git checkout master
git fetch
git svn rebase -l
popd
}
main() {
while getopts "h:u:" opt; do
case $opt in
h)
usage
;;
\? )
echo "Unknown option: -$OPTARG" 1>&2
exit 1
;;
esac
done
shift $((OPTIND - 1))
for i in "${REPOSITORIES[@]}"; do
fetch $i
done
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment