Skip to content

Commit f8be891

Browse files
jasagredoMikolaj
authored andcommitted
Resolve backporting conflicts
1 parent e2b045f commit f8be891

File tree

22 files changed

+117
-1166
lines changed

22 files changed

+117
-1166
lines changed

Cabal/src/Distribution/Simple/Configure.hs

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -73,23 +73,16 @@ import Distribution.PackageDescription.Configuration
7373
import Distribution.PackageDescription.Check hiding (doesFileExist)
7474
import Distribution.Simple.BuildToolDepends
7575
import Distribution.Simple.Program
76-
<<<<<<< HEAD
7776
import Distribution.Simple.Setup as Setup
7877
import Distribution.Simple.BuildTarget
7978
import Distribution.Simple.LocalBuildInfo
80-
import Distribution.Types.PackageVersionConstraint
81-
import Distribution.Types.LocalBuildInfo
82-
=======
83-
import Distribution.Simple.Program.Db (appendProgramSearchPath, lookupProgramByName)
84-
import Distribution.Simple.Setup.Common as Setup
85-
import Distribution.Simple.Setup.Config as Setup
79+
import Distribution.Simple.Program.Db (appendProgramSearchPath)
8680
import Distribution.Simple.Utils
8781
import Distribution.System
88-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
82+
import Distribution.Types.PackageVersionConstraint
83+
import Distribution.Types.LocalBuildInfo
8984
import Distribution.Types.ComponentRequestedSpec
9085
import Distribution.Types.GivenComponent
91-
import Distribution.Simple.Utils
92-
import Distribution.System
9386
import Distribution.Version
9487
import Distribution.Verbosity
9588
import qualified Distribution.Compat.Graph as Graph
@@ -375,18 +368,19 @@ configure (pkg_descr0, pbi) cfg = do
375368
(fromFlag (configUserInstall cfg))
376369
(configPackageDBs cfg)
377370

371+
programDbPre <- mkProgramDb cfg (configPrograms cfg)
378372
-- comp: the compiler we're building with
379373
-- compPlatform: the platform we're building for
380374
-- programDb: location and args of all programs we're
381375
-- building with
382-
(comp :: Compiler,
376+
(comp :: Compiler,
383377
compPlatform :: Platform,
384-
programDb :: ProgramDb)
378+
programDb :: ProgramDb)
385379
<- configCompilerEx
386380
(flagToMaybe (configHcFlavor cfg))
387381
(flagToMaybe (configHcPath cfg))
388382
(flagToMaybe (configHcPkg cfg))
389-
(mkProgramDb cfg (configPrograms cfg))
383+
programDbPre
390384
(lessVerbose verbosity)
391385

392386
-- The InstalledPackageIndex of all installed packages
@@ -399,7 +393,6 @@ configure (pkg_descr0, pbi) cfg = do
399393
let internalPackageSet :: Set LibraryName
400394
internalPackageSet = getInternalLibraries pkg_descr0
401395

402-
<<<<<<< HEAD
403396
-- Make a data structure describing what components are enabled.
404397
let enabled :: ComponentRequestedSpec
405398
enabled = case mb_cname of
@@ -421,23 +414,6 @@ configure (pkg_descr0, pbi) cfg = do
421414
die' verbosity $
422415
"--enable-tests/--enable-benchmarks are incompatible with" ++
423416
" explicitly specifying a component to configure."
424-
=======
425-
programDbPre <- mkProgramDb cfg (configPrograms cfg)
426-
-- comp: the compiler we're building with
427-
-- compPlatform: the platform we're building for
428-
-- programDb: location and args of all programs we're
429-
-- building with
430-
( comp :: Compiler
431-
, compPlatform :: Platform
432-
, programDb00 :: ProgramDb
433-
) <-
434-
configCompilerEx
435-
(flagToMaybe (configHcFlavor cfg))
436-
(flagToMaybe (configHcPath cfg))
437-
(flagToMaybe (configHcPkg cfg))
438-
programDbPre
439-
(lessVerbose verbosity)
440-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
441417

442418
-- Some sanity checks related to dynamic/static linking.
443419
when (fromFlag (configDynExe cfg) && fromFlag (configFullyStaticExe cfg)) $
@@ -880,15 +856,6 @@ mkProgramDb cfg initialProgramDb = do
880856
. userSpecifyPaths (configProgramPaths cfg)
881857
$ programDb
882858
where
883-
<<<<<<< HEAD
884-
programDb = userSpecifyArgss (configProgramArgs cfg)
885-
. userSpecifyPaths (configProgramPaths cfg)
886-
. setProgramSearchPath searchpath
887-
$ initialProgramDb
888-
searchpath = map ProgramSearchPathDir
889-
(fromNubList $ configProgramPathExtra cfg)
890-
++ getProgramSearchPath initialProgramDb
891-
=======
892859
searchpath = fromNubList $ configProgramPathExtra cfg
893860

