fetch-vendor-package.sh: Remove the older vendor-package am: e23d672006 am: 95aacbac77 am: 387f15d5e9 am: a7bc624661

Original change: https://android-review.googlesource.com/c/device/linaro/dragonboard/+/2146059

Change-Id: I8cdd1bb2a85c4a847ab52136b1e9b7af9ca7ee0d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/device-common.mk b/device-common.mk
index 6601cda..3fd5687 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -38,16 +38,14 @@
   include $(LINARO_VENDOR_PATH)/db845c/$(EXPECTED_LINARO_VENDOR_VERSION)/version.mk
   ifneq ($(TARGET_LINARO_VENDOR_VERSION), $(EXPECTED_LINARO_VENDOR_VERSION))
     $(warning TARGET_LINARO_VENDOR_VERSION ($(TARGET_LINARO_VENDOR_VERSION)) does not match exiting the build ($(EXPECTED_LINARO_VENDOR_VERSION)).)
-    $(warning Please download new binaries here:)
-    $(warning    $(VND_PKG_URL) )
-    $(warning And extract in the ANDROID_TOP_DIR)
+    $(warning Please download and extract the new binaries by running the following script:)
+    $(warning    ./device/linaro/dragonboard/fetch-vendor-package.sh )
     # Would be good to error out here, but that causes other issues
   endif
 else
   $(warning Missing Linaro Vendor Package!)
-  $(warning Please download new binaries here:)
-  $(warning    $(VND_PKG_URL) )
-  $(warning And extract in the ANDROID_TOP_DIR)
+  $(warning Please download and extract the vendor binaries by running the following script:)
+  $(warning    ./device/linaro/dragonboard/fetch-vendor-package.sh )
   # Would be good to error out here, but that causes other issues
 endif
 
diff --git a/fetch-vendor-package.sh b/fetch-vendor-package.sh
index 5e8d727..eb11206 100755
--- a/fetch-vendor-package.sh
+++ b/fetch-vendor-package.sh
@@ -13,6 +13,14 @@
 
 pushd ${ANDROID_BUILD_TOP}
 
+# remove the older vendor-package, if any, because upstream
+# mesa prebuilts in linaro-vendor-package ain't declared
+# within a contained namespace and we can run into build
+# errors because of redefinition of mesa prebuilt modules
+# from the previous vendor-package.
+# FIXME move mesa prebuilts from Android.mk to Android.bp
+rm -rf ${ANDROID_BUILD_TOP}/vendor/linaro/
+
 if [ ! -e "${PKG_FILE}.tgz"  ]; then
     curl -L ${VND_PKG_URL} -o  ${PKG_FILE}.tgz
 fi