pub fn get_available_version(name: &str) -> Option<String>Expand description
What: Query the repositories for the latest available version of a package.
Inputs:
name: Package name looked up viapacman -Si.
Output:
- Returns
Some(String)with the version string advertised in the repositories. - Returns
Noneon failure (package not found in repos or command error).
Details:
- Strips revision suffixes (e.g.,
-1) so comparisons focus on the base semantic version. - Parses “Version: x.y.z” line from pacman -Si output.
- Sets
LC_ALL=CandLANG=Cfor consistent locale-independent output. - Gracefully degrades by returning
Noneif pacman is unavailable or package not found.
§Example
use arch_toolkit::deps::get_available_version;
if let Some(version) = get_available_version("pacman") {
println!("Available version: {}", version);
}