pub struct MainConfig {Show 57 fields
pub arch: Option<String>,
pub basearch: Option<String>,
pub releasever: Option<String>,
pub cachedir: Option<Utf8PathBuf>,
pub persistdir: Option<Utf8PathBuf>,
pub logdir: Option<Utf8PathBuf>,
pub config_file_path: Option<Utf8PathBuf>,
pub installroot: Option<Utf8PathBuf>,
pub reposdir: Vec<Utf8PathBuf>,
pub varsdir: Vec<Utf8PathBuf>,
pub pluginconfpath: Vec<Utf8PathBuf>,
pub pluginpath: Vec<Utf8PathBuf>,
pub debuglevel: Option<DebugLevel>,
pub logfilelevel: Option<LogLevel>,
pub log_rotate: Option<LogRotate>,
pub log_size: Option<StorageSize>,
pub installonly_limit: Option<InstallOnlyLimit>,
pub errorlevel: Option<ErrorLevel>,
pub metadata_timer_sync: Option<MetadataTimerSync>,
pub allow_vendor_change: Option<DnfBool>,
pub assumeno: Option<DnfBool>,
pub assumeyes: Option<DnfBool>,
pub autocheck_running_kernel: Option<DnfBool>,
pub best: Option<DnfBool>,
pub cacheonly: Option<DnfBool>,
pub check_config_file_age: Option<DnfBool>,
pub clean_requirements_on_remove: Option<DnfBool>,
pub debug_solver: Option<DnfBool>,
pub defaultyes: Option<DnfBool>,
pub diskspacecheck: Option<DnfBool>,
pub exclude_from_weak_autodetect: Option<DnfBool>,
pub exit_on_lock: Option<DnfBool>,
pub gpgkey_dns_verification: Option<DnfBool>,
pub ignorearch: Option<DnfBool>,
pub install_weak_deps: Option<DnfBool>,
pub keepcache: Option<DnfBool>,
pub log_compress: Option<DnfBool>,
pub module_obsoletes: Option<DnfBool>,
pub module_stream_switch: Option<DnfBool>,
pub obsoletes: Option<DnfBool>,
pub plugins: Option<DnfBool>,
pub protect_running_kernel: Option<DnfBool>,
pub strict: Option<DnfBool>,
pub upgrade_group_objects_upgrade: Option<DnfBool>,
pub zchunk: Option<DnfBool>,
pub installonlypkgs: Vec<String>,
pub protected_packages: Vec<String>,
pub exclude_from_weak: Vec<String>,
pub group_package_types: Vec<String>,
pub optional_metadata_types: Vec<String>,
pub tsflags: Vec<TsFlag>,
pub usr_drift_protected_paths: Vec<String>,
pub multilib_policy: Option<MultilibPolicy>,
pub persistence: Option<Persistence>,
pub rpmverbosity: Option<RpmVerbosity>,
pub module_platform_id: Option<ModulePlatformId>,
pub extras: IndexMap<String, Vec<String>>,
}Expand description
DNF [main] configuration section.
Represents all 57 known DNF main configuration options as strongly-typed
optional fields. Unknown keys are stashed in extras
for round-trip fidelity.
§Examples
use dnf_repofile::MainConfig;
// Start with defaults (all fields None)
let mut config = MainConfig::default();
// Set some values
config.keepcache = Some(dnf_repofile::DnfBool::True);
config.debuglevel = dnf_repofile::DebugLevel::try_new(5).ok();Parse from a .repo file string via RepoFile:
use dnf_repofile::RepoFile;
let input = "[main]\ncachedir=/var/cache/dnf\nkeepcache=0\ndebuglevel=2\n";
let rf = RepoFile::parse(input).unwrap();
let main = rf.main().unwrap();
assert_eq!(
main.data.cachedir.as_ref().map(|p| p.as_str()),
Some("/var/cache/dnf")
);Fields§
§arch: Option<String>System architecture (e.g., "x86_64", "aarch64").
basearch: Option<String>Base hardware architecture.
releasever: Option<String>OS release version identifier.
cachedir: Option<Utf8PathBuf>Directory for the DNF cache.
persistdir: Option<Utf8PathBuf>Directory for persistent data.
logdir: Option<Utf8PathBuf>Directory for log files.
config_file_path: Option<Utf8PathBuf>Path to the DNF configuration file.
installroot: Option<Utf8PathBuf>Root directory for package installation.
reposdir: Vec<Utf8PathBuf>Directories containing .repo files.
varsdir: Vec<Utf8PathBuf>Directories containing variable definition files.
pluginconfpath: Vec<Utf8PathBuf>Directories for plugin configuration files.
pluginpath: Vec<Utf8PathBuf>Directories containing DNF plugins.
debuglevel: Option<DebugLevel>Debug message verbosity level (0–10, default 2).
logfilelevel: Option<LogLevel>Log file verbosity level (0–10, default 9).
log_rotate: Option<LogRotate>Number of log files to keep before rotation (default 4).
log_size: Option<StorageSize>Maximum log file size in bytes.
installonly_limit: Option<InstallOnlyLimit>Maximum number of kernel packages to keep (default 3).
errorlevel: Option<ErrorLevel>Error message verbosity level (0–10, default 3).
metadata_timer_sync: Option<MetadataTimerSync>Time in seconds between metadata timer syncs (default 10800).
allow_vendor_change: Option<DnfBool>Allow obsoletes to replace packages from different vendors.
assumeno: Option<DnfBool>Automatically answer “no” to all questions.
assumeyes: Option<DnfBool>Automatically answer “yes” to all questions.
autocheck_running_kernel: Option<DnfBool>Check whether the running kernel is the latest installed.
best: Option<DnfBool>Upgrade to the highest available package version.
cacheonly: Option<DnfBool>Run entirely from cache (no network).
check_config_file_age: Option<DnfBool>Check the age of the configuration file.
clean_requirements_on_remove: Option<DnfBool>Remove dependencies that are no longer needed.
debug_solver: Option<DnfBool>Enable debug output from the dependency solver.
defaultyes: Option<DnfBool>Default answer “yes” to all questions.
diskspacecheck: Option<DnfBool>Check available disk space before operations.
exclude_from_weak_autodetect: Option<DnfBool>Exclude packages from weak dependency autodetection.
exit_on_lock: Option<DnfBool>Exit immediately if a lock cannot be acquired.
gpgkey_dns_verification: Option<DnfBool>Verify GPG keys via DNS.
ignorearch: Option<DnfBool>Ignore architecture mismatches.
install_weak_deps: Option<DnfBool>Install weak dependencies automatically.
keepcache: Option<DnfBool>Keep downloaded package files after installation.
log_compress: Option<DnfBool>Compress rotated log files.
module_obsoletes: Option<DnfBool>Handle module obsoletes.
module_stream_switch: Option<DnfBool>Allow module stream switching.
obsoletes: Option<DnfBool>Handle package obsoletes.
plugins: Option<DnfBool>Enable DNF plugins.
protect_running_kernel: Option<DnfBool>Protect the running kernel from removal.
strict: Option<DnfBool>Fail on any error during dependency resolution.
upgrade_group_objects_upgrade: Option<DnfBool>Upgrade group objects as a unit.
zchunk: Option<DnfBool>Enable zchunk metadata compression.
installonlypkgs: Vec<String>Packages that should only ever be installed, never upgraded.
protected_packages: Vec<String>Packages protected from automatic removal.
exclude_from_weak: Vec<String>Packages excluded from weak dependency detection.
group_package_types: Vec<String>Types of group packages to install.
optional_metadata_types: Vec<String>Optional repository metadata types to download.
tsflags: Vec<TsFlag>RPM transaction flags (scripts, triggers, docs, etc.).
usr_drift_protected_paths: Vec<String>Paths protected from /usr drift.
multilib_policy: Option<MultilibPolicy>Multilib package installation policy.
persistence: Option<Persistence>SQLite persistence mode for repository metadata.
rpmverbosity: Option<RpmVerbosity>RPM transaction verbosity level.
module_platform_id: Option<ModulePlatformId>Module platform identifier for modularity.
extras: IndexMap<String, Vec<String>>Unrecognized key-value pairs preserved for round-trip fidelity.
Implementations§
Source§impl MainConfig
impl MainConfig
Sourcepub fn validate(&self) -> ValidationReport
pub fn validate(&self) -> ValidationReport
Validate the [main] configuration.
Currently returns an empty (valid) report. Future releases will add
validation rules for the [main] section.
Trait Implementations§
Source§impl Clone for MainConfig
impl Clone for MainConfig
Source§fn clone(&self) -> MainConfig
fn clone(&self) -> MainConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MainConfig
impl Debug for MainConfig
Source§impl Default for MainConfig
impl Default for MainConfig
Source§fn default() -> MainConfig
fn default() -> MainConfig
Source§impl PartialEq for MainConfig
impl PartialEq for MainConfig
Source§fn eq(&self, other: &MainConfig) -> bool
fn eq(&self, other: &MainConfig) -> bool
self and other values to be equal, and is used by ==.impl Eq for MainConfig
impl StructuralPartialEq for MainConfig
Auto Trait Implementations§
impl Freeze for MainConfig
impl RefUnwindSafe for MainConfig
impl Send for MainConfig
impl Sync for MainConfig
impl Unpin for MainConfig
impl UnsafeUnpin for MainConfig
impl UnwindSafe for MainConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.