Skip to main content

Crate arch_toolkit

Crate arch_toolkit 

Source
Expand description

Complete Rust toolkit for Arch Linux package management.

This crate provides a unified API for interacting with Arch Linux package management, including AUR (Arch User Repository) operations, dependency resolution, package index queries, installation command building, news feeds, and security advisories.

§Features

  • aur: AUR search, package info, comments, and PKGBUILD fetching
  • deps: Dependency resolution, parsing, and reverse dependency analysis
  • index: Package database queries (installed and explicit package tracking)
  • install: Installation command building (pacman, AUR helpers, batch planning)
  • news: Arch news RSS and security advisories
  • sandbox: Build-preflight dependency analysis (PKGBUILD/.SRCINFO vs host)

§Examples

use arch_toolkit::ArchClient;

let client = ArchClient::new()?;
let packages = client.aur().search("yay").await?;
println!("Found {} packages", packages.len());

§Fetch Package Details

use arch_toolkit::ArchClient;

let client = ArchClient::new()?;
let details = client.aur().info(&["yay", "paru"]).await?;
for pkg in details {
    println!("{}: {}", pkg.name, pkg.description);
}

§Custom Configuration

use arch_toolkit::ArchClient;
use std::time::Duration;

let client = ArchClient::builder()
    .timeout(Duration::from_secs(60))
    .user_agent("my-app/1.0")
    .build()?;
let packages = client.aur().search("yay").await?;

§Fetch Comments

use arch_toolkit::ArchClient;

let client = ArchClient::new()?;
let comments = client.aur().comments("yay").await?;
for comment in comments.iter().take(5) {
    println!("{}: {}", comment.author, comment.content);
}

§Fetch PKGBUILD

use arch_toolkit::ArchClient;

let client = ArchClient::new()?;
let pkgbuild = client.aur().pkgbuild("yay").await?;
println!("PKGBUILD:\n{}", pkgbuild);

§Dependency Resolution

use arch_toolkit::deps::DependencyResolver;
use arch_toolkit::{PackageRef, PackageSource};

let resolver = DependencyResolver::new();
let packages = vec![
    PackageRef {
        name: "firefox".into(),
        version: "121.0".into(),
        source: PackageSource::Official {
            repo: "extra".into(),
            arch: "x86_64".into(),
        },
    },
];

let result = resolver.resolve(&packages).unwrap();
println!("Found {} dependencies", result.dependencies.len());

§Parse Dependency Specifications

use arch_toolkit::deps::parse_dep_spec;

let spec = parse_dep_spec("python>=3.12");
println!("Package: {}, Version: {}", spec.name, spec.version_req);

§Query Installed Packages

use arch_toolkit::deps::get_installed_packages;

let installed = get_installed_packages().unwrap();
println!("Found {} installed packages", installed.len());

Re-exports§

pub use error::ArchToolkitError as Error;
pub use error::Result;
pub use types::AurComment;
pub use types::AurPackage;
pub use types::AurPackageDetails;
pub use types::HealthStatus;
pub use types::ServiceStatus;
pub use types::Dependency;
pub use types::DependencySource;
pub use types::DependencySpec;
pub use types::DependencyStatus;
pub use types::PackageRef;
pub use types::PackageSource;
pub use types::ReverseDependencySummary;
pub use types::SrcinfoData;
pub use types::dependency::DependencyConstraintRange;
pub use types::dependency::DependencyGraphConfig;
pub use types::dependency::DependencyGraphDiagnostic;
pub use types::dependency::DependencyGraphDiagnosticKind;
pub use types::dependency::DependencyGraphEdge;
pub use types::dependency::DependencyGraphNode;
pub use types::dependency::DependencyGraphNodeStatus;
pub use types::dependency::DependencyGraphResolution;
pub use types::dependency::DependencyMetadata;
pub use types::dependency::DependencyMetadataResponse;
pub use types::dependency::DependencyProvenance;
pub use types::dependency::DependencyVersionBound;
pub use types::index::IndexQueryResult;
pub use types::index::InstalledPackagesMode;
pub use types::index::MirrorDiscoveryLimits;
pub use types::index::MirrorInfo;
pub use types::index::OfficialIndex;
pub use types::index::OfficialPackage;
pub use types::install::AurHelper;
pub use types::install::CascadeMode;
pub use types::install::CommandSpec;
pub use types::install::InstallOptions;
pub use types::install::PrivilegeTool;
pub use types::news::AdvisorySeverity;
pub use types::news::ArchNewsItem;
pub use types::news::SecurityAdvisory;
pub use news::FeedCache;
pub use news::InMemoryFeedCache;
pub use types::sandbox::DependencyDelta;
pub use types::sandbox::SandboxAnalysisLimitation;
pub use types::sandbox::SandboxFinding;
pub use types::sandbox::SandboxInfo;
pub use types::sandbox::SandboxRuleId;
pub use types::sandbox::SandboxStaticAnalysis;
pub use aur::ARCH_PACKAGE_SEARCH_URL;
pub use aur::check_mirror_health;
pub use aur::fetch_arch_package_detail;
pub use aur::fetch_official_package_detail_from;
pub use types::package::MetadataFetchLimits;
pub use types::package::MirrorHealth;
pub use types::package::MirrorHealthLimits;
pub use types::package::MirrorHealthStatus;
pub use deps::DependencyMetadataProvider;
pub use deps::DependencyResolution;
pub use deps::DependencyResolver;
pub use deps::ResolverConfig;
pub use deps::ReverseDependencyAnalyzer;
pub use deps::ReverseDependencyReport;
pub use aur::AurApi;
pub use aur::MockAurApi;
pub use client::ArchClient;
pub use client::ArchClientBuilder;
pub use client::CacheInvalidator;
pub use client::RetryPolicy;
pub use cache::CacheConfig;
pub use cache::CacheConfigBuilder;
pub use aur::validation::ValidationConfig;

Modules§

aur
AUR (Arch User Repository) operations.
cache
Caching layer for arch-toolkit operations.
client
HTTP client with rate limiting for arch-toolkit.
deps
Dependency parsing and resolution utilities for Arch Linux packages.
error
Unified error type for arch-toolkit.
health
Health check functionality for archlinux.org services.
index
Index module for package database queries and management.
install
Install module for building package installation, removal, and update commands.
news
News module for Arch Linux news and security advisories.
prelude
Prelude module for convenient imports.
sandbox
Sandbox module for build-preflight dependency and static PKGBUILD analysis.
types
Shared data types for arch-toolkit.