Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC

Commits:

4 changed files:

Changes:

  • boot
    ... ... @@ -52,9 +52,8 @@ def autoreconf():
    52 52
         # Run autoreconf on everything that needs it.
    
    53 53
         processes = {}
    
    54 54
         if os.name == 'nt':
    
    55
    -        # Get the normalized ACLOCAL_PATH for Windows
    
    56
    -        # This is necessary since on Windows this will be a Windows
    
    57
    -        # path, which autoreconf doesn't know doesn't know how to handle.
    
    55
    +        # Convert ACLOCAL_PATH env variable to unix style paths on Windows
    
    56
    +        # See Note [Autoreconf unix paths from ACLOCAL_PATH]
    
    58 57
             ac_local = os.getenv('ACLOCAL_PATH', '')
    
    59 58
             ac_local_arg = re.sub(r';', r':', ac_local)
    
    60 59
             ac_local_arg = re.sub(r'\\', r'/', ac_local_arg)
    

  • hadrian/src/Hadrian/Oracles/Path.hs
    1 1
     {-# LANGUAGE TypeFamilies #-}
    
    2 2
     module Hadrian.Oracles.Path (
    
    3
    -    lookupInPath, fixAbsolutePathOnWindows, pathOracle
    
    3
    +    lookupInPath, fixAbsolutePathOnWindows, fixUnixPathsOnWindows,
    
    4
    +    pathOracle
    
    4 5
         ) where
    
    5 6
     
    
    6 7
     import Control.Monad
    
    ... ... @@ -33,6 +34,14 @@ fixAbsolutePathOnWindows path =
    33 34
         else
    
    34 35
             return path
    
    35 36
     
    
    37
    +-- | Fix a unix path list on Windows:
    
    38
    +-- * "C:\\foo\\bar;C:\\msys2\\bin" => "/c/foo/bar:/c/msys2/bin"
    
    39
    +fixUnixPathsOnWindows :: FilePath -> Action FilePath
    
    40
    +fixUnixPathsOnWindows paths =
    
    41
    +    if isWindows
    
    42
    +    then askOracle $ UnixPathList paths
    
    43
    +    else return paths
    
    44
    +
    
    36 45
     newtype LookupInPath = LookupInPath String
    
    37 46
         deriving (Binary, Eq, Hashable, NFData, Show)
    
    38 47
     type instance RuleResult LookupInPath = String
    
    ... ... @@ -41,6 +50,10 @@ newtype WindowsPath = WindowsPath FilePath
    41 50
         deriving (Binary, Eq, Hashable, NFData, Show)
    
    42 51
     type instance RuleResult WindowsPath = String
    
    43 52
     
    
    53
    +newtype UnixPathList = UnixPathList FilePath
    
    54
    +    deriving (Binary, Eq, Hashable, NFData, Show)
    
    55
    +type instance RuleResult UnixPathList = String
    
    56
    +
    
    44 57
     -- | Oracles for looking up paths. These are slow and require caching.
    
    45 58
     pathOracle :: Rules ()
    
    46 59
     pathOracle = do
    
    ... ... @@ -50,6 +63,12 @@ pathOracle = do
    50 63
             putVerbose $ "| Windows path mapping: " ++ path ++ " => " ++ windowsPath
    
    51 64
             return windowsPath
    
    52 65
     
    
    66
    +    void $ addOracleCache $ \(UnixPathList paths) -> do
    
    67
    +        Stdout out <- quietly $ cmd ["cygpath", "-p", "-u", paths]
    
    68
    +        let unixPaths = unifyPath $ dropWhileEnd isSpace out
    
    69
    +        putVerbose $ "| Unix path mapping: " ++ paths ++ " => " ++ unixPaths
    
    70
    +        return unixPaths
    
    71
    +
    
    53 72
         void $ addOracleCache $ \(LookupInPath name) -> do
    
    54 73
             path <- liftIO getSearchPath
    
    55 74
             exes <- liftIO (findExecutablesInDirectories path name)
    

  • hadrian/src/Rules/BinaryDist.hs
    ... ... @@ -3,18 +3,19 @@ module Rules.BinaryDist where
    3 3
     
    
    4 4
     import CommandLine
    
    5 5
     import Context
    
    6
    +import Data.Either
    
    7
    +import qualified Data.Set as Set
    
    6 8
     import Expression
    
    9
    +import Hadrian.Oracles.Path (fixUnixPathsOnWindows)
    
    10
    +import Oracles.Flavour
    
    7 11
     import Oracles.Setting
    
    8 12
     import Packages
    
    13
    +import Rules.Generate (generateSettings)
    
    9 14
     import Settings
    
    15
    +import qualified System.Directory.Extra as IO
    
    10 16
     import Settings.Program (programContext)
    
    11 17
     import Target
    
    12 18
     import Utilities
    
    13
    -import qualified System.Directory.Extra as IO
    
    14
    -import Data.Either
    
    15
    -import qualified Data.Set as Set
    
    16
    -import Oracles.Flavour
    
    17
    -import Rules.Generate (generateSettings)
    
    18 19
     
    
    19 20
     {-
    
    20 21
     Note [Binary distributions]
    
    ... ... @@ -343,7 +344,25 @@ bindistRules = do
    343 344
             ghcRoot <- topDirectory
    
    344 345
             copyFile (ghcRoot -/- "aclocal.m4") (ghcRoot -/- "distrib" -/- "aclocal.m4")
    
    345 346
             copyDirectory (ghcRoot -/- "m4") (ghcRoot -/- "distrib")
    
    346
    -        buildWithCmdOptions [] $
    
    347
    +
    
    348
    +        -- Note [Autoreconf unix paths from ACLOCAL_PATH]
    
    349
    +        -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    350
    +        -- On Windows, autoreconf fails when the ACLOCAL_PATH env variable contains Windows-
    
    351
    +        -- style paths. This happens because MSYS2 automatically converts env variables to
    
    352
    +        -- Windows-style paths. To fix this, we convert ACLOCAL_PATH back to Unix style.
    
    353
    +        -- This is done both in the boot Python script and here when building a bindist.
    
    354
    +        win_host <- isWinHost
    
    355
    +        env <- if not win_host
    
    356
    +          then pure []
    
    357
    +          else do
    
    358
    +            aclocalPathMay <- getEnv "ACLOCAL_PATH"
    
    359
    +            case aclocalPathMay of
    
    360
    +              Nothing -> pure []
    
    361
    +              Just aclocalPath -> do
    
    362
    +                unixAclocalPath <- fixUnixPathsOnWindows aclocalPath
    
    363
    +                pure [AddEnv "ACLOCAL_PATH" unixAclocalPath]
    
    364
    +
    
    365
    +        buildWithCmdOptions env $
    
    347 366
                 target (vanillaContext Stage1 ghc) (Autoreconf $ ghcRoot -/- "distrib") [] []
    
    348 367
             -- We clean after ourselves, moving the configure script we generated in
    
    349 368
             -- our bindist dir
    

  • testsuite/driver/runtests.py
    ... ... @@ -133,7 +133,7 @@ if args.unexpected_output_dir:
    133 133
         config.unexpected_output_dir = Path(args.unexpected_output_dir)
    
    134 134
     
    
    135 135
     if args.only:
    
    136
    -    config.only = args.only
    
    136
    +    config.only = set(args.only)
    
    137 137
         config.run_only_some_tests = True
    
    138 138
     
    
    139 139
     if args.skip: