Skip to main content

MainConfig

Struct MainConfig 

Source
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

Source

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

Source§

fn clone(&self) -> MainConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MainConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MainConfig

Source§

fn default() -> MainConfig

Returns the “default value” for a type. Read more
Source§

impl PartialEq for MainConfig

Source§

fn eq(&self, other: &MainConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for MainConfig

Source§

impl StructuralPartialEq for MainConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.