From 50e2a8dd724e7001a37df7eb0b76bb7460cd00ff Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 8 Jul 2020 11:24:29 -0500 Subject: [PATCH] [dnf] Fall back to `dnf repolist` when no sqlite3 [ci skip] --- share/completions/dnf.fish | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/share/completions/dnf.fish b/share/completions/dnf.fish index 7320fe026..d661cb292 100644 --- a/share/completions/dnf.fish +++ b/share/completions/dnf.fish @@ -7,12 +7,16 @@ function __dnf_list_installed_packages end function __dnf_list_available_packages + # dnf --cacheonly list --available gives a list of non-installed packages dnf is aware of, + # but it is slow as molasses. Unfortunately, sqlite3 is not available oob (Fedora Server 32). if type -q sqlite3 # This schema is bad, there is only a "pkg" field with the full # packagename-version-release.fedorarelease.architecture # tuple. We are only interested in the packagename. sqlite3 /var/cache/dnf/packages.db "SELECT pkg FROM available WHERE pkg LIKE \"$cur%\"" 2>/dev/null | - string replace -r -- '-[^-]*-[^-]*$' '' + string replace -r -- '-[^-]*-[^-]*$' '' + else + dnf repoquery --cacheonly "$cur*" --qf "%{NAME}" --available 2>/dev/null end end