diff options
author | Neil Fuller <nfuller@google.com> | 2021-06-14 16:28:43 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2021-06-14 16:28:43 +0000 |
commit | f0df97945b4fdddd066170b120f192941b8d7fbf (patch) | |
tree | 99024a2bbbd3b3b16d007ab57ebf8052f0d49956 /android/tools/host | |
parent | 0bed5d61b29c35d7730a3bd74ea87e254cec37e0 (diff) | |
parent | 82d8ad561d41166e75523f46600280160b6031a7 (diff) | |
download | timezone-boundary-builder-android13-mainline-go-mediaprovider-release.tar.gz |
Android additions to timezone-boundary-builder am: 4fd94cfcf9 am: 1d4954a75e am: 416012905c am: 82d8ad561dt_frc_odp_330442040t_frc_odp_330442000t_frc_con_330443020t_frc_cbr_330443000t_frc_ase_330444010t_frc_art_330443060t_frc_adb_330444000frc_340821000frc_340819280frc_340819220frc_340819190frc_340819030frc_340819020frc_340819010frc_340818170frc_340818110android-vts-14.0_r4android-vts-14.0_r3android-vts-14.0_r2android-vts-14.0_r1android-u-beta-1-gplandroid-security-14.0.0_r9android-security-14.0.0_r8android-security-14.0.0_r7android-security-14.0.0_r6android-security-14.0.0_r5android-security-14.0.0_r4android-security-14.0.0_r3android-security-14.0.0_r2android-security-14.0.0_r10android-security-14.0.0_r1android-platform-14.0.0_r9android-platform-14.0.0_r8android-platform-14.0.0_r7android-platform-14.0.0_r6android-platform-14.0.0_r5android-platform-14.0.0_r4android-platform-14.0.0_r3android-platform-14.0.0_r2android-platform-14.0.0_r1android-cts-14.0_r4android-cts-14.0_r3android-cts-14.0_r2android-cts-14.0_r1android-14.0.0_r9android-14.0.0_r8android-14.0.0_r7android-14.0.0_r6android-14.0.0_r54android-14.0.0_r53android-14.0.0_r52android-14.0.0_r51android-14.0.0_r50android-14.0.0_r5android-14.0.0_r45android-14.0.0_r44android-14.0.0_r43android-14.0.0_r42android-14.0.0_r41android-14.0.0_r40android-14.0.0_r4android-14.0.0_r39android-14.0.0_r38android-14.0.0_r37android-14.0.0_r36android-14.0.0_r35android-14.0.0_r34android-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r3android-14.0.0_r29android-14.0.0_r28android-14.0.0_r27android-14.0.0_r26android-14.0.0_r25android-14.0.0_r24android-14.0.0_r23android-14.0.0_r22android-14.0.0_r21android-14.0.0_r20android-14.0.0_r2android-14.0.0_r19android-14.0.0_r18android-14.0.0_r17android-14.0.0_r16android-14.0.0_r15android-14.0.0_r14android-14.0.0_r13android-14.0.0_r12android-14.0.0_r11android-14.0.0_r10android-14.0.0_r1android-13.0.0_r83android-13.0.0_r82android-13.0.0_r81android-13.0.0_r80android-13.0.0_r79android-13.0.0_r78android-13.0.0_r77android-13.0.0_r76android-13.0.0_r75android-13.0.0_r74android-13.0.0_r73android-13.0.0_r72android-13.0.0_r71android-13.0.0_r70android-13.0.0_r69android-13.0.0_r68android-13.0.0_r67android-13.0.0_r66android-13.0.0_r65android-13.0.0_r64android-13.0.0_r63android-13.0.0_r62android-13.0.0_r61android-13.0.0_r60android-13.0.0_r59android-13.0.0_r58android-13.0.0_r57android-13.0.0_r56android-13.0.0_r55android-13.0.0_r54android-13.0.0_r53android-13.0.0_r52android-13.0.0_r51android-13.0.0_r50android-13.0.0_r49android-13.0.0_r48android-13.0.0_r47android-13.0.0_r46android-13.0.0_r45android-13.0.0_r44android-13.0.0_r43android-13.0.0_r42android-13.0.0_r41android-13.0.0_r40android-13.0.0_r39android-13.0.0_r38android-13.0.0_r37android-13.0.0_r36android-13.0.0_r35android-13.0.0_r34android-13.0.0_r33android-13.0.0_r32android-13.0.0_r30android-13.0.0_r29android-13.0.0_r28android-13.0.0_r27android-13.0.0_r24android-13.0.0_r23android-13.0.0_r22android-13.0.0_r21android-13.0.0_r20android-13.0.0_r19android-13.0.0_r18android-13.0.0_r17android-13.0.0_r16aml_uwb_341710010aml_uwb_341513070aml_uwb_341511050aml_uwb_341310300aml_uwb_341310030aml_uwb_341111010aml_uwb_341011000aml_uwb_331910010aml_uwb_331820070aml_uwb_331613010aml_uwb_331611010aml_uwb_331410010aml_uwb_331310030aml_uwb_331115000aml_uwb_331015040aml_uwb_330810010aml_tz5_341510070aml_tz5_341510050aml_tz5_341510010aml_tz4_332714070aml_tz4_332714050aml_tz4_332714010aml_tz4_331910000aml_tz4_331314030aml_tz4_331314020aml_tz4_331314010aml_tz4_331012050aml_tz4_331012040aml_tz4_331012000aml_rkp_341510000aml_rkp_341311000aml_rkp_341114000aml_rkp_341015010aml_rkp_341012000aml_odp_341717000aml_odp_341610000aml_hef_341717050aml_hef_341613000aml_hef_341512030aml_hef_341415040aml_hef_341311010aml_hef_341114030aml_go_wif_330911000aml_go_uwb_330912000aml_go_tz4_330912000aml_go_tet_330914010aml_go_swc_330913000aml_go_sta_330911000aml_go_sdk_330810000aml_go_sch_330911000aml_go_res_330912000aml_go_per_330912000aml_go_odp_330913000aml_go_odp_330912000aml_go_neu_330912000aml_go_net_330913000aml_go_mpr_330912000aml_go_ase_330913000aml_go_ads_330915100aml_go_ads_330915000aml_go_ads_330913000aml_go_adb_330913000aml_cfg_341510000aml_ase_341510000aml_ase_341410000aml_ase_341310010aml_ase_341113000aml_ase_340913000aml_ase_331311020aml_ase_331112000aml_ase_331011020aml_ads_341720000aml_ads_341615050aml_ads_341517040aml_ads_341413000aml_ads_341316030aml_ads_341131050aml_ads_341027030aml_ads_340915050aml_ads_331920180aml_ads_331814200aml_ads_331710270aml_ads_331611190aml_ads_331511020aml_ads_331418080aml_ads_331131000main-16k-with-phonesmain-16kandroid14-tests-releaseandroid14-security-releaseandroid14-s2-releaseandroid14-s1-releaseandroid14-releaseandroid14-qpr3-s2-releaseandroid14-qpr3-releaseandroid14-qpr2-s5-releaseandroid14-qpr2-s4-releaseandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-releaseandroid14-qpr1-s2-releaseandroid14-qpr1-releaseandroid14-platform-releaseandroid14-mainline-uwb-releaseandroid14-mainline-healthfitness-releaseandroid14-mainline-appsearch-releaseandroid14-mainline-adservices-releaseandroid14-gsiandroid14-devandroid14-d2-s5-releaseandroid14-d2-s4-releaseandroid14-d2-s3-releaseandroid14-d2-s2-releaseandroid14-d2-s1-releaseandroid14-d2-releaseandroid14-d1-s7-releaseandroid14-d1-s6-releaseandroid14-d1-s5-releaseandroid14-d1-s4-releaseandroid14-d1-s3-releaseandroid14-d1-s2-releaseandroid14-d1-s1-releaseandroid14-d1-releaseandroid13-qpr3-s9-releaseandroid13-qpr3-s8-releaseandroid13-qpr3-s7-releaseandroid13-qpr3-s6-releaseandroid13-qpr3-s5-releaseandroid13-qpr3-s4-releaseandroid13-qpr3-s3-releaseandroid13-qpr3-s2-releaseandroid13-qpr3-s14-releaseandroid13-qpr3-s13-releaseandroid13-qpr3-s12-releaseandroid13-qpr3-s11-releaseandroid13-qpr3-s10-releaseandroid13-qpr3-s1-releaseandroid13-qpr3-releaseandroid13-qpr3-c-s8-releaseandroid13-qpr3-c-s7-releaseandroid13-qpr3-c-s6-releaseandroid13-qpr3-c-s5-releaseandroid13-qpr3-c-s4-releaseandroid13-qpr3-c-s3-releaseandroid13-qpr3-c-s2-releaseandroid13-qpr3-c-s12-releaseandroid13-qpr3-c-s11-releaseandroid13-qpr3-c-s10-releaseandroid13-qpr3-c-s1-releaseandroid13-qpr2-s9-releaseandroid13-qpr2-s8-releaseandroid13-qpr2-s7-releaseandroid13-qpr2-s6-releaseandroid13-qpr2-s5-releaseandroid13-qpr2-s3-releaseandroid13-qpr2-s2-releaseandroid13-qpr2-s12-releaseandroid13-qpr2-s11-releaseandroid13-qpr2-s10-releaseandroid13-qpr2-s1-releaseandroid13-qpr2-releaseandroid13-qpr2-b-s1-releaseandroid13-qpr1-s8-releaseandroid13-qpr1-s7-releaseandroid13-qpr1-s6-releaseandroid13-qpr1-s5-releaseandroid13-qpr1-s4-releaseandroid13-qpr1-s3-releaseandroid13-qpr1-s2-releaseandroid13-qpr1-s1-releaseandroid13-qpr1-releaseandroid13-mainline-uwb-releaseandroid13-mainline-tzdata4-releaseandroid13-mainline-go-wifi-releaseandroid13-mainline-go-uwb-releaseandroid13-mainline-go-tzdata4-releaseandroid13-mainline-go-tethering-releaseandroid13-mainline-go-sdkext-releaseandroid13-mainline-go-scheduling-releaseandroid13-mainline-go-resolv-releaseandroid13-mainline-go-permission-releaseandroid13-mainline-go-os-statsd-releaseandroid13-mainline-go-odp-releaseandroid13-mainline-go-neuralnetworks-releaseandroid13-mainline-go-networking-releaseandroid13-mainline-go-mediaprovider-releaseandroid13-mainline-go-media-swcodec-releaseandroid13-mainline-go-appsearch-releaseandroid13-mainline-go-adservices-releaseandroid13-mainline-go-adbd-releaseandroid13-mainline-appsearch-releaseandroid13-mainline-adservices-releaseandroid13-frc-odp-releaseandroid13-frc-conscrypt-releaseandroid13-frc-cellbroadcast-releaseandroid13-frc-art-releaseandroid13-frc-adbd-releaseandroid13-devandroid13-d4-s2-releaseandroid13-d4-s1-releaseandroid13-d4-releaseandroid13-d3-s1-releaseandroid13-d2-releaseaml_tz5_341510010aml_tz4_332714010
Original change: https://android-review.googlesource.com/c/platform/external/timezone-boundary-builder/+/1287532
Change-Id: If7974414a9ec64c02181defa0f6ff3d261d00e2c
Diffstat (limited to 'android/tools/host')
-rw-r--r-- | android/tools/host/Dockerfile | 15 | ||||
-rwxr-xr-x | android/tools/host/clear_android_data_files.sh | 35 | ||||
-rwxr-xr-x | android/tools/host/common.sh | 37 | ||||
-rwxr-xr-x | android/tools/host/download_input_files.sh | 106 | ||||
-rwxr-xr-x | android/tools/host/run_process_in_docker.sh | 30 | ||||
-rwxr-xr-x | android/tools/host/run_tzbb.sh | 25 |
6 files changed, 248 insertions, 0 deletions
diff --git a/android/tools/host/Dockerfile b/android/tools/host/Dockerfile new file mode 100644 index 0000000..72e0d79 --- /dev/null +++ b/android/tools/host/Dockerfile @@ -0,0 +1,15 @@ +FROM node:12 +ARG userid +ARG groupid +ARG username +ARG tzbbroot + +RUN apt-get update && apt-get install -y gdal-bin zip + +# Set up the user so that files are owned by the proper user +RUN groupadd -g $groupid $username \ + && useradd -m -u $userid -g $groupid $username +RUN mkdir -p $tzbbroot && chown $userid $tzbbroot +ENV DOCKER=true +USER $username + diff --git a/android/tools/host/clear_android_data_files.sh b/android/tools/host/clear_android_data_files.sh new file mode 100755 index 0000000..be59d8b --- /dev/null +++ b/android/tools/host/clear_android_data_files.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Fail fast on any error. +set -e + +HOST_TOOLS_DIR=$(realpath $(dirname $0)) +source ${HOST_TOOLS_DIR}/common.sh + +DIRS=(\ + ${HOST_INPUTS_DIR}\ + ${HOST_DOWNLOADS_DIR}\ + ${HOST_DIST_DIR}\ +) + +for DIR in ${DIRS[@]}; do + echo Deleting content of ${DIR} + rm -f ${DIR}/* + # Just in case + mkdir -p ${DIR} +done + diff --git a/android/tools/host/common.sh b/android/tools/host/common.sh new file mode 100755 index 0000000..cf9896a --- /dev/null +++ b/android/tools/host/common.sh @@ -0,0 +1,37 @@ +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [[ -z "${HOST_TOOLS_DIR}" ]]; then + echo HOST_TOOLS_DIR not set + exit 1 +fi + +# The android_ prefix is to get around the upstream project's .gitignore rules +# for dist / downloads. Android will want to commit them to version control to +# improve change tracking / repeatability and avoid unnecessary load on OSM +# servers. +INPUTS_DIR=android_inputs +DOWNLOADS_DIR=android_downloads +DIST_DIR=android_dist + +CONTAINER_ANDROID_DIR=./android +CONTAINER_DOWNLOADS_DIR=${CONTAINER_ANDROID_DIR}/${DOWNLOADS_DIR} +CONTAINER_DIST_DIR=${CONTAINER_ANDROID_DIR}/${DIST_DIR} + +HOST_ANDROID_DIR=${HOST_TOOLS_DIR}/../.. +HOST_ANDROID_DIR=$(realpath ${HOST_ANDROID_DIR}) +HOST_INPUTS_DIR=${HOST_ANDROID_DIR}/${INPUTS_DIR} +HOST_DOWNLOADS_DIR=${HOST_ANDROID_DIR}/${DOWNLOADS_DIR} +HOST_DIST_DIR=${HOST_ANDROID_DIR}/${DIST_DIR} + diff --git a/android/tools/host/download_input_files.sh b/android/tools/host/download_input_files.sh new file mode 100755 index 0000000..821c6b3 --- /dev/null +++ b/android/tools/host/download_input_files.sh @@ -0,0 +1,106 @@ +#!/bin/bash + +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Fail fast on any error. +set -e + +HOST_TOOLS_DIR=$(realpath $(dirname $0)) +source ${HOST_TOOLS_DIR}/common.sh + +RELEASE_ID=${1} +if [ -z ${RELEASE_ID} ]; then + echo "Usage:" + echo " ${0} <release ID>" + echo + echo "e.g. ${0} 2020d" + exit 1 +fi + +SCRIPT_PATH=$(realpath $0) + +# -f = report failures +# -L = follow redirects +CURL_CMD="curl -f -L" + +TZBB_PROJECT_URL=https://github.com/evansiroky/timezone-boundary-builder/ +SERVER_RELEASE_BASE_URL=${TZBB_PROJECT_URL}releases/download +SERVER_SOURCE_BASE_URL=https://raw.githubusercontent.com/evansiroky/timezone-boundary-builder/master + +INPUT_DATA_FILE=input-data.zip +LICENSE_FILE=DATA_LICENSE + +function download() { + set -e + SERVER_BASE_URL=${1} + FILE_NAME=${2} + LOCAL_DIR=${3} + + URL=${SERVER_BASE_URL}/${FILE_NAME} + LOCAL_FILE_NAME=${LOCAL_DIR}/${FILE_NAME} + echo Downloading ${FILE_NAME} from ${URL}... + ${CURL_CMD} ${URL} --output ${LOCAL_FILE_NAME} + + DOWNLOAD_DATE=$(date) + SHA=$(sha1sum ${LOCAL_FILE_NAME} | awk '{ print $1}') + + # Add a METADATA file URL entry for every file we download. + cat << EOF >> ${METADATA_FILE} + url { + type: OTHER + value: "${FILE_NAME} downloaded from ${URL} on ${DOWNLOAD_DATE}, SHA1=${SHA}" + } +EOF +} + +mkdir -p ${HOST_INPUTS_DIR} +echo Removing existing data files... +rm -f ${HOST_INPUTS_DIR}/* + +METADATA_FILE=${HOST_INPUTS_DIR}/METADATA +# Start the METADATA file +cat << EOF > ${METADATA_FILE} +// Generated file DO NOT EDIT +// Run download_input_files.sh +name: "android_inputs" +description: + "Assorted files downloaded from ${TZBB_PROJECT_URL}" + +third_party { + url { + type: HOMEPAGE + value: "${TZBB_PROJECT_URL}" + } +EOF + +download ${SERVER_SOURCE_BASE_URL} ${LICENSE_FILE} ${HOST_INPUTS_DIR} +download ${SERVER_RELEASE_BASE_URL}/${RELEASE_ID} ${INPUT_DATA_FILE} ${HOST_INPUTS_DIR} + +PROTO_UPGRADE_DATE=$(date +'{ year: '%Y' month: '%-m' day: '%-d' }') + +# Finish the METADATA file +cat << EOF >> ${METADATA_FILE} + version: "${RELEASE_ID}" + last_upgrade_date ${PROTO_UPGRADE_DATE} + license_type: RESTRICTED +} +EOF + +ln -sr ${HOST_INPUTS_DIR}/DATA_LICENSE ${HOST_INPUTS_DIR}/LICENSE + +# Handle the unzip step to HOST_DOWNLOADS_DIR +unzip -d ${HOST_DOWNLOADS_DIR} ${HOST_INPUTS_DIR}/${INPUT_DATA_FILE} + +echo Look in ${HOST_INPUTS_DIR} for input files.... diff --git a/android/tools/host/run_process_in_docker.sh b/android/tools/host/run_process_in_docker.sh new file mode 100755 index 0000000..bdb615a --- /dev/null +++ b/android/tools/host/run_process_in_docker.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HOST_TOOLS_DIR=$(realpath $(dirname $0)) +CONTAINER_TOOLS_DIR=$(realpath $HOST_TOOLS_DIR/../container) +TZBB_ROOT=$(realpath $HOST_TOOLS_DIR/../../..) + +DOCKER_USERNAME=$(id -un) +DOCKER_UID=$(id -u) +DOCKER_GID=$(id -g) + +echo "This may need your sudo password in order to access docker:" +set -x +sudo docker build --build-arg userid=$DOCKER_UID --build-arg groupid=$DOCKER_GID --build-arg username=$DOCKER_USERNAME --build-arg tzbbroot=$TZBB_ROOT -t android-tzbb . +sudo docker run -it --rm -v $TZBB_ROOT:/timezone-boundary-builder android-tzbb $* +set +x + diff --git a/android/tools/host/run_tzbb.sh b/android/tools/host/run_tzbb.sh new file mode 100755 index 0000000..4c30453 --- /dev/null +++ b/android/tools/host/run_tzbb.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright 2021 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +HOST_TOOLS_DIR=$(realpath $(dirname $0)) +source ${HOST_TOOLS_DIR}/common.sh + +${HOST_TOOLS_DIR}/run_process_in_docker.sh /timezone-boundary-builder/android/tools/container/run_tzbb.sh \ + --downloads_dir ${CONTAINER_DOWNLOADS_DIR} \ + --dist_dir ${CONTAINER_DIST_DIR} \ + --skip_zip \ + --skip_shapefile \ + $* |