0

By "alternatives" I mean (for the most part; see exception below) the "roles" corresponding to the files under /var/lib/dpkg/alternatives.

These roles include

awk
desktop-background
editor
global-assembly-cache-tool
haskell-compiler
infobrowser
java
w
www-browser
x-window-manager
zsh

among many others.

The one exception I have in mind is the role display-manager (aka login-manager), which, AFAICT, is not represented under /var/lib/dpkg/alternatives, but I'm very much interested in.

Given one of these roles, let's call it foo, I want to know all the available1 packages that can play foo, or, said more precisely, that provide an executable that can play foo.

Of course, I want to know both the package and the path to the relevant executable, since the latter is not always obvious from the former; e.g. for the role x-window-manager, one such package is fluxbox, while the "relevant executable" is /usr/bin/startfluxbox, and not /usr/bin/fluxbox.


(At least for the roles under /var/lib/dpkg/alternatives, packages providing such roles must be packaged in such a way that the alternatives manager can properly recognize them; that's my understanding, anyway. If so, I'm hoping that there is some automatic way to identify all the packages that provide a particular role.)


1 Available, that is, through the sources specified in my /etc/apt/sources* config.

kjo
  • 14,779
  • 25
  • 69
  • 109
  • I also voted to close this as a dupe of my earlier question, which has not been answered. My guess is that the current packaging system does not provide a way to answer this question. This question is not an exact dupe; in particular my earlier question does not ask for "Of course, I want to know both the package and the path to the relevant executable". However, this is unrelated to the alternatives issue, and should probably be a separate question. – Faheem Mitha Feb 09 '16 at 09:05
  • I cannot delete an accepted answer. :D I have posted it on the other q, so if you unaccept it, I'll delete this answer. – muru Feb 09 '16 at 13:55
  • @muru: thanks, I appreciate your cooperation. I won't delete my question after all (I really want to, but Gilles says not to, and I owe Gilles big time, so I won't). Sorry for causing you extra work. (That said, I'm glad you posted your answer in the other thread. One of the reasons I oppose the policy of keeping duplicates around is that duplicates dilute the information, make it harder to find contradictions or inconsistencies between answers, and ultimately make it more confusing, i.e. harder, ... – kjo Feb 09 '16 at 14:41
  • ...not easier, for those looking for the information. If duplicates are bad enough to be flagged and discouraged, then they are bad enough to be expunged altogether.) – kjo Feb 09 '16 at 14:42

1 Answers1

1

Virtual packages and the Debian alternatives system (which is where binaries come into play) are related but not the same. For packages, you can use apt-cache to find which (real) packages "provide" it:

$ apt-cache showpkg awk
Package: awk
Versions: 

Reverse Depends: 
  base-files,awk
  base-files,awk
Dependencies: 
Provides: 
Reverse Provides: 
mawk:i386 1.3.3-17ubuntu2
gawk:i386 1:4.0.1+dfsg-2.1ubuntu2
original-awk 2012-12-20-1
mawk 1.3.3-17ubuntu2
gawk 1:4.0.1+dfsg-2.1ubuntu2

For display managers, the virtual package is x-display-manager:

$ apt-cache showpkg x-display-manager
Package: x-display-manager
Versions: 

Reverse Depends: 
  utf8-migration-tool,x-display-manager
  razorqt,x-display-manager
  lxde,x-display-manager
  numlockx,x-display-manager
  ltsp-client-core,x-display-manager
Dependencies: 
Provides: 
Reverse Provides: 
gdm 3.10.0.1-0ubuntu3.1
lightdm 1.10.6-0ubuntu1
kdm 4:4.11.11-0ubuntu0.2
xdm 1:1.1.11-1ubuntu1
wdm 1.28-16
slim 1.3.4-2.1
lxdm 0.4.1-0ubuntu6
kdm 4:4.11.8-0ubuntu6
gdm 3.10.0.1-0ubuntu3
lightdm 1.10.0-0ubuntu3
muru
  • 69,900
  • 13
  • 192
  • 292
  • Thanks, that answers half of my question. How would I find the executable in the package that fulfills the role. E.g., how would I find out that it is `/usr/bin/startfluxbox` that provides the `x-window-manager` role in the `fluxbox` package? – kjo Feb 09 '16 at 08:52
  • @kjo nothing in the package metadata provides that information, unfortunately. The alternatives are created using `postinst` scripts, so without examining the package itself, I don't think that can be discovered. – muru Feb 09 '16 at 08:55
  • Thank you. BTW, as you pointed out in your comment, my question is a duplicate. I would gladly delete my question, but for that I'd need you to delete your answer first. (Ironic that a question that is, essentially, about redundancy among programs would itself be eliminated for being a redundant question.) – kjo Feb 09 '16 at 09:08
  • @kjo you don't need to delete duplicates - closing it as a duplicate is fine (See ["Should duplicates be deleted?"](http://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled)). – muru Feb 09 '16 at 09:11
  • As with practically every SE policy, I vehemently disagree with this one, but there's nothing I can do about it, other than not posting at all... – kjo Feb 09 '16 at 10:09
  • @kjo [You should not delete duplicates](http://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled). Please do not delete this question. – Gilles 'SO- stop being evil' Feb 09 '16 at 14:09
  • @Gilles: fine, but only in deference to you. (It's the least I can do in return for all the help I've received from you, and all your contributions to this site.) – kjo Feb 09 '16 at 14:30