Skip to content

Commit c3d6d61

Browse files
committed
Merge branch 'master' of github.com:haskell/cabal
2 parents 7b836bd + 680b443 commit c3d6d61

File tree

12 files changed

+54
-23
lines changed

12 files changed

+54
-23
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ Cabal/ghc.mk
2929

3030
# TAGS files
3131
TAGS
32+
tags

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ env:
1111
before_install:
1212
- travis_retry sudo add-apt-repository -y ppa:hvr/ghc
1313
- travis_retry sudo apt-get update
14-
- travis_retry sudo apt-get install cabal-install-1.18 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy
15-
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/1.18/bin:$PATH
14+
- travis_retry sudo apt-get install cabal-install-1.20 ghc-$GHCVER-prof ghc-$GHCVER-dyn happy
15+
- export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/1.20/bin:$PATH
1616

1717
install:
1818
- sudo /opt/ghc/$GHCVER/bin/ghc-pkg recache

Cabal/Cabal.cabal

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ build-type: Custom
2525

2626
extra-source-files:
2727
README.md tests/README.md changelog
28+
doc/developing-packages.markdown doc/index.markdown
29+
doc/installing-packages.markdown
30+
doc/misc.markdown
2831

2932
-- Generated with 'misc/gen-extra-source-files.sh' & 'M-x sort-lines':
3033
tests/PackageTests/BenchmarkExeV10/Foo.hs

Cabal/Distribution/PackageDescription/Check.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,9 @@ checkGhcOptions pkg =
594594
, checkFlags ["-fhpc"] $
595595
PackageDistInexcusable $
596596
"'ghc-options: -fhpc' is not appropriate for a distributed package."
597-
598-
, check (any ("-d" `isPrefixOf`) all_ghc_options) $
597+
598+
-- -dynamic is not a debug flag
599+
, check (any (\opt -> "-d" `isPrefixOf` opt && opt /= "-dynamic") all_ghc_options) $
599600
PackageDistInexcusable $
600601
"'ghc-options: -d*' debug flags are not appropriate for a distributed package."
601602

Cabal/Distribution/Simple/Configure.hs

+11-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ import Distribution.Simple.Program
7575
, ProgramSearchPathEntry(..), getProgramSearchPath, setProgramSearchPath
7676
, configureAllKnownPrograms, knownPrograms, lookupKnownProgram
7777
, userSpecifyArgss, userSpecifyPaths
78-
, requireProgram, requireProgramVersion
78+
, lookupProgram, requireProgram, requireProgramVersion
7979
, pkgConfigProgram, gccProgram, rawSystemProgramStdoutConf )
8080
import Distribution.Simple.Setup
8181
( ConfigFlags(..), CopyDest(..), fromFlag, fromFlagOrDefault, flagToMaybe )
@@ -1159,11 +1159,20 @@ checkForeignDeps pkg lbi verbosity = do
11591159
_ <- rawSystemProgramStdoutConf verbosity
11601160
gccProgram (withPrograms lbi) (cName:"-o":oNname:args)
11611161
return True
1162-
--TODO: need a better error in the case of not finding gcc!
11631162
`catchIO` (\_ -> return False)
11641163
`catchExit` (\_ -> return False)
11651164

11661165
explainErrors Nothing [] = return () -- should be impossible!
1166+
explainErrors _ _
1167+
| isNothing . lookupProgram gccProgram . withPrograms $ lbi
1168+
1169+
= die $ unlines $
1170+
[ "No working gcc",
1171+
"This package depends on foreign library but we cannot "
1172+
++ "find a working C compiler. If you have it in a "
1173+
++ "non-standard location you can use the --with-gcc "
1174+
++ "flag to specify it." ]
1175+
11671176
explainErrors hdr libs = die $ unlines $
11681177
[ if plural
11691178
then "Missing dependencies on foreign libraries:"

Cabal/Distribution/Simple/HaskellSuite.hs

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ buildLib verbosity pkg_descr lbi lib clbi = do
172172
| (ipkgid, _) <- componentPackageDeps clbi ] ++
173173
["-G", display language] ++
174174
concat [ ["-X", display ex] | ex <- usedExtensions bi ] ++
175+
cppOptions (libBuildInfo lib) ++
175176
[ display modu | modu <- libModules lib ]
176177

177178

cabal-install/Distribution/Client/Dependency.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ dontUpgradeNonUpgradeablePackages params =
258258
[ PackageConstraintInstalled pkgname
259259
| all (/=PackageName "base") (depResolverTargets params)
260260
, pkgname <- map PackageName [ "base", "ghc-prim", "integer-gmp"
261-
, "integer-simple", "template-haskell" ]
261+
, "integer-simple" ]
262262
, isInstalled pkgname ]
263263
-- TODO: the top down resolver chokes on the base constraints
264264
-- below when there are no targets and thus no dep on base.

cabal-install/Distribution/Client/Dependency/Modular/Builder.hs

