OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2014 Google Inc. | 2 # Copyright 2014 Google Inc. |
3 # | 3 # |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Syncs //depot/google3/third_party/skia/HEAD to the last known good revision of | 7 # Syncs //depot/google3/third_party/skia/HEAD to the latest revision of Skia. |
8 # Skia. If this script is not run from a Piper client, creates a new CitC | 8 # If this script is not run from a Piper client, creates a new CitC client. Also |
9 # client. Also updates README.google. | 9 # updates README.google. |
10 # | 10 # |
11 # Usage: | 11 # Usage: |
12 # ./tools/sync_google3.sh | 12 # ./tools/sync_google3.sh |
13 | 13 |
14 prodcertstatus -q || (echo "Please run prodaccess." 1>&2; exit 1) | 14 prodcertstatus -q || (echo "Please run prodaccess." 1>&2; exit 1) |
15 source gbash.sh || exit 2 | 15 source gbash.sh || exit 2 |
16 | 16 |
17 set -e | 17 set -e |
18 | 18 |
19 MY_DIR="$(gbash::get_absolute_caller_dir)" | 19 MY_DIR="$(gbash::get_absolute_caller_dir)" |
20 LKGR="$(${MY_DIR}/get_skia_lkgr.sh)" | 20 SKIA_REV="$(git ls-remote https://skia.googlesource.com/skia refs/heads/master |
cut -f 1)" |
21 | 21 |
22 gbash::get_google3_dir && GOOGLE3="$(gbash::get_google3_dir)" | 22 gbash::get_google3_dir && GOOGLE3="$(gbash::get_google3_dir)" |
23 if [ -z "${GOOGLE3}" ]; then | 23 if [ -z "${GOOGLE3}" ]; then |
24 CLIENT_NAME="sync_skia_$(date '+%F-%H-%M-%S')" | 24 CLIENT_NAME="sync_skia_$(date '+%F-%H-%M-%S')" |
25 ${MY_DIR}/create_skia_google3_client.sh "${CLIENT_NAME}" | 25 ${MY_DIR}/create_skia_google3_client.sh "${CLIENT_NAME}" |
26 GOOGLE3="/google/src/cloud/${USER}/${CLIENT_NAME}/google3" | 26 GOOGLE3="/google/src/cloud/${USER}/${CLIENT_NAME}/google3" |
27 fi | 27 fi |
28 cd "${GOOGLE3}/third_party/skia/HEAD" | 28 cd "${GOOGLE3}/third_party/skia/HEAD" |
29 ${MY_DIR}/git_clone_to_google3.sh --skia_rev "${LKGR}" | 29 ${MY_DIR}/git_clone_to_google3.sh --skia_rev "${SKIA_REV}" |
30 | 30 |
31 echo "Synced client ${CLIENT_NAME} to ${LKGR}" | 31 echo "Synced client ${CLIENT_NAME} to ${SKIA_REV}" |
32 | 32 |
33 # Update README.google. | 33 # Update README.google. |
34 sed --in-place "s/^Version: .*/Version: ${LKGR}/" README.google | 34 sed --in-place "s/^Version: .*/Version: ${SKIA_REV}/" README.google |
35 sed --in-place "s/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/.*\.tar\.
gz/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/${LKGR}.tar.gz/" README.
google | 35 sed --in-place "s/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/.*\.tar\.
gz/URL: http:\/\/skia.googlesource.com\/skia\/+archive\/${SKIA_REV}.tar.gz/" REA
DME.google |
36 CURRENT_DATE=`date '+%d %B %Y'` | 36 CURRENT_DATE=`date '+%d %B %Y'` |
37 echo "Updated using sync_google3.sh on $CURRENT_DATE by $USER@google.com" >> REA
DME.google | 37 echo "Updated using sync_google3.sh on $CURRENT_DATE by $USER@google.com" >> REA
DME.google |
38 | 38 |
39 # Add README.google to the default change. | 39 # Add README.google to the default change. |
40 g4 reopen | 40 g4 reopen |
41 # Create a new CL. | 41 # Create a new CL. |
42 CHANGE="$(g4 change --desc "Update skia HEAD to ${LKGR}.")" | 42 CHANGE="$(g4 change --desc "Update skia HEAD to ${SKIA_REV}.")" |
43 CL="$(echo "${CHANGE}" | sed "s/Change \([0-9]\+\) created.*/\1/")" | 43 CL="$(echo "${CHANGE}" | sed "s/Change \([0-9]\+\) created.*/\1/")" |
44 | 44 |
45 echo "Created CL ${CL} (http://cl/${CL})" | 45 echo "Created CL ${CL} (http://cl/${CL})" |
46 | 46 |
47 # Run presubmit (will run TAP tests). | 47 # Run presubmit (will run TAP tests). |
48 if g4 presubmit -c "${CL}"; then | 48 if g4 presubmit -c "${CL}"; then |
49 echo "CL is ready for review and submit at http://cl/${CL}" | 49 echo "CL is ready for review and submit at http://cl/${CL}" |
50 else | 50 else |
51 echo "Presubmit failed for CL ${CL} in client ${CLIENT_NAME}" 1>&2 | 51 echo "Presubmit failed for CL ${CL} in client ${CLIENT_NAME}" 1>&2 |
52 exit 3 | 52 exit 3 |
53 fi | 53 fi |
OLD | NEW |