Skip to main content

analyze_pkgbuild

Function analyze_pkgbuild 

Source
pub fn analyze_pkgbuild<S: BuildHasher>(
    package_name: &str,
    pkgbuild_text: &str,
    installed: &HashSet<String, S>,
    provided: &HashSet<String, S>,
) -> SandboxInfo
Expand description

What: Analyze a package’s dependencies from PKGBUILD content.

Inputs:

  • package_name: Package name for the report.
  • pkgbuild_text: PKGBUILD content.
  • installed: Set of installed package names (see deps::get_installed_packages).
  • provided: Set of names provided by installed packages (see deps::get_provided_packages).

Output:

  • SandboxInfo with per-category dependency deltas.

Details:

  • Parses dependency arrays via deps::parse_pkgbuild_deps (Phase 2 parser) and delegates to analyze_dependencies per category.

§Example

use arch_toolkit::sandbox::analyze_pkgbuild;
use std::collections::HashSet;

let pkgbuild = "depends=('glibc')\nmakedepends=('rust>=1.70')";
let installed: HashSet<String> = HashSet::from(["glibc".to_string()]);
let provided = HashSet::new();
let info = analyze_pkgbuild("demo", pkgbuild, &installed, &provided);
assert_eq!(info.missing_packages(), ["rust>=1.70"]);