compareByPreference: handle the integer-gmp vs -simple case
authorAlp Mestanogullari <alp@well-typed.com>
Mon, 12 Nov 2018 14:38:46 +0000 (15:38 +0100)
committerAlp Mestanogullari <alp@well-typed.com>
Mon, 12 Nov 2018 16:50:06 +0000 (17:50 +0100)
commit86ee74dc999db6030874ddaf5d10adec23108c02
treee9a24641ae01c692ffc0661e15594cb2185b3127
parentd30352add1da67dd0346613853cd423c7becbaeb
compareByPreference: handle the integer-gmp vs -simple case

Currently, it assumes the package names are identical and this
breaks in the case where integer-gmp is in one package db and
integer-simple in another. This became a problem with
the commit: fc2ff6dd7496a33bf68165b28f37f40b7d647418.

Instead of following the precedence information, leading to
the right choice, the current code would compare the
integer-gmp and integer-simple versions and pick integer-gmp
because it happened to have a greater version, despite having
a lower precedence. See
https://github.com/snowleopard/hadrian/issues/702 for
a comprehensive report about the problem.

This effectively un-breaks integer-simple builds with hadrian.

Test Plan: hadrian/build.sh --integer-simple

Reviewers: snowleopard, bgamari

Reviewed By: bgamari

Subscribers: snowleopard, rwbarton, carter

Differential Revision: https://phabricator.haskell.org/D5266
compiler/main/Packages.hs