Documentation
¶
Overview ¶
Package fetch downloads and extracts pkgx package sources.
It supports the archive formats used by pantry distributables (.tar.gz/.tgz, .tar.xz, .tar.bz2/.tbz2, .tar, .zip) plus shallow git clones via the system git binary. Extraction is pure Go, preserves file modes, recreates symlinks, and rejects archive entries whose paths are absolute or would escape the destination directory.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTarGzFile ¶
ExtractTarGzFile extracts the local gzip-compressed tar at src into destDir, stripping strip leading path components (like `tar --strip-components=N`). It reuses the same hardened extractor as Fetch, so absolute or dest-escaping entries are rejected rather than written. bkpyvenv's poetry seal uses it to unpack a freshly built sdist into the in-project venv's site-packages.
func Fetch ¶
Fetch downloads url and extracts the archive into destDir, stripping stripComponents leading path components from every entry (like `tar --strip-components=N`). The archive format is detected from the URL's extension: .tar.gz/.tgz, .tar.xz, .tar.bz2/.tbz2, .tar, .zip.
func FetchGit ¶
FetchGit shallow-clones ref of repoURL into destDir with go-git's pure-Go clone — NO `git` binary dependency. `git clone --branch <ref>` accepts either a tag or a branch, so try the ref as a tag first, then as a branch (cleaning the destination between attempts, since PlainClone needs an empty target).
Types ¶
This section is empty.