894861
-- Note. We try as much as possible to _prepend_ rather than postpend the extra-prog-path
@@ -897,7 +864,6 @@ mkProgramDb cfg initialProgramDb = do
897864
-- so for v2 builds adding it again is entirely unnecessary. However, it needs to get added again _anyway_
898865
-- so as to take effect for v1 builds or standalone calls to Setup.hs
899866
-- In this instance, the lesser evil is to not allow it to override the system path.
900-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
901867

902868
-- -----------------------------------------------------------------------------
903869
-- Helper functions for configure
@@ -1745,29 +1711,15 @@ ccLdOptionsBuildInfo cflags ldflags ldflags_static =
17451711
-- -----------------------------------------------------------------------------
17461712
-- Determining the compiler details
17471713

1748-
<<<<<<< HEAD
17491714
configCompilerAuxEx :: ConfigFlags
17501715
-> IO (Compiler, Platform, ProgramDb)
1751-
configCompilerAuxEx cfg = configCompilerEx (flagToMaybe $ configHcFlavor cfg)
1716+
configCompilerAuxEx cfg = do
1717+
programDb <- mkProgramDb cfg defaultProgramDb
1718+
configCompilerEx (flagToMaybe $ configHcFlavor cfg)
17521719
(flagToMaybe $ configHcPath cfg)
17531720
(flagToMaybe $ configHcPkg cfg)
17541721
programDb
17551722
(fromFlag (configVerbosity cfg))
1756-
where
1757-
programDb = mkProgramDb cfg defaultProgramDb
1758-
=======
1759-
configCompilerAuxEx
1760-
:: ConfigFlags
1761-
-> IO (Compiler, Platform, ProgramDb)
1762-
configCompilerAuxEx cfg = do
1763-
programDb <- mkProgramDb cfg defaultProgramDb
1764-
configCompilerEx
1765-
(flagToMaybe $ configHcFlavor cfg)
1766-
(flagToMaybe $ configHcPath cfg)
1767-
(flagToMaybe $ configHcPkg cfg)
1768-
programDb
1769-
(fromFlag (configVerbosity cfg))
1770-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
17711723

17721724
configCompilerEx :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
17731725
-> ProgramDb -> Verbosity

