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: I54c1d5600432b3ecc8a9a924f6cde311dc3b41fd
This commit is contained in:
Cole Faust 2023-10-06 14:49:54 -07:00
parent 1fc898784c
commit 751d9f1935
4 changed files with 113 additions and 35 deletions

View file

@ -24,6 +24,8 @@ $(call inherit-product-if-exists, vendor/google_devices/pantah/proprietary/cheet
$(call inherit-product-if-exists, vendor/google_devices/cheetah/proprietary/device-vendor.mk)
$(call inherit-product-if-exists, vendor/google_devices/pantah/proprietary/WallpapersCheetah.mk)
$(call inherit-product, device/google/pantah/uwb/uwb_calibration_country.mk)
DEVICE_PACKAGE_OVERLAYS += device/google/pantah/cheetah/overlay
include device/google/pantah/audio/cheetah/audio-tables.mk

View file

@ -1,27 +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)))

View file

@ -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/pantah/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

View file

@ -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/pantah/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/pantah/uwb/country_conf_gen.sh))
ifneq ($(diffs),)
$(error device/google/pantah/uwb/uwb_calibration_country.mk is not up to date, please run device/google/pantah/uwb/country_conf_gen.sh > device/google/pantah/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 \