You are not logged in.

#1 2018-03-18 21:48:56

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

[Solved] Search for what packages "provide" a package?

Sorry if this is a silly question, but I cannot find it in the man page:

If package "bash" says it "provides" package "sh", then installing package "mono" (which depends on "sh") will resolve that dependency against "bash".

But how do I do an equivalent query using pacman, such as "show me all packages that "provide" "sh""?

Last edited by jernst (2018-03-19 17:20:03)

Offline

#2 2018-03-18 22:45:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [Solved] Search for what packages "provide" a package?

pacman -S sh


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-03-19 02:33:37

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: [Solved] Search for what packages "provide" a package?

Right. But if there are several packages that "provide" the same (virtual) package, how can I determine what my choices are without starting to install one?

Offline

#4 2018-03-19 04:25:20

amish
Member
Registered: 2014-05-10
Posts: 470

Re: [Solved] Search for what packages "provide" a package?

If you know the expected file then you can use -Fo option, which will list all packages containing that file.

pacman -Fo usr/bin/sh

But the following should give you what you want exactly

For example to look for packages which provide "cron" package:

pacman -Si | grep "^\(Name\|Provides\)\s" | grep -EB1 "^Provides\s+:.+\bcron\b"
Name            : cronie
Provides        : cron
--
Name            : fcron
Provides        : cron
--
Name            : dcron
Provides        : cron

Offline

#5 2018-03-19 04:56:13

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] Search for what packages "provide" a package?

pacsift --sync --provides=sh

Requires the pacutils package from community.

Note that there is only one package which provides /bin/sh so this wasn't a great example. tongue

amish wrote:

If you know the expected file then you can use -Fo option, which will list all packages containing that file.

pacman -Fo usr/bin/sh

But the following should give you what you want exactly

For example to look for packages which provide "cron" package:

pacman -Si | grep "^\(Name\|Provides\)\s" | grep -EB1 "^Provides\s+:.+\bcron\b"
Name            : cronie
Provides        : cron
--
Name            : fcron
Provides        : cron
--
Name            : dcron
Provides        : cron

All this grep is super inefficient. sad

Also:

$ pacsift --sync --provides=cron
core/cronie
community/fcron
$ pacman -Si dcron
error: package 'dcron' was not found

Something you're not mentioning? wink Like, for example, the "Repository" key?

Last edited by eschwartz (2018-03-19 04:58:38)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2018-03-19 05:11:23

amish
Member
Registered: 2014-05-10
Posts: 470

Re: [Solved] Search for what packages "provide" a package?

grep isn't inefficient but listing ALL package details is inefficient.

Otherwise first grep will eliminate most lines instantly.

But then it does the work if its only one time thing. (Yes pacsift is better solution but this works if you dont want to install additional package)

Actually I have archlinuxcn repo enabled (for gnucash) which also has dcron. (Hence it got listed in my example)

I just gave a template example on how it can be done. If user does not have particular repository its not going to be listed anyway. So no need to give Repository key unless he wants to check a specific repository. (OP didnt mention anything about knowing repository)

Last edited by amish (2018-03-19 05:21:57)

Offline

#7 2018-03-19 10:52:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [Solved] Search for what packages "provide" a package?

jernst wrote:

Right. But if there are several packages that "provide" the same (virtual) package, how can I determine what my choices are without starting to install one?

Again: `pacman -S <pkg>`  That's it.

For example:

# pacman -S cron
:: There are 2 providers available for cron:
:: Repository core
   1) cronie
:: Repository community
   2) fcron

Enter a number (default=1):

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-03-19 13:35:48

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,560

Re: [Solved] Search for what packages "provide" a package?

Of course, -S doesn't work when it's also the name of a package, which is an extremely common case.

Offline

#9 2018-03-19 13:39:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,530
Website

Re: [Solved] Search for what packages "provide" a package?

But that does precisely meet the criteria set out in the first post.  If a package (e.g. 'mono') listed a dependency for which there was an exact package name match and other packages that 'provide' the same thing, then the exact match would be installed as a dependency with no option provided.

So given the question "how do I do the equivalent query" the answer is `pacman -S <pkgname>`.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2018-03-19 15:04:17

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [Solved] Search for what packages "provide" a package?

pacsift --sync --any --exact --provides=foo --name=foo

This will match an exact pkgname, and tell you all packages that either are that pkgname or provide it.

I think this should make everyone happy, right?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#11 2018-03-19 17:19:44

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: [Solved] Search for what packages "provide" a package?

I didn't know about pacsift. That seems to be the most comfortable answer. Thanks, everybody.

Offline

Board footer

Powered by FluxBB