It appears to not be designed to be parsed machinally, but this is not problematic, because what I want is consistently placed:
[root@1656943212 BEEDELLROKEJULIANLOCKHART]# dnf provides spotify
Last metadata expiration check: 0:42:44 ago on Mon 18 Jul 2022 23:56:32 BST.
spotify-client-1.1.84.716-1.fc36.x86_64 : Spotify music player native client
Repo : @System
Matched from:
Provide : spotify = 1.1.84.716-1.fc36
I want the package-name, which is “spotify-client-1.1.84.716-1.fc36.x86_64”. How might I ascertain what regex or tool to utilize to cut everything from the 2nd line to the colon?
Or use dnf repoquery, which is very versatile DNF Command Reference — dnf latest documentation dnf repoquery --whatprovides spotify --nvr
or use --qf to get exactly what you want: dnf repoquery --whatprovides spotify --qf "%{name}-%{version}-%{release}.%{arch}"
Use CLI tool => dnf list grep what you want surrounded with asterisks as wildcard. No natif package, you must download and install spotify-client.rpm, search on the web as exists.
Irrelevant, because Spotify provides a local client, too. The example utilized is irrelevant anyway, because I am able to want the name of the package that provides pkcon, for instance.
If you query for spotify* or spotify-client you’ll probably get results with dnf repoquery for spotify.
Now I see that the docs states that
`<package-file-spec>` is similar to `<package-spec>`, except provides matching is not performed. Therefore, `<package-file-spec>` is matched only against NEVRAs and file provides.
and dnf matches by <package-spec> while dnf repoquery by <package-file-spec> (which doesn’t check what package states to provide). So it’s not a bug, I just didn’t know that before.
--nevra
Show found packages in the name-epoch:version-release.architecture format. Same as --qf "%{name}-%{epoch}:%{version}-%{release}.%{arch}" (default).
OK … in a terminal type ‘man dnf’ … all information about keyword ‘provides’ is explained concisely near the bottom of the page in subsection ‘Provides Command’', very few lines of text. Goodbye …
My ultimate solution has been pwsh -c "pkcon -p what-provides $value|Select-String 'Available','Installed'|awk '{print $2}'", but I have been unable to ascertain why dnf repoquery --whatprovides $value and pkcon what-provides $value are unable to state what provides obs and spotify.
DNF assumes that the <provide-spec> is a system command, prepends it with /usr/bin/, /usr/sbin/ prefixes (one at a time) and does the file provides search again. For legacy reasons (packages that didn’t do UsrMove) also /bin and /sbin prefixes are being searched
so for another example: dnf provides firefox
or dnf rq --whatprovides firefox
both work
but dnf provides firefox-bin
or dnf rq --whatprovides firefox-bin
does not unless you specify the path (/usr/lib64/firefox/firefox-bin) or use additional wildcards.