6

As the title suggests, I want to get a list of all packages that provide a certain virtual package. A way of doing this would be to write a shell script that parses all output of

apt-cache search -f .*

and outputs all packages that have the virtual package in the provides section. The problem with this approach is that it takes an awful long amount of time to execute. I guess that there should be a simple command that does this in an efficient manner, but which I wasn't able to find.

peterh
  • 11,875
  • 18
  • 85
  • 108
Ioan Alexandru Cucu
  • 11,981
  • 6
  • 37
  • 39

2 Answers2

8

If you have aptitude installed, it provides a lot of patterns that can be used for searching.

In particular, for the case of looking for packages that provide a given virtual package name, you can use this:

$ aptitude search '?provides(pattern)'

where pattern can be set to the virtual package name you're looking for.

For example:

$ aptitude search -F %p '?provides(mail-reader)'
balsa                                                                           
bsd-mailx                                                                       
claws-mail                                                                      
cone                                                                            
emacs                                                                           
emacs23                                                                         
emacs23-lucid                                                                   
emacs23-nox                                                                     
evolution                                                                       
gnus                                                                            
im                                                                              
jed                                                                             
kmail                                                                           
kmail-mobile                                                                    
mailutils                                                                       
mailutils-mh                                                                    
mew                                                                             
mew-beta                                                                        
mew-beta-bin                                                                    
mew-bin                                                                         
mutt                                                                            
nmh                                                                             
opera                                                                           
opera-next                                                                      
seamonkey-mailnews                                                              
sylpheed                                                                        
thunderbird                                                                     
tkrat                                                                           
vm                                                                              
wl                                                                              
wl-beta                                                                         
xemacs21-mule                                                                   
xemacs21-mule-canna-wnn                                                         
xemacs21-nomule                                                                 
xjed                                                                            
xul-ext-lightning  
jcollado
  • 39,419
  • 8
  • 102
  • 133
1

See if dpkg-query will suit your needs.

Dennis Williamson
  • 346,391
  • 90
  • 374
  • 439
  • (I realize this answer is from 2010...) Any particular `dpkg-query` options? Just linking to the manual page doesn't seem likely to help the random visitor, nor really constitute an answer. – derobert May 12 '17 at 15:19