#155915 apt should be smarter if given a virtual package and a real instance of it

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Marc Haber
Date:
2025-01-15 10:57:02 UTC
Severity:
normal
Tags:
#155915#5
Date:
2002-08-08 12:01:15 UTC
From:
To:
Hi,

I have a small script that outputs the build-depends of a package
currently built:
|[38/19]haber@paola:~/debian/exim$ ~/aptbuilddep
| libpcre3-dev libldap2-dev libpam0g-dev libident-dev libwrap0-dev libdb2-dev xlibs-dev libxaw-dev libperl-dev

It is intended to be used like this:
|[34/15]haber@paola:~/debian/exim$ ~/aptbuilddep  | xargs sudo apt-get install
|Reading Package Lists...
|Building Dependency Tree...
|Package libxaw-dev is a virtual package provided by:
|  libxaw7-dev 4.1.0-16
|  libxaw6-dev 4.1.0-16
|You should explicitly select one to install.
|E: Package libxaw-dev has no installation candidate

Please notice that this is differnent from apt-get build-depends as it
works as well if the package in question is not in the aptable archive.

The example given above shows a problem - libxaw7 is a virtual package.

It would be nice and easy if it would be possible to just specify the
"real" package as an addition to the command line. This does not work
because apt-get is processing its arguments from left to right,
bombing out again on the virtual package even if the solution to the
problem is given on the very same command line:
|[37/18]haber@paola:~/debian/exim$ ~/aptbuilddep | xargs --verbose sudo apt-get install libxaw7-dev
|sudo apt-get install libxaw7-dev libpcre3-dev libldap2-dev libpam0g-dev libident-dev libwrap0-dev libdb2-dev xlibs-dev libxaw-dev libperl-dev
|Reading Package Lists...
|Building Dependency Tree...
|Package libxaw-dev is a virtual package provided by:
|  libxaw7-dev 4.1.0-16
|  libxaw6-dev 4.1.0-16
|You should explicitly select one to install.
|E: Package libxaw-dev has no installation candidate
|[38/19]haber@paola:~/debian/exim$

It would be nice if apt-get would be able to resolve this in a smarter
way.

Thanks for considering this.

Greetings
Marc