Skip to content

Commit

Permalink
Get Clang revision from a file rather than grepping DEPS
Browse files Browse the repository at this point in the history
Grepping the clang_revision line out of DEPS is ugly.  It requires
other repositories to use the File() syntax in their DEPS just to
get the chromium/src/DEPS file so that tools/clang/scripts/update.sh
can grep it.  File() is de facto deprecated and it's not supported by
the .DEPS.git conversion tools, so this is a barrier to converting
dependent repositories such as native_client, as well as being ugly.

Instead, just keep the Clang revision number in the script that uses it.

When this lands, http://code.google.com/p/chromium/wiki/UpdatingClang
must be updated to describe updating the tools/clang/scripts/update.sh script.

BUG= http://code.google.com/p/chromium/issues/detail?id=102682
TEST= ran tools/clang/scripts/update.sh successfully

R=thakis@chromium.org,nsylvain@google.com

Review URL: http://codereview.chromium.org/8438021

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108736 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mcgrathr@chromium.org committed Nov 4, 2011
1 parent 5e12002 commit 1c1a0b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 32 deletions.
6 changes: 0 additions & 6 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ vars = {
"v8_revision": "9637",
"webrtc_revision": "883",
"jsoncpp_revision": "246",

# Note: On most bots, clang is not checked out via DEPS but by
# tools/clang/scripts/update.sh. The script reads this line here.
# Do NOT CHANGE this if you don't know what you're doing -- see
# http://code.google.com/p/chromium/wiki/UpdatingClang
"clang_revision": "142926",
}

deps = {
Expand Down
38 changes: 12 additions & 26 deletions tools/clang/scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

# This script will check out llvm and clang into third_party/llvm and build it.

# Do NOT CHANGE this if you don't know what you're doing -- see
# http://code.google.com/p/chromium/wiki/UpdatingClang
CLANG_REVISION=142926

THIS_DIR="$(dirname "${0}")"
LLVM_DIR="${THIS_DIR}/../../../third_party/llvm"
LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build"
CLANG_DIR="${LLVM_DIR}/tools/clang"
DEPS_FILE="${THIS_DIR}/../../../DEPS"
if [ -e "${THIS_DIR}/../../../chromium_deps/DEPS" ]; then
# For bare WebKit/chromium checkouts.
DEPS_FILE="${THIS_DIR}/../../../chromium_deps/DEPS"
fi
STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision"

# ${A:-a} returns $A if it's set, a else.
Expand Down Expand Up @@ -85,11 +84,6 @@ if [[ "${OS}" = "Darwin" ]] && xcodebuild -version | grep -q 'Xcode 3.2' ; then
fi


# Since people need to run this script anyway to compile clang, let it check out
# clang as well if it's not in DEPS, so that people don't have to change their
# DEPS if they just want to give clang a try.
CLANG_REVISION=$(grep 'clang_revision":' "${DEPS_FILE}" | egrep -o [[:digit:]]+)

# Check if there's anything to be done, exit early if not.
if [ -f "${STAMP_FILE}" ]; then
PREVIOUSLY_BUILT_REVISON=$(cat "${STAMP_FILE}")
Expand Down Expand Up @@ -155,24 +149,16 @@ if [ -z "$force_local_build" ]; then
fi
fi

if grep -q 'src/third_party/llvm":' "${DEPS_FILE}"; then
echo LLVM pulled in through DEPS, skipping LLVM update step
else
echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
"${LLVM_DIR}"; then
echo Checkout failed, retrying
rm -rf "${LLVM_DIR}"
svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
fi
echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
"${LLVM_DIR}"; then
echo Checkout failed, retrying
rm -rf "${LLVM_DIR}"
svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" "${LLVM_DIR}"
fi

if grep -q 'src/third_party/llvm/tools/clang":' "${DEPS_FILE}"; then
echo clang pulled in through DEPS, skipping clang update step
else
echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"
fi
echo Getting clang r"${CLANG_REVISION}" in "${CLANG_DIR}"
svn co --force "${LLVM_REPO_URL}/cfe/trunk@${CLANG_REVISION}" "${CLANG_DIR}"

# Echo all commands.
set -x
Expand Down

0 comments on commit 1c1a0b3

Please sign in to comment.