make info_dict and GetTypeAndDevice available to device extensions
Change-Id: I3aa04cb6d7988fc1fdd7f179634b09ceab5749fb
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index be8333b..a236a12 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -766,3 +766,20 @@
th.start()
while threads:
threads.pop().join()
+
+
+# map recovery.fstab's fs_types to mount/format "partition types"
+PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD",
+ "ext4": "EMMC", "emmc": "EMMC" }
+
+def GetTypeAndDevice(mount_point, info):
+ fstab = info["fstab"]
+ if fstab:
+ return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
+ else:
+ devices = {"/boot": "boot",
+ "/recovery": "recovery",
+ "/radio": "radio",
+ "/data": "userdata",
+ "/cache": "cache"}
+ return info["partition_type"], info.get("partition_path", "") + devices[mount_point]