+14-10
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,21 @@ scopedExtendOpen qpn i gr fdeps fdefs s = extendOpen qpn gs s
7878
qfdefs = L.map (\ (fn, b) -> Flagged (FN (PI qpn i) fn) b [] []) $ M.toList fdefs
7979
-- Combine new package and flag goals
8080
gs = L.map (flip OpenGoal gr) (qfdefs ++ qfdeps)
81-
-- IMPORTANT AND SUBTLE: The order of the concatenation above is
82-
-- important. Flags occur potentially multiple times: both via the
83-
-- flag declaration ('qfdefs') and via dependencies ('qfdeps').
84-
-- We want the information from qfdeps if it's present, because that
85-
-- includes dependencies between flags. We use qfdefs mainly so that
86-
-- we are forced to make choices for flags that don't affect
87-
-- dependencies at all.
81+
-- NOTE:
8882
--
89-
-- When goals are actually extended in 'extendOpen', later additions
90-
-- override earlier additions, so it's important that the
91-
-- lower-quality templates without dependency information come first.
83+
-- In the expression @qfdefs ++ qfdeps@ above, flags occur potentially
84+
-- multiple times, both via the flag declaration and via dependencies.
85+
-- The order is potentially important, because the occurrences via
86+
-- dependencies may record flag-dependency information. After a number
87+
-- of bugs involving computing this information incorrectly, however,
88+
-- we're currently not using carefully computed inter-flag dependencies
89+
-- anymore, but instead use 'simplifyVar' when computing conflict sets
90+
-- to map all flags of one package to a single flag for conflict set
91+
-- purposes, thereby treating them all as interdependent.
92+
--
93+
-- If we ever move to a more clever algorithm again, then the line above
94+
-- needs to be looked at very carefully, and probably be replaced by
95+
-- more systematically computed flag dependency information.
9296

9397
-- | Datatype that encodes what to build next
9498
data BuildType =

cabal-install/Distribution/Client/Dependency/Modular/Dependency.hs

+12-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ import Distribution.Client.Dependency.Modular.Version
2222
data Var qpn = P qpn | F (FN qpn) | S (SN qpn)
2323
deriving (Eq, Ord, Show, Functor)
2424

25+
-- | For computing conflict sets, we map flag choice vars to a
26+
-- single flag choice. This means that all flag choices are treated
27+
-- as interdependent. So if one flag of a package ends up in a
28+
-- conflict set, then all flags are being treated as being part of
29+
-- the conflict set.
30+
simplifyVar :: Var qpn -> Var qpn
31+
simplifyVar (P qpn) = P qpn
32+
simplifyVar (F (FN pi _)) = F (FN pi (mkFlag "flag"))
33+
simplifyVar (S qsn) = S qsn
34+
2535
showVar :: Var QPN -> String
2636
showVar (P qpn) = showQPN qpn
2737
showVar (F qfn) = showQFN qfn
@@ -149,7 +159,7 @@ type QGoalReasonChain = GoalReasonChain QPN
149159
goalReasonToVars :: GoalReason qpn -> ConflictSet qpn
150160
goalReasonToVars UserGoal = S.empty
151161
goalReasonToVars (PDependency (PI qpn _)) = S.singleton (P qpn)
152-
goalReasonToVars (FDependency qfn _) = S.singleton (F qfn)
162+
goalReasonToVars (FDependency qfn _) = S.singleton (simplifyVar (F qfn))
153163
goalReasonToVars (SDependency qsn) = S.singleton (S qsn)
154164

155165
goalReasonChainToVars :: Ord qpn => GoalReasonChain qpn -> ConflictSet qpn
@@ -168,4 +178,4 @@ close (OpenGoal (Stanza qsn _) gr) = Goal (S qsn) gr
168178
-- | Compute a conflic set from a goal. The conflict set contains the
169179
-- closure of goal reasons as well as the variable of the goal itself.
170180
toConflictSet :: Ord qpn => Goal qpn -> ConflictSet qpn
171-
toConflictSet (Goal g grs) = S.insert g (goalReasonChainToVars grs)
181+
toConflictSet (Goal g grs) = S.insert (simplifyVar g) (goalReasonChainToVars grs)

cabal-install/Distribution/Client/Dependency/Modular/Explore.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ combine :: Var QPN -> [(a, (Maybe (ConflictSet QPN), b))] ->
6666
combine _ [] c = (Just c, [])
6767
combine var ((k, ( d, v)) : xs) c = (\ ~(e, ys) -> (e, (k, v) : ys)) $
6868
case d of
69-
Just e | not (var `S.member` e) -> (Just e, [])
70-
| otherwise -> combine var xs (e `S.union` c)
71-
Nothing -> (Nothing, snd $ combine var xs S.empty)
69+
Just e | not (simplifyVar var `S.member` e) -> (Just e, [])
70+
| otherwise -> combine var xs (e `S.union` c)
71+
Nothing -> (Nothing, snd $ combine var xs S.empty)
7272

7373
-- | Naive backtracking exploration of the search tree. This will yield correct
7474
-- assignments only once the tree itself is validated.

cabal-install/Distribution/Client/Dependency/Modular/Flag.hs

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ type Flag = FlagName
2323
unFlag :: Flag -> String
2424
unFlag (FlagName fn) = fn
2525

26+
mkFlag :: String -> Flag
27+
mkFlag fn = FlagName fn
28+
2629
-- | Flag info. Default value, whether the flag is manual, and
2730
-- whether the flag is weak. Manual flags can only be set explicitly.
2831
-- Weak flags are typically deferred by the solver.

cabal-install/Distribution/Client/Dependency/Modular/Solver.hs

-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,5 @@ solve sc idx userPrefs userConstraints userGoals =
5656
, PackageName "ghc-prim"
5757
, PackageName "integer-gmp"
5858
, PackageName "integer-simple"
59-
, PackageName "template-haskell"
6059
])
6160
buildPhase = buildTree idx (independentGoals sc) userGoals

0 commit comments

Comments
 (0)