pub fn list_foreign_packages() -> Result<Vec<(String, String)>, String>Expand description
What: Run pacman -Qm and parse foreign package names and versions.
Inputs:
- None (uses host
pacman).
Output:
- Vector of
(pkgname, version)or error message.versionis the remainder of the line after the package name (typicallypkgver-pkgrelfrompacman -Qm, but may be empty for name-only lines).
Details:
- Uses
-Qmwithout-qso each line normally includespkgver-pkgrel.pacman -Qmqonly prints names (seepacman(8)--quiet), which would make overlap detection see zero foreign packages. - Returns empty vector when no foreign packages exist.
- Skips blank lines. Non-blank lines always yield an entry: the first whitespace-separated token is
the package name; any further tokens are joined with spaces into
version, which is empty when the line contains only a name (no version field to skip—overlap logic still keys onpkgname).
§Errors
- Returns an error when
pacmancannot be executed or exits non-zero.