Commit Graph

3 Commits

Author SHA1 Message Date
Alexey Tourbin
7e1e99e990 updated alt-versionmatch-TryToChangeVer.patch
This fixes two problems:

1) Wrong usage of ScoreSort condition.  ScoreSort sorts descending,
not ascending.  Thus, previous patch assigned wrong score for already
installed packages.

2) Explicit check for already installed packages.  If any package
that satisfies versioned dependency is already installed, nothing
at all should be installed (even if better versions are available).
2007-04-09 16:16:57 +04:00
0310bc18d9 apt-0.5.15lorg2-alt-versionmatch-TryToChangeVer.patch: Fix redundant check 2007-03-23 22:02:32 +00:00
Alexey Tourbin
6c2eeb8ea6 updated versionmatch/TryToChangeVer logic
My previous versionmatch.patch was half-way wrong and/or incomplete.
The problem was that pkgCache::VerIterator::CompareVer() does not
do full-blown version comparison, but rather something strange
(see apt-pkg/pkgcache.cc).

I also noticed that, while TryToInstall() does use Fix.ScoreSort,
TryToChangeVer() does not, which is probably wrong.

The solution is as follows:

1) pkgVersionMatch::FindAll() does not sort versions any longer;
it does not have sufficient information, such as Cache and Fix,
to sort the versions.

2) TryToChangeVer() calls FindAll() instead of Find() and uses
Fix.ScoreSort to sort the versions.  If Fix.ScoreSort returns 0,
it also tries Cache.VS().CmpVersion(), which is the right way to
reach rpmvercmp().

Also updated 'Selected version ... for ...' diagnostics.

(old result and message)
$ ~tmp/build/aptbox/apt-get --dry-run install python=2.4 2>&1 |grep ^Selected
Selected version 2.4.4-alt8 for python
$

The result was wrong, because I have a better version,
which is 2.4.4-alt8.1.

(new result and message)
$ ~tmp/build/aptbox/apt-get --dry-run install python=2.4 2>&1 |grep ^Selected
Selected version python-strict#2.4.4-alt8.1 for python=2.4
$

Update: also do not sort ascending and reverse the list, this is going
to break "stable sort" logic.  Just sort descending.

Update2: actually make CmpVersion() primarily sort condition and
Fix.ScoreSort secondary sort condition.  Fix.ScoreSort should not be
activated early, because e.g. for 'python-devel>=2.3' it is going to
select python2.3-dev, but I want python-dev#2.4.
2007-03-22 23:14:38 +03:00