How rpm-software-management/dnf5 works
Project type and purpose
• DNF5 is a command‐line package manager written in C++.
• It consists of a core C++ library (libdnf5), a CLI binary (dnf5), a client–server daemon (dnf5daemon‐client + dnf5daemon‐server), plugin subsystems, language bindings (Python, Perl, Ruby), and documentation/tests.
Top-level structure and architectural patterns
• Top-level directories:
• bindings/… (Go, Python, Perl, Ruby language bindings)
• libdnf5/… (core package‐management library)
• libdnf5-cli/… (helper library for building CLI tools)
• libdnf5-plugins/… (shared plugin API and shipped plugins)
• dnf5/… (the CLI frontend binary)
• dnf5daemon-client/… (wrapper and D-Bus client for the daemon)
• dnf5daemon-server/… (D-Bus service implementing package operations)
• test/… (unit/integration tests)
• doc/… (Sphinx/RST documentation)
• Architectural patterns:
• Layered architecture (Presentation → Application → Domain → Data)
• Plugin architecture (DNF5 CLI and libdnf5 load plugins)
• Client–Server over D-Bus (CLI → dnf5daemon‐client → dnf5daemon‐server)
• CMake‐driven modular build.
Key components
a. Presentation layer
• dnf5 CLI binary: parses arguments, loads plugins, displays output.
• dnf5daemon‐client library: translates CLI calls into D-Bus method calls.
• Language bindings: SWIG/GObject-introspection wrappers for Python, Perl, Ruby.
b. Application layer
• dnf5daemon-server: D-Bus service, receives requests, manages sessions.
• Plugin host: both CLI and daemon can load C++ or Python‐based plugins.
c. Domain logic
• libdnf5: core modules (conf, repo, rpm, transaction, comps, advisory, module).
• libsolv: dependency solver integrated by libdnf5.
• SQLite or on‐disk transaction history DB.
d. Infrastructure / data access
• Network: HTTP(S) to RPM repositories (repomd).
• File system: package downloads, caches, config files (/etc/dnf/…).
• D-Bus IPC for client–server.
• systemd units for scheduling (e.g., offline cleanup).
Interactions & data flow
1. User runs dnf5 <command> → CLI parses & optionally calls libdnf5-cli output adapters.
2. For daemon mode: CLI invokes dnf5daemon-client → D-Bus method call to dnf5daemon-server.
3. Server receives RPC, invokes libdnf5 API → uses libsolv for dependency solving.
4. libdnf5 interacts with repos (download metadata, packages) and with the transaction DB (SQLite).
5. Results (package lists, transaction progress) flow back via D-Bus → client → CLI → terminal.
6. Plugins can hook into various stages: CLI commands, libdnf5 events, transaction callbacks.
7. Language bindings wrap libdnf5 C++ classes for use in Python/Perl/Ruby scripts.