#796816 Expand variables like %(pkg)s in hook invocations and paths like export-dir too