pub fn install(cfg: &Config) -> Result<InstallReport, PkgError>Expand description
Fetch every dep in the manifest (and their transitive deps), place them, and write the lockfile.
Resolution is a breadth-first worklist seeded with the manifest’s
[deps] (sorted by name). Every fetched package that ships its own
mlua-pkg.toml appends its [deps] to the worklist, so a consumer
declares only what it uses directly. All packages land flat under
<vendored>/<name> and in the lockfile, which means one name maps to
exactly one spec: a name reached twice with an identical Dep is
installed once; reached with different specs the install stops with
PkgError::DepConflict naming both requesters. There is no version
unification.
Per package:
- Pick the package root. With a
patch_dirwhose lockfilepatch_baseequals the pinned commit, that directory is the root and nothing is fetched; otherwise fetch viaGitFetcherrooted atproject.pkg_dir().cache()(a stale / missing patch is reported inwarningsand left alone). Prefix tag pins (tag = "v1.0") are resolved inside the fetcher. - Resolve the entry directory:
dep.entry> author-manifest entry >src/>lua/>.(seeresolve_entry). - Place the root: relative symlink at
<vendored>/<name>by default, or an idempotent physical copy into<manifest_root>/<target_dir>whentarget_diris set (a transitive dep’starget_dir/patch_diris resolved against the consumer’s manifest, like a direct one). Therequireroot is<root>/<entry>. - Record
(name, source, resolved tag, sha, entry, patch_dir, patch_base)for the lockfile;patch_baseis carried over from the previous lockfile, never written here.
The lockfile is written once at the end, sorted by name, so a mid-way failure leaves the previous lockfile untouched and the output does not depend on discovery order.
§Errors
PkgError::DepConflictwhen one name carries two different specs.PkgError::Fetchwrapping the fetcher error for the failing dep.PkgError::EntryNotFoundwhen no entry candidate exists.PkgError::Iofor symlink / copy / directory creation failures.