From 4e3ea6e815798f334e35eaf0c50692f32adb1540 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Fri, 6 Oct 2023 15:04:13 -0700 Subject: [PATCH] Use PRODUCT_COPY_FILES to install uwb country files Previously, these files were installed with a custom $(shell) command in an Android.mk file. This doesn't let the build system know that these files exist, and breaks hermetic partition builds. Instead, install them with PRODUCT_COPY_FILES, and add a check that the list is up-to-date. Bug: 205632228 Test: Presubmits Change-Id: Id43164ae2a106d6d384cd90b2f4191e53b3d34da --- device-felix.mk | 2 + uwb/Android.mk | 24 ----------- uwb/country_conf_gen.sh | 41 ++++++++++++++---- uwb/uwb_calibration_country.mk | 78 ++++++++++++++++++++++++++++++++++ 4 files changed, 113 insertions(+), 32 deletions(-) delete mode 100644 uwb/Android.mk create mode 100644 uwb/uwb_calibration_country.mk diff --git a/device-felix.mk b/device-felix.mk index f022390..09d5fb4 100644 --- a/device-felix.mk +++ b/device-felix.mk @@ -25,6 +25,8 @@ $(call inherit-product-if-exists, vendor/google_devices/felix/proprietary/felix/ $(call inherit-product-if-exists, vendor/google_devices/felix/proprietary/device-vendor.mk) $(call inherit-product-if-exists, vendor/google_devices/felix/proprietary/WallpapersFelix.mk) +$(call inherit-product, device/google/felix/uwb/uwb_calibration_country.mk) + DEVICE_PACKAGE_OVERLAYS += device/google/felix/felix/overlay include device/google/felix/audio/felix/audio-tables.mk diff --git a/uwb/Android.mk b/uwb/Android.mk deleted file mode 100644 index a7bdf11..0000000 --- a/uwb/Android.mk +++ /dev/null @@ -1,24 +0,0 @@ -# -# Copyright (C) 2022 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. -# -# WARNING: Everything listed here will be built on ALL platforms, -# including x86, the universal, and the SDK. Modules must be uniquely -# named (liblights.panda), and must build everywhere, or limit themselves -# to only building on ARM if they include assembly. Individual makefiles -# are responsible for having their own logic, for fine-grained control. -LOCAL_PATH:= $(call my-dir) -LOCAL_UWB_CAL_DIR=$(LOCAL_PATH) -DEVICE_UWB_CAL_DIR=$(TARGET_OUT_VENDOR)/etc/uwb -$(shell ($(LOCAL_UWB_CAL_DIR)/country_conf_gen.sh $(LOCAL_UWB_CAL_DIR) $(DEVICE_UWB_CAL_DIR))) diff --git a/uwb/country_conf_gen.sh b/uwb/country_conf_gen.sh index 7e398c0..af22770 100755 --- a/uwb/country_conf_gen.sh +++ b/uwb/country_conf_gen.sh @@ -1,13 +1,38 @@ #!/bin/bash # This script is used to generate uwb conuntry configuration file, -# and the PRODUCT_COPY_FILES list in uwb.mk based on uwb_country.conf +# and the PRODUCT_COPY_FILES list in uwb_calibration_country.mk based on uwb_country.conf # Bug: 196073172, 233619860 count=1 -mkdir -p $2 +LOCAL_PATH=device/google/felix/uwb +echo "# Copyright (C) 2023 The Android Open-Source Project" +echo "#" +echo "# Licensed under the Apache License, Version 2.0 (the \"License\");" +echo "# you may not use this file except in compliance with the License." +echo "# You may obtain a copy of the License at" +echo "#" +echo "# http://www.apache.org/licenses/LICENSE-2.0" +echo "#" +echo "# Unless required by applicable law or agreed to in writing, software" +echo "# distributed under the License is distributed on an \"AS IS\" BASIS," +echo "# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." +echo "# See the License for the specific language governing permissions and" +echo "# limitations under the License." +echo "" +echo "# This file was autogenerated by country_conf_gen.sh" +echo "" +echo "ifneq (\$(LOCAL_PATH),$LOCAL_PATH)" +echo " \$(error LOCAL_PATH in country_conf_gen.sh needs to be updated, and uwb_calibration_country.mk regenerated)" +echo "endif" +echo "diffs := \$(shell diff \$(LOCAL_PATH)/uwb_calibration_country.mk <($LOCAL_PATH/country_conf_gen.sh))" +echo "ifneq (\$(diffs),)" +echo " \$(error $LOCAL_PATH/uwb_calibration_country.mk is not up to date, please run $LOCAL_PATH/country_conf_gen.sh > $LOCAL_PATH/uwb_calibration_country.mk)" +echo "endif" +echo "" +echo "PRODUCT_COPY_FILES += \\" while read line ; do if [[ "$line" =~ ^"*" ]]; then header=${line:1} @@ -16,16 +41,16 @@ while read line ; do country[count]=$(echo $line | cut -d ':' -f1 | tr -d "\"") code[count]=$(echo $line | cut -d ':' -f2 | tr -d "\"" | tr -d " ") if [ "$header" = "FCC" ]; then - cp $1/UWB-calibration-fcc.conf $2/UWB-calibration-${code[$count]}.conf + echo " \$(LOCAL_PATH)/UWB-calibration-fcc.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\" elif [ "$header" = "CE" ]; then - cp $1/UWB-calibration-ce.conf $2/UWB-calibration-${code[$count]}.conf + echo " \$(LOCAL_PATH)/UWB-calibration-ce.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\" elif [ "$header" = "JP" ]; then - cp $1/UWB-calibration-jp.conf $2/UWB-calibration-${code[$count]}.conf + echo " \$(LOCAL_PATH)/UWB-calibration-jp.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\" elif [ "$header" = "TW" ]; then - cp $1/UWB-calibration-tw.conf $2/UWB-calibration-${code[$count]}.conf + echo " \$(LOCAL_PATH)/UWB-calibration-tw.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\" elif [ "$header" = "Restricted" ]; then - cp $1/UWB-calibration-restricted.conf $2/UWB-calibration-${code[$count]}.conf + echo " \$(LOCAL_PATH)/UWB-calibration-restricted.conf:\$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-${code[$count]}.conf \\" fi fi ((count++)) -done < $1/uwb_country.conf +done < $LOCAL_PATH/uwb_country.conf diff --git a/uwb/uwb_calibration_country.mk b/uwb/uwb_calibration_country.mk new file mode 100644 index 0000000..8fab03b --- /dev/null +++ b/uwb/uwb_calibration_country.mk @@ -0,0 +1,78 @@ +# Copyright (C) 2023 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. + +# This file was autogenerated by country_conf_gen.sh + +ifneq ($(LOCAL_PATH),device/google/felix/uwb) + $(error LOCAL_PATH in country_conf_gen.sh needs to be updated, and uwb_calibration_country.mk regenerated) +endif +diffs := $(shell diff $(LOCAL_PATH)/uwb_calibration_country.mk <(device/google/felix/uwb/country_conf_gen.sh)) +ifneq ($(diffs),) + $(error device/google/felix/uwb/uwb_calibration_country.mk is not up to date, please run device/google/felix/uwb/country_conf_gen.sh > device/google/felix/uwb/uwb_calibration_country.mk) +endif + +PRODUCT_COPY_FILES += \ + $(LOCAL_PATH)/UWB-calibration-fcc.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-us.conf \ + $(LOCAL_PATH)/UWB-calibration-fcc.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ca.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-at.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-be.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-bg.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-hr.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-cy.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-cz.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-dk.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ee.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-fi.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-fr.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-de.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-gr.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-hu.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ie.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-it.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-lv.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-lt.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-lu.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-mt.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-nl.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-pl.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-pt.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ro.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-sk.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-si.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-es.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-se.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-gb.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ni.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-is.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-li.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-no.conf \ + $(LOCAL_PATH)/UWB-calibration-ce.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ch.conf \ + $(LOCAL_PATH)/UWB-calibration-jp.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-jp.conf \ + $(LOCAL_PATH)/UWB-calibration-tw.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-tw.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ar.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-am.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-az.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-by.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-id.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-kz.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-kg.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-np.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-pk.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-py.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ru.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-sb.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-tj.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-tm.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-ua.conf \ + $(LOCAL_PATH)/UWB-calibration-restricted.conf:$(TARGET_COPY_OUT_VENDOR)/etc/uwb/UWB-calibration-uz.conf \