Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement provides command #147

Closed
4 of 5 tasks
Tracked by #429
mcurlej opened this issue Nov 11, 2022 · 11 comments
Closed
4 of 5 tasks
Tracked by #429

Implement provides command #147

mcurlej opened this issue Nov 11, 2022 · 11 comments
Assignees
Labels
epic Priority: MEDIUM RFE Request For Enhancement (as opposed to a bug) Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Milestone

Comments

@mcurlej
Copy link
Member

mcurlej commented Nov 11, 2022

  • Command: provides

    • Priority medium
  • Aliases: prov, whatprovides, wp

    • To many aliases - proposing to keep whatprovides or no aliases at all
    • Priority low
  • dnf [options] provides <provide-spec>

Finds the packages providing the given <provide-spec>. This is useful when one knows a filename and wants to find what package (installed or not) provides this file. The <provide-spec> is gradually looked for at following locations:

  • 1. The <provide-spec> is matched with all file provides of any available package:

- [ ] $ dnf provides /usr/bin/gzip

gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Filename    : /usr/bin/gzip
  1. Then all provides of all available packages are searched:
$ dnf provides "gzip(x86-64)"
gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Provide     : gzip(x86-64) = 1.9-9.fc29
  1. 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:
  • $ dnf provides zless
gzip-1.9-9.fc29.x86_64 : The GNU data compression program
Matched from:
Filename    : /usr/bin/zless
  1. If this last step also fails, DNF returns “Error: No Matches found”.

This command by default does not force a sync of expired metadata. See also Metadata Synchronization.

@mcurlej mcurlej added the RFE Request For Enhancement (as opposed to a bug) label Nov 11, 2022
@j-mracek j-mracek added this to the Fedora 40 milestone Nov 15, 2022
@mcurlej mcurlej added this to DNF team Nov 24, 2022
@mcurlej mcurlej moved this to Backlog in DNF team Nov 24, 2022
@inknos inknos self-assigned this Mar 22, 2023
@glum23
Copy link
Contributor

glum23 commented Apr 18, 2023

dnf commands provides/whatprovides together with options --provides/--whatprovides are pretty confusing. It'd be nice to reduce this confusion in dnf5. How about marking "provides" command as obsoleted (without any aliases) and suggest to use the options instead?

@modzilla99
Copy link

dnf commands provides/whatprovides together with options --provides/--whatprovides are pretty confusing. It'd be nice to reduce this confusion in dnf5. How about marking "provides" command as obsoleted (without any aliases) and suggest to use the options instead?

I understand what you mean. But I'm in favor of keeping at least the "provides" subcommand. I don't use "whatprovides" or any of the flags. I think there are already to many flags and using a subcommand is much easier to learn as I know some that use "provide" as well. It's also nice for tab completion.

@inknos
Copy link
Collaborator

inknos commented Apr 18, 2023

@glum23
a note:
dnf provides gives a bit more context than dnf repoquery --whatprovides

$ dnf repoquery --whatprovides bash
bash-0:5.1.16-4.fc37.x86_64
bash-0:5.2.15-1.fc37.i686
bash-0:5.2.15-1.fc37.x86_64
$ dnf provides bash
Last metadata expiration check: 0:00:40 ago on Út 18. dubna 2023, 12:01:24.
bash-5.1.16-4.fc37.x86_64 : The GNU Bourne Again shell
Repo        : fedora
Matched from:
Provide    : bash = 5.1.16-4.fc37

bash-5.2.15-1.fc37.i686 : The GNU Bourne Again shell
Repo        : updates
Matched from:
Provide    : bash = 5.2.15-1.fc37

bash-5.2.15-1.fc37.x86_64 : The GNU Bourne Again shell
Repo        : @System
Matched from:
Provide    : bash = 5.2.15-1.fc37

bash-5.2.15-1.fc37.x86_64 : The GNU Bourne Again shell
Repo        : updates
Matched from:
Provide    : bash = 5.2.15-1.fc37

provides also highlights matching Provide or File and so it carries more information than --whatprovides

@j-mracek j-mracek added Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take and removed ready for review labels Apr 20, 2023
@j-mracek j-mracek moved this from Backlog to Todo in DNF team Aug 2, 2023
@inknos inknos moved this from Todo to In Progress in DNF team Sep 27, 2023
@mcurlej mcurlej moved this from In Progress to Todo in DNF team Oct 19, 2023
@mcurlej mcurlej added the epic label Nov 3, 2023
@inknos inknos moved this from Todo to In Progress in DNF team Nov 22, 2023
@inknos
Copy link
Collaborator

inknos commented Dec 5, 2023

The command is implemented.

No alias were implemented.

I would like to dnf provides "gzip(x86-64)" is documented but actually does not work (tested on fedora:latest container). Should we remove that piece of documentation?

[root@77f6b5af11a0 /]# dnf provides -q "gzip(x86-64)"
Error: No matches found. If searching for a file, try specifying the full path or using a wildcard prefix ("*/") at the beginning.

@j-mracek
Copy link
Contributor

j-mracek commented Dec 6, 2023

With DNF4 it works:
dnf-4.18.1-20231201005453.10.gcb54681d.fc38.noarch

dnf provides "gzip(x86-64)"
Last metadata expiration check: 0:10:37 ago on Wed 06 Dec 2023 09:44:00 AM CET.
gzip-1.12-3.fc38.x86_64 : GNU data compression program
Repo        : @System
Matched from:
Provide    : gzip(x86-64) = 1.12-3.fc38

gzip-1.12-3.fc38.x86_64 : GNU data compression program
Repo        : fedora
Matched from:
Provide    : gzip(x86-64) = 1.12-3.fc38

@inknos
Copy link
Collaborator

inknos commented Dec 6, 2023

something must be wrong on my side then

@m-blaha
Copy link
Member

m-blaha commented Dec 6, 2023

something must be wrong on my side then

Doesn't your laptop use a different architecture?

@inknos
Copy link
Collaborator

inknos commented Dec 6, 2023

Doesn't your laptop use a different architecture?

it does, I tried it on aarch too

@j-mracek
Copy link
Contributor

j-mracek commented Dec 6, 2023

dnf provides "gzip(x86-64)" --forcearch='x86_64' should help or try dnf provides "gzip(aarch-64)" for aarch64

@inknos
Copy link
Collaborator

inknos commented Dec 6, 2023

dnf provides "gzip(x86-64)" --forcearch='x86_64' should help or try dnf provides "gzip(aarch-64)" for aarch64

works. I am confused now. why do I have to use aarch-64 when the packages are aarch64?

for example, this would work

dnf4 provides "gzip(aarch-64)" --forcearch=aarch64

but not this

dnf4 provides "gzip(aarch-64)" --forcearch=aarch-64

@jan-kolarik
Copy link
Member

I am closing this as all provides functionality is implemented now, except the arch-specific scenarios which need to be clarified in the follow-up ticket.

@github-project-automation github-project-automation bot moved this from In Progress to Done in DNF team May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Priority: MEDIUM RFE Request For Enhancement (as opposed to a bug) Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
Archived in project
Development

No branches or pull requests

7 participants