Skip to content

Commit 2a7304b

Browse files
authored
Merge pull request #6496 from phadej/revert-6476
Revert "Merge pull request #6476 from grayjay/issue-5892"
2 parents fbe7d73 + 5939cab commit 2a7304b

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

cabal-install/Distribution/Solver/Modular/Package.hs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ module Distribution.Solver.Modular.Package
1818
, unPN
1919
) where
2020

21-
import Prelude ()
22-
import Distribution.Solver.Compat.Prelude
21+
import Data.List as L
2322

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

6869
-- | Package instance. A package name and an instance.
6970
data PI qpn = PI qpn I

cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -708,15 +708,6 @@ tests = [
708708
"minimize conflict set with --minimize-conflict-set"
709709
, testNoMinimizeConflictSet
710710
"show original conflict set with --no-minimize-conflict-set"
711-
, runTest $
712-
let db = [ Right $ exAv "my-package" 1 [ExFix "other-package" 3]
713-
, Left $ exInst "other-package" 2 "other-package-2.0.0.0" []
714-
, Left $ exInst "other-package" 1 "other-package-AbCdEfGhIj0123456789" [] ]
715-
msg = "rejecting: other-package-2.0.0/installed-2.0.0.0, "
716-
++ "other-package-1.0.0/installed-AbCdEfGhIj0123456789 "
717-
++ "(conflict: my-package => other-package==3.0.0)"
718-
in mkTest db "show full installed package ABI hash (issue #5892)" ["my-package"] $
719-
solverFailure (isInfixOf msg)
720711
]
721712
]
722713
where

cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.cabal.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Warning: solver failed to find a solution:
101101
Could not resolve dependencies:
102102
[__0] trying: exe-0.1.0.0 (user goal)
103103
[__1] next goal: src (dependency of exe)
104-
[__1] rejecting: src-<VERSION>/installed-<HASH> (conflict: src => mylib==<VERSION>/installed-<HASH>, src => mylib==<VERSION>/installed-<HASH>)
104+
[__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...)
105105
[__1] fail (backjumping, conflict set: exe, src)
106106
After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: exe (2), src (2)
107107
Trying configure anyway.

cabal-testsuite/Test/Cabal/OutputNormalizer.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ normalizeOutput nenv =
3333
. resub (posixRegexEscape (normalizerRoot nenv)) "<ROOT>/"
3434
. resub (posixRegexEscape (normalizerTmpDir nenv)) "<TMPDIR>/"
3535
. appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv)))
36-
-- Look for 0.1/installed-0d6uzW7Ubh1Fb4TB5oeQ3G
36+
-- Look for foo-0.1/installed-0d6...
3737
-- These installed packages will vary depending on GHC version
38+
-- Makes assumption that installed packages don't have numbers
39+
-- in package name segment.
3840
-- Apply this before packageIdRegex, otherwise this regex doesn't match.
39-
. resub "[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.+]+"
40-
"<VERSION>/installed-<HASH>"
41+
. resub "([a-zA-Z]+(-[a-zA-Z])*)-[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.]+"
42+
"\\1-<VERSION>/installed-<HASH>..."
4143
-- Normalize architecture
4244
. resub (posixRegexEscape (display (normalizerPlatform nenv))) "<ARCH>"
4345
-- Some GHC versions are chattier than others

0 commit comments

Comments
 (0)