Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Finding package for a given program?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Thu Dec 09, 2010 9:00 am    Post subject: [SOLVED] Finding package for a given program? Reply with quote

I'm running an application which requires "dc" (calculator), but it's not installed on my system.

How do I find out which package "dc" is a part of?


Last edited by pgu on Fri Dec 10, 2010 10:21 am; edited 1 time in total
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Dec 09, 2010 9:10 am    Post subject: Reply with quote

Code:
$ qfile /usr/bin/dc
sys-devel/bc (/usr/bin/dc)
For installed packages, qfile or equery belongs, from app-portage/portage-utils and app-portage/gentoolkit respectively; for packages that are not installed, asking seems to be the most reliable approach.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Thu Dec 09, 2010 9:43 am    Post subject: Reply with quote

desultory wrote:
Code:
$ qfile /usr/bin/dc
sys-devel/bc (/usr/bin/dc)
For installed packages, qfile or equery belongs, from app-portage/portage-utils and app-portage/gentoolkit respectively; for packages that are not installed, asking seems to be the most reliable approach.


Thanks. But I can't get equery to tell me the location of dc:

Code:
# equery belongs dc
[ Searching for file(s) dc in *... ]


gives no result?
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Thu Dec 09, 2010 10:47 am    Post subject: Reply with quote

As expected, given that it is not currently installed.

The program you appear to be seeking is provided as part of sys-devel/bc.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Thu Dec 09, 2010 3:17 pm    Post subject: Reply with quote

desultory wrote:

The program you appear to be seeking is provided as part of sys-devel/bc.


Yes, I got that from your previous post (again, thank you). But I was hoping to find a method to get the package name of any given program/file I would like to install, which is not currently installed on the machine.
Back to top
View user's profile Send private message
desultory
Bodhisattva
Bodhisattva


Joined: 04 Nov 2005
Posts: 9410

PostPosted: Fri Dec 10, 2010 6:37 am    Post subject: Reply with quote

Providing comprehensive coverage with such a service would be quite difficult to do, given that changes in USE flags frequently change what programs are installed as part of any given package. Between that, the frequent changes to the main tree and the moving target provided by any attempt to include overlays it has never, to my knowledge, been fully implemented. However, there was a partial implementation, after a fashion, as part of one of the tinderbox systems; if it is still present and I can find it, I will post a link to it.
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Fri Dec 10, 2010 10:21 am    Post subject: Reply with quote

I understand. But a emerge could keep a database of all installed files and the associated package.
Back to top
View user's profile Send private message
avendesora
Veteran
Veteran


Joined: 16 Aug 2002
Posts: 1739
Location: Betelgeuse vicinity

PostPosted: Fri Dec 10, 2010 10:51 am    Post subject: Reply with quote

It does, see desultory's first reply in this thread.
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2508
Location: Silver City, NM

PostPosted: Fri Dec 10, 2010 12:47 pm    Post subject: Reply with quote

pgu wrote:
Thanks. But I can't get equery to tell me the location of dc:
Code:
# equery belongs dc
[ Searching for file(s) dc in *... ]

gives no result?

That is because you did not give an absolute path to the program you were inquiring about. Try:
Code:
$ equery belongs $(which bc)

I use that so often, I made a bash function called "what":
Code:
what () {
   equery belongs $(which $1)
}
Back to top
View user's profile Send private message
tomk
Bodhisattva
Bodhisattva


Joined: 23 Sep 2003
Posts: 7221
Location: Sat in front of my computer

PostPosted: Fri Dec 10, 2010 1:18 pm    Post subject: Reply with quote

It works without an absolute path now too:

Code:
$ equery belongs dc
[ Searching for file(s) dc in *... ]
sys-devel/bc-1.06.95 (/usr/bin/dc)

_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
marens
Apprentice
Apprentice


Joined: 05 Aug 2004
Posts: 173

PostPosted: Sat Dec 11, 2010 12:21 am    Post subject: Reply with quote

http://www.portagefilelist.de/index.php/Special:PFLQuery2?file=%2Fusr%2Fbin%2Fdc&searchfile=lookup&lookup=file#result

or app-portage/pfl
_________________
If English was good enough for Jesus, then it's good enough for you!
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Mon Mar 28, 2011 3:27 pm    Post subject: Reply with quote

Thanks marens. Quite often I find that I need to install a tool I've used before (like dc). But I have no idea of the package or where gentoo would keep it (/bin, /usr/bin/, /sbin/ etc).
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Sat Jan 05, 2013 6:06 pm    Post subject: Reply with quote

Hmm. I can't get this to work now. I would like to install "dig". I first tried:

Code:
# equery belongs dig
 * Searching for dig ...
sys-kernel/gentoo-sources-3.5.7 (/usr/src/linux-3.5.7-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.6.11 (/usr/src/linux-3.6.11-gentoo/arch/ia64/dig)


Which does not make sense as the dig I'm looking for is similar to nslookup and has nothing to do with the kernel. Then I located it on an older system:

Code:
type dig
dig is /usr/bin/dig


and tried to locate the package on my recent system without any luck:

Code:
# equery belongs /usr/bin/dig
 * Searching for /usr/bin/dig ...
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Sat Jan 05, 2013 6:10 pm    Post subject: Reply with quote

I found it as a part of bind-tools, but I would like to find a method in which I can find the package a given binary or library belongs too...
Back to top
View user's profile Send private message
dol-sen
Retired Dev
Retired Dev


Joined: 30 Jun 2002
Posts: 2805
Location: Richmond, BC, Canada

PostPosted: Sat Jan 05, 2013 9:30 pm    Post subject: Reply with quote

It is working for me...
Code:
brian@big_daddy ~/Dev/git/gentoolkit $ equery belongs dig
 * Searching for dig ...
net-dns/bind-tools-9.9.2 (/usr/bin/dig)
sys-kernel/gentoo-sources-3.2.1 (/usr/src/linux-3.2.1-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.4.3 (/usr/src/linux-3.4.3-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.4.4 (/usr/src/linux-3.4.4-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.5.4 (/usr/src/linux-3.5.4-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.6.2 (/usr/src/linux-3.6.2-gentoo/arch/ia64/dig)
sys-kernel/gentoo-sources-3.6.6 (/usr/src/linux-3.6.6-gentoo/arch/ia64/dig)
sys-kernel/zen-sources-9999 (/usr/src/linux-3.99-zen0/arch/ia64/dig)
brian@big_daddy ~/Dev/git/gentoolkit $


equery's belongs module is for precisely what you are wanting. It only works for currently installed files and packages though. Also, since the above query was quite generic by specifying "dig" it listed all occurrences of a file called "dig" in my system. It is up to the user to decide which one is the one he/she wanted.

hmm, side note, time to clean out some old kernels...

For finding out what pkg a file belongs to in general, even if not installed. There is app-portage/pfl and it's website where you can do queries to find out what pkg you need to install to get the file/functionality you were looking for.
_________________
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Back to top
View user's profile Send private message
pgu
l33t
l33t


Joined: 30 Jul 2009
Posts: 718
Location: Oslo, Norway

PostPosted: Wed Jan 16, 2013 5:57 pm    Post subject: Reply with quote

thank you dol-sen. The web site has the information I was looking for.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum