g_sorcery/package_db: common convert function