Skip to content

Revert "Merge pull request #6476 from grayjay/issue-5892" #6496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions cabal-install/Distribution/Solver/Modular/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ module Distribution.Solver.Modular.Package
, unPN
) where

import Prelude ()
import Distribution.Solver.Compat.Prelude
import Data.List as L

import Distribution.Package -- from Cabal
import Distribution.Deprecated.Text (display)
Expand Down Expand Up @@ -58,12 +57,14 @@ data I = I Ver Loc
-- | String representation of an instance.
showI :: I -> String
showI (I v InRepo) = showVer v
showI (I v (Inst uid)) = showVer v ++ "/installed" ++ extractPackageAbiHash uid
showI (I v (Inst uid)) = showVer v ++ "/installed" ++ shortId uid
where
extractPackageAbiHash xs =
case first reverse $ break (=='-') $ reverse (display xs) of
(ys, []) -> ys
(ys, _) -> '-' : ys
-- A hack to extract the beginning of the package ABI hash
shortId = snip (splitAt 4) (++ "...")
. snip ((\ (x, y) -> (reverse x, y)) . break (=='-') . reverse) ('-':)
. display
snip p f xs = case p xs of
(ys, zs) -> (if L.null zs then id else f) ys

-- | Package instance. A package name and an instance.
data PI qpn = PI qpn I
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,6 @@ tests = [
"minimize conflict set with --minimize-conflict-set"
, testNoMinimizeConflictSet
"show original conflict set with --no-minimize-conflict-set"
, runTest $
let db = [ Right $ exAv "my-package" 1 [ExFix "other-package" 3]
, Left $ exInst "other-package" 2 "other-package-2.0.0.0" []
, Left $ exInst "other-package" 1 "other-package-AbCdEfGhIj0123456789" [] ]
msg = "rejecting: other-package-2.0.0/installed-2.0.0.0, "
++ "other-package-1.0.0/installed-AbCdEfGhIj0123456789 "
++ "(conflict: my-package => other-package==3.0.0)"
in mkTest db "show full installed package ABI hash (issue #5892)" ["my-package"] $
solverFailure (isInfixOf msg)
]
]
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Warning: solver failed to find a solution:
Could not resolve dependencies:
[__0] trying: exe-0.1.0.0 (user goal)
[__1] next goal: src (dependency of exe)
[__1] rejecting: src-<VERSION>/installed-<HASH> (conflict: src => mylib==<VERSION>/installed-<HASH>, src => mylib==<VERSION>/installed-<HASH>)
[__1] rejecting: src-<VERSION>/installed-<HASH>... (conflict: src => mylib==0.1.0.0/installed-0.1..., src => mylib==0.1.0.0/installed-0.1...)
[__1] fail (backjumping, conflict set: exe, src)
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: exe (2), src (2)
Trying configure anyway.
Expand Down
8 changes: 5 additions & 3 deletions cabal-testsuite/Test/Cabal/OutputNormalizer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ normalizeOutput nenv =
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
-- Look for 0.1/installed-0d6uzW7Ubh1Fb4TB5oeQ3G
-- Look for foo-0.1/installed-0d6...
-- These installed packages will vary depending on GHC version
-- Makes assumption that installed packages don't have numbers
-- in package name segment.
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
. resub "[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.+]+"
"<VERSION>/installed-<HASH>"
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
"\\1-<VERSION>/installed-<HASH>..."
-- Normalize architecture
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
-- Some GHC versions are chattier than others
Expand Down