afdo_tools: Update script to sort profiles by timestamp

Our update_kernel_afdo tries to get all the profiles with gsutil.
However, the command gives results by sorting the profile name,
so the last profile is not necessarily the newest. A counter
example is:
R86-13310.3-1594633089.gcov.xz appears after
R86-13310.18-1595237847.gcov.xz

So this patch sorts the results of gsutil by the timestamp and
grep all the master profiles (otherwise we might get some
beta/stable profiles).

BUG=None
TEST=Tool can be used to generate kernel_afdo.json CL

Change-Id: I9c9f6ee2ab446f5e07ea577e11f0c3d562bff5e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2321122
Commit-Queue: Tiancong Wang <tcwang@google.com>
Tested-by: Tiancong Wang <tcwang@google.com>
Reviewed-by: George Burgess <gbiv@chromium.org>
1 file changed