Detect installed RPM packages using `rpm -q`
mainFor RPM-based distributions (CentOS, AlmaLinux, RedHat, RockyLinux, Fedora, OpenSUSE, SLE), rv detects system dependencies by executing the rpm -q command.
Detection Process:
- Execute
rpm -q {package_list}. - Parse
stdoutto identify installed packages. The package name is extracted by finding the first hyphen followed by a digit (the start of the version string). - Parse
stderrfor the string"is not installed"to explicitly mark packages asSysInstallationStatus::Absent. - Fallback to checking the system
PATHfor known tools if the package status isUnknown.
# Example manual verification of RPM query parsing
rpm -q libcurl-devel openssl-devel fake-pkg 2>&1
# Expected behavior: stdout contains installed, stderr contains 'fake-pkg is not installed'