refactor read_pkginfo