Score:3

Multiple DEBs provide virtual package, which is listed as Depends

us flag

I have my own APT repo which houses custom DEBs created/packaged by me. In this repo are a set of DEB packages which have the following in their control file

Package: my-foo-<type>
Architecture: any
Section: admin
Provides: my-foo
Conflicts: my-foo

where <type> is one of several types (e.g. abc, def, etc). In other words, I have multiple actual packages which provide the same virtual my-foo package. As expected, if I try to run apt install my-foo, I am presented with the expected prompt

Package my-foo is a virtual package provided by:
  my-foo-abc 0.3.0-1
  my-foo-def 0.4.3-1
You should explicitly select one to install.

I also have another package in the same repo which has Depends: my-foo in its control file. I expected that when I try to install this package without having explicitly specified which my-foo virtual flavor to use, I should likewise be prompted for a selection. However, that's not what I get - apt seemingly selects the first package which satisfied the virtual package name.

Is there a way to force the desired behavior?

vn flag
Does [this](https://askubuntu.com/a/739065/349837) answer help you?
Paul Grinberg avatar
us flag
@PabloBianchi - Thanks for the link. The answer clarifies the behavior, although it doesn't help me achieve what i was desiring
James S. avatar
de flag
Your desired behavior is counter to the spec. From the spec, at [Debian Packaging Policy](https://www.debian.org/doc/debian-policy/ch-relationships.html#virtual-packages-provides) To specify which of a set of real packages should be the default to satisfy a particular dependency on a virtual package, list the real package as an alternative before the virtual one.
Score:1
ng flag

I expected that when I try to install this package without having explicitly specified which my-foo virtual flavor to use, I should likewise be prompted for a selection.

apt provides no such mechanism. I'm not sure what more can be said about this. You're expecting something that does not exist. There is no code in apt to provide such a prompt.

As @James S. pointed out, it will prefer the first non-virtual alternative if alternatives are given and all dependencies would be met by its selection. Otherwise, the dependency resolver will find a solution without prompting.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.