Skip to main content

Module source

Module source 

Source
Expand description

Source URL generation and sha256 computation.

Structs§

ExtractedSource
An extracted crate source tree in a temporary directory.
GitHubRepo
Parsed GitHub repository info.
ResolvedGitHubSource
Resolved GitHub source info.

Functions§

compute_sha256
Download a URL and compute its sha256 hex digest.
crates_io_url
Construct a crates.io download URL.
extract_tar_gz
Extract a gzipped tarball (bytes) into a new temp directory and return the path to the single top-level directory inside it (the “crate root”).
fetch_and_extract
Download a tarball, compute its sha256, and extract it to a temp directory. Returns the hash and the extracted source tree.
fetch_github_raw
Fetch a raw file from a GitHub repo at a given tag.
fetch_github_tree
Fetch the file listing of a GitHub repo at a given tag using the Trees API. Returns a list of file paths relative to the repo root.
github_archive_url
Construct a GitHub archive URL for a given tag/version with a tag prefix.
is_prerelease_tag
Returns true if the tag looks like a pre-release version. Detects common pre-release suffixes: -alpha, -beta, -rc, -dev, -pre.
is_valid_sha256
Returns true if the given string looks like a valid SHA256 hex digest.
latest_github_release
Fetch the latest release tag from a GitHub repo. Tries both the releases API and tags API, then picks the best version-like tag. Skips non-version tags like “latest”, “nightly”, etc. Returns the tag name (e.g., “v1.2.3” or “1.2.3”).
looks_like_version_tag
Returns true if the given string looks like a version tag. Matches patterns like v1.2.3, 1.2.3, v.1.2.3, tool-v1.2.3, etc. Returns false for tags like latest, nightly, stable.
resolve_github_source
Try to resolve the correct GitHub archive URL and compute its SHA256. When tag_override is provided, it is used directly without tag prefix detection. Otherwise, tries v-prefixed tag first, then bare version. When use_refs_tags is true, the URL template uses /archive/refs/tags/ instead of /archive/.
tag_to_jinja_template
Replace the version portion of a tag with the jinja {{ version }} placeholder. If the tag does not contain the version, returns the literal tag.
tag_to_version
Strip a version prefix (v or v.) from a tag to get a bare version string. Handles v1.2.3, v.1.2.3, and bare 1.2.3 patterns.