Cabal/src/Distribution/Simple/ConfigureScript.hs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,17 +137,9 @@ runConfigureScript verbosity flags lbi = do
137137
maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)]
138138
args' = configureFile':args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag
139139
shProg = simpleProgram "sh"
140-
<<<<<<< HEAD
141-
progDb = modifyProgramSearchPath
142-
(\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb
143-
shConfiguredProg <- lookupProgram shProg
144-
`fmap` configureProgram verbosity shProg progDb
145-
=======
146140
progDb <- appendProgramSearchPath verbosity extraPath emptyProgramDb
147-
shConfiguredProg <-
148-
lookupProgram shProg
149-
`fmap` configureProgram verbosity shProg progDb
150-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
141+
shConfiguredProg <- lookupProgram shProg
142+
`fmap` configureProgram verbosity shProg progDb
151143
case shConfiguredProg of
152144
Just sh -> runProgramInvocation verbosity $
153145
(programInvocation (sh {programOverrideEnv = overEnv}) args')

Cabal/src/Distribution/Simple/GHC.hs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,17 +1889,8 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
18891889
| otherwise = error "libAbiHash: Can't find an enabled library way"
18901890

18911891
(ghcProg, _) <- requireProgram verbosity ghcProgram (withPrograms lbi)
1892-
<<<<<<< HEAD
18931892
hash <- getProgramInvocationOutput verbosity
1894-
(ghcInvocation ghcProg comp platform ghcArgs)
1895-
=======
1896-
1897-
hash <-
1898-
getProgramInvocationOutput
1899-
verbosity
1900-
=<< ghcInvocation verbosity ghcProg comp platform ghcArgs
1901-
1902-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
1893+
=<< ghcInvocation verbosity ghcProg comp platform ghcArgs
19031894
return (takeWhile (not . isSpace) hash)
19041895

19051896
componentGhcOptions :: Verbosity -> LocalBuildInfo

Cabal/src/Distribution/Simple/GHCJS.hs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,15 +1601,8 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do
16011601
| otherwise = error "libAbiHash: Can't find an enabled library way"
16021602

16031603
(ghcjsProg, _) <- requireProgram verbosity ghcjsProgram (withPrograms lbi)
1604-
<<<<<<< HEAD
16051604
hash <- getProgramInvocationOutput verbosity
1606-
(ghcInvocation ghcjsProg comp platform ghcArgs)
1607-
=======
1608-
hash <-
1609-
getProgramInvocationOutput
1610-
verbosity
1611-
=<< ghcInvocation verbosity ghcjsProg comp platform ghcArgs
1612-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
1605+
=<< ghcInvocation verbose ghcjsProg comp platform ghcArgs
16131606
return (takeWhile (not . isSpace) hash)
16141607

16151608
componentGhcOptions :: Verbosity -> LocalBuildInfo

Cabal/src/Distribution/Simple/Program/Db.hs

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ module Distribution.Simple.Program.Db (
3232
restoreProgramDb,
3333

3434
-- ** Query and manipulate the program db
35-
<<<<<<< HEAD
3635
addKnownProgram,
3736
addKnownPrograms,
37+
appendProgramSearchPath,
3838
lookupKnownProgram,
3939
knownPrograms,
4040
getProgramSearchPath,
@@ -49,26 +49,6 @@ module Distribution.Simple.Program.Db (
4949
lookupProgram,
5050
updateProgram,
5151
configuredPrograms,
52-
=======
53-
, addKnownProgram
54-
, addKnownPrograms
55-
, appendProgramSearchPath
56-
, lookupKnownProgram
57-
, knownPrograms
58-
, getProgramSearchPath
59-
, setProgramSearchPath
60-
, modifyProgramSearchPath
61-
, userSpecifyPath
62-
, userSpecifyPaths
63-
, userMaybeSpecifyPath
64-
, userSpecifyArgs
65-
, userSpecifyArgss
66-
, userSpecifiedArgs
67-
, lookupProgram
68-
, lookupProgramByName
69-
, updateProgram
70-
, configuredPrograms
71-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
7252

7353
-- ** Query and manipulate the program db
7454
configureProgram,
@@ -243,15 +223,6 @@ modifyProgramSearchPath :: (ProgramSearchPath -> ProgramSearchPath)
243223
modifyProgramSearchPath f db =
244224
setProgramSearchPath (f $ getProgramSearchPath db) db
245225

246-
<<<<<<< HEAD
247-
-- |User-specify this path. Basically override any path information
248-
-- for this program in the configuration. If it's not a known
249-
-- program ignore it.
250-
--
251-
userSpecifyPath :: String -- ^Program name
252-
-> FilePath -- ^user-specified path to the program
253-
-> ProgramDb -> ProgramDb
254-
=======
255226
-- | Modify the current 'ProgramSearchPath' used by the 'ProgramDb'
256227
-- by appending the provided extra paths. Also logs the added paths
257228
-- in info verbosity.
@@ -267,17 +238,13 @@ appendProgramSearchPath verbosity extraPaths db =
267238
pure $ modifyProgramSearchPath (map ProgramSearchPathDir extraPaths ++) db
268239
else pure db
269240

270-
-- | User-specify this path. Basically override any path information
271-
-- for this program in the configuration. If it's not a known
272-
-- program ignore it.
273-
userSpecifyPath
274-
:: String
275-
-- ^ Program name
276-
-> FilePath
277-
-- ^ user-specified path to the program
278-
-> ProgramDb
279-
-> ProgramDb
280-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
241+
-- |User-specify this path. Basically override any path information
242+
-- for this program in the configuration. If it's not a known
243+
-- program ignore it.
244+
--
245+
userSpecifyPath :: String -- ^Program name
246+
-> FilePath -- ^user-specified path to the program
247+
-> ProgramDb -> ProgramDb
281248
userSpecifyPath name path = updateUnconfiguredProgs $
282249
flip Map.update name $ \(prog, _, args) -> Just (prog, Just path, args)
283250

Cabal/src/Distribution/Simple/Program/Find.hs

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
-- So we need an extension of the usual 'findExecutable' that can look in
2525
-- additional locations, either before, after or instead of the normal OS
2626
-- locations.
27-
<<<<<<< HEAD
2827
--
2928
module Distribution.Simple.Program.Find (
3029
-- * Program search path
@@ -33,26 +32,17 @@ module Distribution.Simple.Program.Find (
3332
defaultProgramSearchPath,
3433
findProgramOnSearchPath,
3534
programSearchPathAsPATHVar,
35+
logExtraProgramSearchPath,
3636
getSystemSearchPath,
37-
=======
38-
module Distribution.Simple.Program.Find
39-
( -- * Program search path
40-
ProgramSearchPath
41-
, ProgramSearchPathEntry (..)
42-
, defaultProgramSearchPath
43-
, findProgramOnSearchPath
44-
, programSearchPathAsPATHVar
45-
, logExtraProgramSearchPath
46-
, getSystemSearchPath
47-
, getExtraPathEnv
48-
, simpleProgram
49-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
37+
getExtraPathEnv,
38+
simpleProgram
5039
) where
5140

5241
import Prelude ()
5342
import Distribution.Compat.Prelude
5443

5544
import Distribution.Verbosity
45+
import Distribution.Simple.Program.Types
5646
import Distribution.Simple.Utils
5747
import Distribution.System
5848
import Distribution.Compat.Environment
@@ -66,34 +56,9 @@ import System.FilePath as FilePath
6656
import qualified System.Win32 as Win32
6757
#endif
6858

69-
-- | A search path to use when locating executables. This is analogous
70-
-- to the unix @$PATH@ or win32 @%PATH%@ but with the ability to use
71-
-- the system default method for finding executables ('findExecutable' which
72-
-- on unix is simply looking on the @$PATH@ but on win32 is a bit more
73-
-- complicated).
74-
--
75-
-- The default to use is @[ProgSearchPathDefault]@ but you can add extra dirs
76-
-- either before, after or instead of the default, e.g. here we add an extra
77-
-- dir to search after the usual ones.
78-
--
79-
-- > ['ProgramSearchPathDefault', 'ProgramSearchPathDir' dir]
80-
--
81-
type ProgramSearchPath = [ProgramSearchPathEntry]
82-
data ProgramSearchPathEntry =
83-
ProgramSearchPathDir FilePath -- ^ A specific dir
84-
| ProgramSearchPathDefault -- ^ The system default
85-
deriving (Eq, Generic, Typeable)
86-
87-
instance Binary ProgramSearchPathEntry
88-
instance Structured ProgramSearchPathEntry
89-
9059
defaultProgramSearchPath :: ProgramSearchPath
9160
defaultProgramSearchPath = [ProgramSearchPathDefault]
9261

93-
<<<<<<< HEAD
94-
findProgramOnSearchPath :: Verbosity -> ProgramSearchPath
95-
-> FilePath -> IO (Maybe (FilePath, [FilePath]))
96-
=======
9762
logExtraProgramSearchPath
9863
:: Verbosity
9964
-> [FilePath]
@@ -103,12 +68,8 @@ logExtraProgramSearchPath verbosity extraPaths =
10368
"Including the following directories in PATH:"
10469
: map ("- " ++) extraPaths
10570

106-
findProgramOnSearchPath
107-
:: Verbosity
108-
-> ProgramSearchPath
109-
-> FilePath
110-
-> IO (Maybe (FilePath, [FilePath]))
111-
>>>>>>> 46df8ba71 (Fix extra-prog-path propagation in the codebase.)
71+
findProgramOnSearchPath :: Verbosity -> ProgramSearchPath
72+
-> FilePath -> IO (Maybe (FilePath, [FilePath]))
11273
findProgramOnSearchPath verbosity searchpath prog = do
11374
debug verbosity $ "Searching for " ++ prog ++ " in path."
11475
res <- tryPathElems [] searchpath
@@ -246,3 +207,19 @@ findExecutable prog = do
246207
_ -> return mExe
247208
#endif
248209

210+
211+
-- | Make a simple named program.
212+
--
213+
-- By default we'll just search for it in the path and not try to find the
214+
-- version name. You can override these behaviours if necessary, eg:
215+
--
216+
-- > (simpleProgram "foo") { programFindLocation = ... , programFindVersion ... }
217+
--
218+
simpleProgram :: String -> Program
219+
simpleProgram name = Program {
220+
programName = name,
221+
programFindLocation = \v p -> findProgramOnSearchPath v p name,
222+
programFindVersion = \_ _ -> return Nothing,
223+
programPostConf = \_ p -> return p,
224+
programNormaliseArgs = \_ _ -> id
225+
}

0 commit comments

Comments
 (0)