It's a common mistake to use ${D} rather than $D in postinstall scripts, and it would be easy for us to detect, so we really ought to have a package QA check for it. We'd just need to look in the unexpanded value of pkg_postinst, pkg_preinst, pkg_postrm and pkg_prerm and trigger a QA issue if ${D} was in the value (suggesting to the user that $D should be used instead).
See also the similar (but not directly related) bug 6982.
Solved here: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=24d9d5a6eb3b48d392b7fa0bde1fc5c7a8392023