diff options
author | SzuWei Lin <szuweilin@google.com> | 2021-08-19 22:37:22 +0800 |
---|---|---|
committer | SzuWei Lin <szuweilin@google.com> | 2021-08-20 15:00:29 +0800 |
commit | 7b356ef8851490656fa42da7ac747f16e68663ce (patch) | |
tree | a074e7cec2c2b65d70c5a32d6cf170911a750137 | |
parent | 4edc214bdc0ed68d917fb50b4afb46d3f6d32773 (diff) | |
download | development-7b356ef8851490656fa42da7ac747f16e68663ce.tar.gz |
Use curl to pick kernel binaries to dist
Bug: 196917167
Test: TH
Change-Id: Ibf15021cce6871fbe36e9b0ab91c249b5576c71a
-rwxr-xr-x | gsi/build_with_kernel/kernel_info_to_dist.sh | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/gsi/build_with_kernel/kernel_info_to_dist.sh b/gsi/build_with_kernel/kernel_info_to_dist.sh index 0fedfe368..76848b7e7 100755 --- a/gsi/build_with_kernel/kernel_info_to_dist.sh +++ b/gsi/build_with_kernel/kernel_info_to_dist.sh @@ -29,16 +29,31 @@ function download_kernel_info_files { local kernel_target=$2 local output_folder=$3 - cd "$output_folder" + local url_base="https://ci.android.com/builds/submitted/${bid}/${kernel_target}/latest" + local url_list="${url_base}/list.json" + local list_json="$(curl -sfL "$url_list")" + # do nothing and return if cannot get the file list + [[ -z "$list_json" ]] && return + # Pick manifest.xml if the file is not ready + local artifact_manifest="manifest_${bid}.xml" + local output_manifest="${output_folder}/manifest.xml" + if [[ ! -f "$output_manifest" ]]; then + echo "Pick ${artifact_manifest} to ${output_manifest}..." + curl -sfL "${url_base}/raw/${artifact_manifest}" -o "$output_manifest" + fi + + # Pick kernel binaries for f in "${KERNEL_INFO_FILES[@]}"; do - /google/data/ro/projects/android/fetch_artifact \ - --bid "$bid" \ - --target "$kernel_target" \ - "$f" || true - done + # The URL request always return 200 even the file does not exist, + # so we check it in the file list. Skip the file if it does not exist. + [[ "$list_json" =~ "\"name\":\"${f}\"" ]] || continue - cd - + local output="${output_folder}/$(basename "$f")" + + echo "Pick ${output}..." + curl -sfL "${url_base}/raw/${f}" -o "$output" + done } function download_all_kernel_info_files { |