[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Hint apt to install the desired alternative



Hi,
(please CC: me on replies)


I've stumbled upon an interesting problem in apt. Consider a situation
where the resolved dependency chain of package looks like this:

A | virtual-package, B | virtual-package

In this case, apt always seems to pick A because it sorts alphabetically
earlier than B. However, that's not what I want. I'd like to have B
unless the user manually hints apt to use A. How could I achieve that by
declaring a packaging relation?

Consider this full example (also attached as a source package):

debian/control:
-----------------------------------------------------------------------
Source: my-problem
Section: utils
Priority: extra
Maintainer: Joe Maintainer <joe@example.com>
Build-Depends: debhelper (>= 8)
Standards-Version: 3.9.3

Package: package-i-want-to-install
Architecture: all
Depends: package-dependency, another-package-dependency-i-want |
virtual-package
Description: None
 Really.

Package: package-dependency
Architecture: all
Depends: another-package-dependendency-i-dont-want | virtual-package
Description: None
 Really.

Package: another-package-dependendency-i-dont-want
Architecture: all
Replaces: virtual-package
Provides: virtual-package
Description: None
 Really.

Package: another-package-dependency-i-want
Architecture: all
Replaces: virtual-package
Provides: virtual-package
Description: None
 Really.
-----------------------------------------------------------------------


Trying to install "package-i-want-to-install" with apt (tried both,
0.9.3 and 0.8.10.3+squeeze1) yields:

# apt-get install package-i-want-to-install
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  another-package-dependendency-i-dont-want package-dependency
The following NEW packages will be installed:
  another-package-dependendency-i-dont-want package-dependency
package-i-want-to-install
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2980 B of archives.
After this operation, 76.8 kB of additional disk space will be used.


That's not what I would expect here. Instead, apt should perhaps install
another-package-dependency-i-want, given it is clearly preferred by the
manually installed package over the alternative. I guess, apt does not
care and installs packages as they sort lexically.

That's a compliant and legit behavior given the dependency clearly
states an alternative is ok but it still seems strange to me.

Giving a manual hint being it pinning or picking an alternative works
fine of course:

# apt-get install package-i-want-to-install
another-package-dependency-i-want
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  package-dependency
The following NEW packages will be installed:
  another-package-dependency-i-want package-dependency
package-i-want-to-install
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2970 B of archives.
After this operation, 76.8 kB of additional disk space will be used.


This is, however, not what I want as I would like to avoid manual hints.
I could conflict with another-package-dependendency-i-dont-want or omit
the | virtual-package alterantive, but that's both not acceptable either.


How can I hint apt to pick the alternative I want by a package relation
in "package-i-want-to-install" but still letting the user to override
the choice on purpose?


-- 
with kind regards,
Arno Töll
IRC: daemonkeeper on Freenode/OFTC
GnuPG Key-ID: 0x9D80F36D

Attachment: my-problem.tar.gz
Description: GNU Zip compressed data

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: