aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiancong Wang <tcwang@google.com>2020-08-25 13:48:30 -0700
committerTiancong Wang <tcwang@google.com>2020-08-25 21:44:26 +0000
commiteaed17704e9752dfd1f60f7f92a8f346ebdf1533 (patch)
treee96de879a97cf69aefbc5b3a1f9ae00f7c340945
parent4d7093dd6d1441fbc49e61e94d5912307f1436bb (diff)
downloadtoolchain-utils-eaed17704e9752dfd1f60f7f92a8f346ebdf1533.tar.gz
afdo_tools: Update update_kernel_afdo to check previous branch
When we just branch, and no profiles for the current canary branch can be found, we should check the profiles on previous branch. Also fix non-inclusive language in this patch. BUG=None TEST=kernel_afdo.json changes made locally Change-Id: I0de00274001ee7a120c40163ab93cb35e143acdf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2376170 Tested-by: Tiancong Wang <tcwang@google.com> Reviewed-by: Bob Haarman <inglorion@chromium.org>
-rwxr-xr-xafdo_tools/update_kernel_afdo21
1 files changed, 17 insertions, 4 deletions
diff --git a/afdo_tools/update_kernel_afdo b/afdo_tools/update_kernel_afdo
index 64e5e477..8f100a12 100755
--- a/afdo_tools/update_kernel_afdo
+++ b/afdo_tools/update_kernel_afdo
@@ -1,4 +1,7 @@
#!/bin/bash
+# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
# Due to crbug.com/1081332, we need to update AFDO metadata
# manually. This script performs a few checks and generates a
@@ -26,6 +29,7 @@
set -eu
set -o pipefail
+CROS_REPO=https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay
GS_BASE=gs://chromeos-prebuilt/afdo-job/vetted/kernel
KVERS="3.18 4.4 4.14 4.19"
errs=""
@@ -44,9 +48,11 @@ else
expected_time=$(date +%s -d "last Monday")
fi
-# Get the current master branch number (using beta + 1)
-beta=$(git ls-remote -h https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay | sed -n -e "s/^.*release-R\([0-9][0-9]*\).*$/\1/p" | sort -g | tail -1)
-master="$(($beta + 1))"
+# Get the current canary branch number (using beta + 1)
+beta=$(git ls-remote -h $CROS_REPO | \
+ sed -n -e "s/^.*release-R\([0-9][0-9]*\).*$/\1/p" | \
+ sort -g | tail -1)
+canary="$(($beta + 1))"
json="{"
sep=""
@@ -54,7 +60,14 @@ for kver in $KVERS
do
# Sort the gs output by timestamp (default ordering is by name, so
# R86-13310.3-1594633089.gcov.xz goes after R86-13310.18-1595237847.gcov.xz)
- latest=$(gsutil ls -l "$GS_BASE/$kver/" | sort -k2 | grep "R${master}" | tail -1)
+ latest=$(gsutil ls -l "$GS_BASE/$kver/" | sort -k2 | \
+ grep "R${canary}" | tail -1 || true)
+ if [ -z $latest ]
+ then
+ # if no profiles exist for R${canary}, try the previous branch
+ latest=$(gsutil ls -l "$GS_BASE/$kver/" | sort -k2 | \
+ grep "R${beta}" | tail -1)
+ fi
# Verify that the file has the expected date.
file_time=$(echo "$latest" | awk '{print $2}')