Move code to write package source to PackageSource class