fetch-vendor-package.sh: Remove the older vendor-package

Remove the older Linaro vendor-package, if any, before
downloading/installing the new package. Because upstream
mesa prebuilts in 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.

This is hopefully a temporary workaround while we move Mesa
prebuilt targets from Android.mk to Android.bp.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Change-Id: I86709b9c6f07c2e4753e17eda2a3e90e41ba4184
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