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

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).

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

Change-Id: I9c9f6ee2ab446f5e07ea577e11f0c3d562bff5e3
Commit-Queue: Tiancong Wang <>
Tested-by: Tiancong Wang <>
Reviewed-by: George Burgess <>
1 file changed