makechrootpkg: Split out chrootbuild into a function