Expand description
A pure Rust library for parsing, managing, validating, diffing,
and rendering DNF/YUM .repo configuration files.
§Three-Level API
| Level | Type | Purpose |
|---|---|---|
| Macro | ReposDir | Manage /etc/yum.repos.d/ directory |
| Meso | RepoFile | Parse, modify, render a .repo file |
| Micro | Repo, MainConfig | Type-safe access to individual fields |
§Quick Start
use dnf_repofile::{RepoFile, RepoId};
let input = "[epel]\nname=EPEL\nbaseurl=https://example.com/\n";
let rf = RepoFile::parse(input).unwrap();
let block = rf.get(&RepoId::try_new("epel").unwrap()).unwrap();
println!("{}", block.data.name.as_ref().unwrap());§Features
- Parse
.repofiles into fully-typed Rust structs - Render back to text with comment/whitespace preservation
- Validate repository configurations
- Diff between repo files or individual repos
- Builder pattern for programmatic creation
- Variable expansion (
$releasever,${basearch}, etc.)
Re-exports§
pub use builder::RepoBuilder;pub use diff::diff_files;pub use diff::diff_main;pub use diff::diff_repos;pub use diff::ConfigDiff;pub use diff::FileDiff;pub use diff::RepoDiff;pub use error::Error;pub use error::Result;pub use mainconfig::MainConfig;pub use repo::Repo;pub use repofile::RawEntry;pub use repofile::RepoFile;pub use repofile::SectionBlock;pub use reposdir::ReposDir;pub use validate::IssueLevel;pub use validate::IssueLocation;pub use validate::ValidationIssue;pub use validate::ValidationReport;pub use variables::detect_variables;pub use variables::expand_variables;pub use types::*;
Modules§
- builder
- Builder-pattern API for constructing
Repovalues. - diff
- Diff engine for comparing DNF configuration files and values.
- error
- Error types for DNF
.repofile parsing, validation, and variable expansion. - mainconfig
- The DNF
[main]configuration section. - repo
- The fully typed
Repostruct representing a[repo-id]section. - repofile
- Parsing, rendering, and manipulation of
.repofiles. - reposdir
- Directory-level management of
.repofiles on disk. - types
- Value types and newtypes for DNF repository configuration options.
- validate
- Validation engine for checking DNF repository configuration consistency.
- variables
- Variable detection and expansion for DNF configuration values.