def METHOD_NAME(self, pkg_name, destdir=None):
    pkg_version = self.get_package_version()
    prefix = f"{pkg_name}-{pkg_version}"
    destdir = destdir or self.topdir
    tar_path = os.path.abspath(os.path.join(destdir, f"{prefix}.tar.gz"))
    cmd = ["git", "archive", "--format=tar.gz", f"--prefix={prefix}/", "HEAD", f"--output={tar_path}"]
    run(cmd, check=True, cwd=self.topdir)
    return tar_path