Regarding Yandex, they use elliptical Mercator, in which the conversion between latitude/longitude coordinates and Mercator coordinates differs from the more common spherical Mercator, but the zoom levels and tiling logic is otherwise the same. See discussion at the Poor Maps thread, formulas at OpenStreetMap wiki and my implementation at GitHub.
I'm unable to rebuild mapnik anymore. So I can't really fix the bad path. The build silently fails, see https://garage.maemo.org/builder/fre...log.FAILED.txt Run standalone, the g++-4.6 command returns 1 without printing anything as well.
Last month I wanted to cache tiles for several areas and best tool I found was Mobile Atlas Creator (older versions also allow you to download gmaps) . Perl script attached that converts from RMaps/Big Planet SQLite format used in MOBAC to Modrana's SQLite. Actually its modified Beermad's script.