Colin Cross | 4c80838 | 2019-11-13 11:16:07 -0800 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | |
| 3 | if [ -z $1 ]; then |
| 4 | echo "usage: $0 <build number>" |
| 5 | exit 1 |
| 6 | fi |
| 7 | |
| 8 | readonly BUILD_NUMBER=$1 |
| 9 | |
| 10 | cd "$(dirname $0)" |
| 11 | |
| 12 | if ! git diff HEAD --quiet; then |
| 13 | echo "must be run with a clean prebuilts/build-tools project" |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | readonly tmpdir=$(mktemp -d) |
| 18 | |
| 19 | function finish { |
| 20 | if [ ! -z "${tmpdir}" ]; then |
| 21 | rm -rf "${tmpdir}" |
| 22 | fi |
| 23 | } |
| 24 | trap finish EXIT |
| 25 | |
| 26 | function fetch_artifact() { |
| 27 | /google/data/ro/projects/android/fetch_artifact --bid ${BUILD_NUMBER} --target $1 "$2" "$3" |
| 28 | } |
| 29 | |
| 30 | fetch_artifact linux build-prebuilts.zip "${tmpdir}/linux.zip" |
| 31 | fetch_artifact linux build-common-prebuilts.zip "${tmpdir}/common.zip" |
| 32 | fetch_artifact linux manifest_${BUILD_NUMBER}.xml "${tmpdir}/manifest.xml" |
| 33 | fetch_artifact darwin_mac build-prebuilts.zip "${tmpdir}/darwin.zip" |
| 34 | |
| 35 | function unzip_to() { |
| 36 | rm -rf "$1" |
| 37 | mkdir "$1" |
| 38 | unzip -q -d "$1" "$2" |
| 39 | } |
| 40 | |
| 41 | unzip_to linux-x86 "${tmpdir}/linux.zip" |
| 42 | unzip_to common "${tmpdir}/common.zip" |
| 43 | unzip_to darwin-x86 "${tmpdir}/darwin.zip" |
| 44 | |
| 45 | cp -f "${tmpdir}/manifest.xml" manifest.xml |
| 46 | |
| 47 | git add manifest.xml linux-x86 darwin-x86 common |
| 48 | git commit -m "Update build-tools to ab/${BUILD_NUMBER} |
| 49 | |
| 50 | https://ci.android.com/builds/branches/aosp-build-tools/grid?head=${BUILD_NUMBER}&tail=${BUILD_NUMBER} |
| 51 | |
| 52 | Test: treehugger" |