From 0981c6d98369d10e442291116e7b87733e95b4fb Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 3 Feb 2020 21:28:43 -0500 Subject: [PATCH 1/9] Use jobs when calling subprocesses Many toolchain tools written for POSIX systems rely on the exec system call. Unfortunately, it is not possible to implement `exec` in a POSIX-compliant manner on Windows. In particular, the semantics of the `exec` implementation provided by the widely-used `msvcrt` C runtime will cause process's waiting on the `exec`'ing process to incorrectly conclude that the process has successfully terminated when in fact it is still running in another process. For this reason, the `process` library exposes the `use_process_jobs` flag to use a more strict (although still not POSIX-compliant) mechanism for tracking process completion. This is explained in this comment [2]. Unfortunately, job support in the `process` library is currently quite broken and was only recently fixed [1]. Consequently, we only enable job object support for process releases >= 1.6.8. [1] https://github.com/haskell/process/pull/168 [2] https://github.com/haskell/process/blob/master/System/Process.hs#L399 --- Cabal/Distribution/Simple/Utils.hs | 57 ++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index 96c8406b7d2..c843bcd1ed7 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -230,13 +230,13 @@ import System.IO.Unsafe import qualified Control.Exception as Exception import Foreign.C.Error (Errno (..), ePIPE) +import Data.Maybe (fromJust) import Data.Time.Clock.POSIX (getPOSIXTime, POSIXTime) import Control.Exception (IOException, evaluate, throwIO, fromException) import Numeric (showFFloat) import qualified System.Process as Process - ( CreateProcess(..), StdStream(..), proc) import System.Process - ( ProcessHandle, createProcess, rawSystem, runInteractiveProcess + ( CreateProcess, ProcessHandle , showCommandForUser, waitForProcess) import qualified GHC.IO.Exception as GHC @@ -680,6 +680,59 @@ maybeExit cmd = do res <- cmd unless (res == ExitSuccess) $ exitWith res +-- | Enable process jobs to ensure accurate determination of process completion +-- in the presence of @exec(3)@ on Windows. +-- +-- Unfortunately the process job support is badly broken in @process@ releases +-- prior to 1.6.8, so we disable it in these versions, despite the fact that +-- this means we may see sporatic build failures without jobs. +enableProcessJobs :: CreateProcess -> CreateProcess +#ifdef MIN_VERSION_process +#if MIN_VERSION_process(1,6,8) +enableProcessJobs cp = cp {Process.use_process_jobs = True} +#else +enableProcessJobs cp = cp +#endif +#else +enableProcessJobs cp = cp +#endif + +-- | 'System.Process.createProcess' with process jobs enabled when appropriate. +-- See 'enableProcessJobs'. +createProcess :: CreateProcess + -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) +createProcess = Process.createProcess . enableProcessJobs + +-- | 'System.Process.rawSystem' with process jobs enabled when appropriate. +-- See 'enableProcessJobs'. +rawSystem :: String -> [String] -> IO ExitCode +rawSystem cmd args = do +#if MIN_VERSION_process(1,2,0) + (_,_,_,p) <- createProcess (Process.proc cmd args) { Process.delegate_ctlc = True } + waitForProcess p +#else + -- With very old 'process', just do its rawSystem + Process.rawSystem cmd args +#endif + +-- | 'System.Process.runInteractiveProcess' with process jobs enabled when +-- appropriate. See 'enableProcessJobs'. +runInteractiveProcess + :: FilePath -- ^ Filename of the executable (see 'RawCommand' for details) + -> [String] -- ^ Arguments to pass to the executable + -> Maybe FilePath -- ^ Optional path to the working directory + -> Maybe [(String,String)] -- ^ Optional environment (otherwise inherit) + -> IO (Handle,Handle,Handle,ProcessHandle) +runInteractiveProcess cmd args mb_cwd mb_env = do + (mb_in, mb_out, mb_err, p) <- + createProcess (Process.proc cmd args) + { Process.std_in = Process.CreatePipe, + Process.std_out = Process.CreatePipe, + Process.std_err = Process.CreatePipe, + Process.env = mb_env, + Process.cwd = mb_cwd } + return (fromJust mb_in, fromJust mb_out, fromJust mb_err, p) + printRawCommandAndArgs :: Verbosity -> FilePath -> [String] -> IO () printRawCommandAndArgs verbosity path args = withFrozenCallStack $ printRawCommandAndArgsAndEnv verbosity path args Nothing Nothing From 2e072ed36cb4a1ef806d0343fbfff5c72669d9f6 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 7 Feb 2020 18:50:07 +0200 Subject: [PATCH 2/9] Add Distribution.Compat.Process module --- Cabal/Cabal.cabal | 1 + Cabal/ChangeLog.md | 15 ++++ Cabal/Distribution/Compat/Process.hs | 82 +++++++++++++++++++ Cabal/Distribution/Simple/Utils.hs | 58 +------------ .../Distribution/Client/SetupWrapper.hs | 4 +- 5 files changed, 104 insertions(+), 56 deletions(-) create mode 100644 Cabal/Distribution/Compat/Process.hs diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index e87e32e0a71..fb38a6c5a31 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -334,6 +334,7 @@ library Distribution.Compat.Newtype Distribution.Compat.ResponseFile Distribution.Compat.Prelude.Internal + Distribution.Compat.Process Distribution.Compat.Semigroup Distribution.Compat.Stack Distribution.Compat.Time diff --git a/Cabal/ChangeLog.md b/Cabal/ChangeLog.md index 54b17108425..598e016c388 100644 --- a/Cabal/ChangeLog.md +++ b/Cabal/ChangeLog.md @@ -24,6 +24,21 @@ # 3.0.1.0 [Herbert Valerio Riedel](mailto:hvr@gnu.org) April 2020 * Add GHC-8.8 flags to `normaliseGhcFlags` ([#6379](https://github.com/haskell/cabal/pull/6379)). + `Language.Haskell.Extension` + * Use more `NonEmpty` instead of ordinary lists + * Add `Distribution.Utils.Structured` for fingeprinting `Binary` blobs + * Add `null`, `length` and `unsafeFromUTF8BS` to `Distribution.Utils.ShortText` + * Refactor `Distribution.Utils.IOData` module + * Rename `Distribution.Compat.MD5` to `Distribution.Utils.MD5` + * Add `safeHead`, `safeTail`, `safeLast` to `Distribution.Utils.Generic` + * Add `unsnoc` and `unsnocNE` to `Distribution.Utils.Generic` + * Add `Set'` modifier to `Distribution.Parsec.Newtypes` + * Add `Distribution.Compat.Async` + * Add `Distribution.Compat.Process` with `enableProcessJobs` + +# 3.0.1.0 TBW + * Add GHC-8.8 flags to normaliseGhcFlags + ([#6379](https://github.com/haskell/cabal/pull/6379)) * Typo fixes ([#6372](https://github.com/haskell/cabal/pull/6372)). * Limit version number parts to contain at most 9 digits diff --git a/Cabal/Distribution/Compat/Process.hs b/Cabal/Distribution/Compat/Process.hs new file mode 100644 index 00000000000..0862a9f3f15 --- /dev/null +++ b/Cabal/Distribution/Compat/Process.hs @@ -0,0 +1,82 @@ +{-# LANGUAGE CPP #-} +module Distribution.Compat.Process ( + -- * Redefined functions + createProcess, + runInteractiveProcess, + rawSystem, + -- * Additions + enableProcessJobs, + ) where + +import System.Exit (ExitCode (..)) +import System.IO (Handle) + +import System.Process (CreateProcess, ProcessHandle) +import qualified System.Process as Process + +#if MIN_VERSION_process(1,2,0) +import System.Process (waitForProcess) +#endif + +------------------------------------------------------------------------------- +-- enableProcessJobs +------------------------------------------------------------------------------- + +-- | Enable process jobs to ensure accurate determination of process completion +-- in the presence of @exec(3)@ on Windows. +-- +-- Unfortunately the process job support is badly broken in @process@ releases +-- prior to 1.6.8, so we disable it in these versions, despite the fact that +-- this means we may see sporatic build failures without jobs. +enableProcessJobs :: CreateProcess -> CreateProcess +#ifdef MIN_VERSION_process +#if MIN_VERSION_process(1,6,8) +enableProcessJobs cp = cp {Process.use_process_jobs = True} +#else +enableProcessJobs cp = cp +#endif +#else +enableProcessJobs cp = cp +#endif + +------------------------------------------------------------------------------- +-- process redefinitions +------------------------------------------------------------------------------- + +-- | 'System.Process.createProcess' with process jobs enabled when appropriate. +-- See 'enableProcessJobs'. +createProcess :: CreateProcess + -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) +createProcess = Process.createProcess . enableProcessJobs + +-- | 'System.Process.rawSystem' with process jobs enabled when appropriate. +-- See 'enableProcessJobs'. +rawSystem :: String -> [String] -> IO ExitCode +rawSystem cmd args = do +#if MIN_VERSION_process(1,2,0) + (_,_,_,p) <- createProcess (Process.proc cmd args) { Process.delegate_ctlc = True } + waitForProcess p +#else + -- With very old 'process', just do its rawSystem + Process.rawSystem cmd args +#endif + +-- | 'System.Process.runInteractiveProcess' with process jobs enabled when +-- appropriate. See 'enableProcessJobs'. +runInteractiveProcess + :: FilePath -- ^ Filename of the executable (see 'RawCommand' for details) + -> [String] -- ^ Arguments to pass to the executable + -> Maybe FilePath -- ^ Optional path to the working directory + -> Maybe [(String,String)] -- ^ Optional environment (otherwise inherit) + -> IO (Handle,Handle,Handle,ProcessHandle) +runInteractiveProcess cmd args mb_cwd mb_env = do + (mb_in, mb_out, mb_err, p) <- + createProcess (Process.proc cmd args) + { Process.std_in = Process.CreatePipe, + Process.std_out = Process.CreatePipe, + Process.std_err = Process.CreatePipe, + Process.env = mb_env, + Process.cwd = mb_cwd } + return (fromJust mb_in, fromJust mb_out, fromJust mb_err, p) + where + fromJust = maybe (error "runInteractiveProcess: fromJust") id diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs index c843bcd1ed7..ccc35f5a997 100644 --- a/Cabal/Distribution/Simple/Utils.hs +++ b/Cabal/Distribution/Simple/Utils.hs @@ -230,15 +230,14 @@ import System.IO.Unsafe import qualified Control.Exception as Exception import Foreign.C.Error (Errno (..), ePIPE) -import Data.Maybe (fromJust) import Data.Time.Clock.POSIX (getPOSIXTime, POSIXTime) import Control.Exception (IOException, evaluate, throwIO, fromException) import Numeric (showFFloat) -import qualified System.Process as Process +import Distribution.Compat.Process (createProcess, rawSystem, runInteractiveProcess) import System.Process - ( CreateProcess, ProcessHandle + ( ProcessHandle , showCommandForUser, waitForProcess) - +import qualified System.Process as Process import qualified GHC.IO.Exception as GHC import qualified Text.PrettyPrint as Disp @@ -680,58 +679,7 @@ maybeExit cmd = do res <- cmd unless (res == ExitSuccess) $ exitWith res --- | Enable process jobs to ensure accurate determination of process completion --- in the presence of @exec(3)@ on Windows. --- --- Unfortunately the process job support is badly broken in @process@ releases --- prior to 1.6.8, so we disable it in these versions, despite the fact that --- this means we may see sporatic build failures without jobs. -enableProcessJobs :: CreateProcess -> CreateProcess -#ifdef MIN_VERSION_process -#if MIN_VERSION_process(1,6,8) -enableProcessJobs cp = cp {Process.use_process_jobs = True} -#else -enableProcessJobs cp = cp -#endif -#else -enableProcessJobs cp = cp -#endif - --- | 'System.Process.createProcess' with process jobs enabled when appropriate. --- See 'enableProcessJobs'. -createProcess :: CreateProcess - -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -createProcess = Process.createProcess . enableProcessJobs - --- | 'System.Process.rawSystem' with process jobs enabled when appropriate. --- See 'enableProcessJobs'. -rawSystem :: String -> [String] -> IO ExitCode -rawSystem cmd args = do -#if MIN_VERSION_process(1,2,0) - (_,_,_,p) <- createProcess (Process.proc cmd args) { Process.delegate_ctlc = True } - waitForProcess p -#else - -- With very old 'process', just do its rawSystem - Process.rawSystem cmd args -#endif --- | 'System.Process.runInteractiveProcess' with process jobs enabled when --- appropriate. See 'enableProcessJobs'. -runInteractiveProcess - :: FilePath -- ^ Filename of the executable (see 'RawCommand' for details) - -> [String] -- ^ Arguments to pass to the executable - -> Maybe FilePath -- ^ Optional path to the working directory - -> Maybe [(String,String)] -- ^ Optional environment (otherwise inherit) - -> IO (Handle,Handle,Handle,ProcessHandle) -runInteractiveProcess cmd args mb_cwd mb_env = do - (mb_in, mb_out, mb_err, p) <- - createProcess (Process.proc cmd args) - { Process.std_in = Process.CreatePipe, - Process.std_out = Process.CreatePipe, - Process.std_err = Process.CreatePipe, - Process.env = mb_env, - Process.cwd = mb_cwd } - return (fromJust mb_in, fromJust mb_out, fromJust mb_err, p) printRawCommandAndArgs :: Verbosity -> FilePath -> [String] -> IO () printRawCommandAndArgs verbosity path args = withFrozenCallStack $ diff --git a/cabal-install/Distribution/Client/SetupWrapper.hs b/cabal-install/Distribution/Client/SetupWrapper.hs index 79dccc6679a..67f0dc37363 100644 --- a/cabal-install/Distribution/Client/SetupWrapper.hs +++ b/cabal-install/Distribution/Client/SetupWrapper.hs @@ -111,7 +111,8 @@ import System.Directory ( doesFileExist ) import System.FilePath ( (), (<.>) ) import System.IO ( Handle, hPutStr ) import System.Exit ( ExitCode(..), exitWith ) -import System.Process ( createProcess, StdStream(..), proc, waitForProcess +import Distribution.Compat.Process (createProcess) +import System.Process ( StdStream(..), proc, waitForProcess , ProcessHandle ) import qualified System.Process as Process import Data.List ( foldl1' ) @@ -464,6 +465,7 @@ runProcess' cmd args mb_cwd mb_env mb_stdin mb_stdout mb_stderr _delegate = do mbToStd :: Maybe Handle -> StdStream mbToStd Nothing = Inherit mbToStd (Just hdl) = UseHandle hdl + -- ------------------------------------------------------------ -- * Self-Exec SetupMethod -- ------------------------------------------------------------ From b861e40b6e96347b4813f63171e9bf038b18c917 Mon Sep 17 00:00:00 2001 From: Luke Lau Date: Sun, 21 Jun 2020 14:16:27 +0100 Subject: [PATCH 3/9] Fix ghci being launched before other sources were built This looks like an accident from a6e427ac9e86ec63572fde702ada0a7fbed7dbb3 It causes cases like this to fail: $ cat foo.c int foo() { return 42; } $ cat Lib.hs module Lib where foreign import ccall "foo" foo :: Int bar = foo $ cat cabal-csrc-repl.cabal cabal-version: 2.4 name: cabal-csrc-repl version: 0.1.0.0 library exposed-modules: Lib build-depends: base ^>=4.14.0.0 C-sources: foo.c default-language: Haskell2010 $ cabal v2-repl Resolving dependencies... Build profile: -w ghc-8.10.1 -O1 In order, the following will be built (use -v for more details): - cabal-csrc-repl-0.1.0.0 (lib) (first run) Configuring library for cabal-csrc-repl-0.1.0.0.. Preprocessing library for cabal-csrc-repl-0.1.0.0.. GHCi, version 8.10.1: https://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Lib ( Lib.hs, interpreted ) Ok, one module loaded. *Lib> foo ghc: ^^ Could not load '_foo', dependency unresolved. See top entry above. --- Cabal/Distribution/Simple/GHC.hs | 9 ++-- .../AutoconfBadPaths/cabal.test.hs | 2 +- .../Backpack/Includes3/setup-internal.test.hs | 2 +- .../PackageTests/ForeignLibs/setup.test.hs | 5 +- .../PackageTests/ReplCSources/Lib.hs | 5 ++ .../ReplCSources/cabal-csrc-repl.cabal | 8 +++ .../PackageTests/ReplCSources/cabal.out | 2 + .../PackageTests/ReplCSources/cabal.project | 1 + .../PackageTests/ReplCSources/cabal.test.hs | 9 ++++ .../PackageTests/ReplCSources/foo.c | 1 + cabal-testsuite/Test/Cabal/Prelude.hs | 53 +++++++++++-------- cabal-testsuite/Test/Cabal/Run.hs | 35 +++++++----- cabal-testsuite/Test/Cabal/Script.hs | 2 +- 13 files changed, 90 insertions(+), 44 deletions(-) create mode 100644 cabal-testsuite/PackageTests/ReplCSources/Lib.hs create mode 100644 cabal-testsuite/PackageTests/ReplCSources/cabal-csrc-repl.cabal create mode 100644 cabal-testsuite/PackageTests/ReplCSources/cabal.out create mode 100644 cabal-testsuite/PackageTests/ReplCSources/cabal.project create mode 100644 cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/ReplCSources/foo.c diff --git a/Cabal/Distribution/Simple/GHC.hs b/Cabal/Distribution/Simple/GHC.hs index abad0b2bb52..48a17093f07 100644 --- a/Cabal/Distribution/Simple/GHC.hs +++ b/Cabal/Distribution/Simple/GHC.hs @@ -508,7 +508,7 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do when (forceStatic || withStaticLib lbi) whenGHCiLib = when (withGHCiLib lbi) forRepl = maybe False (const True) mReplFlags - ifReplLib = when forRepl + whenReplLib = when forRepl replFlags = fromMaybe mempty mReplFlags comp = compiler lbi ghcVersion = compilerVersion comp @@ -670,10 +670,6 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do unless forRepl $ whenProfLib (runGhcProgIfNeeded profCxxOpts) | filename <- cxxSources libBi] - ifReplLib $ do - when (null (allLibModules lib clbi)) $ warn verbosity "No exposed modules" - ifReplLib (runGhcProg replOpts) - -- build any C sources unless (not has_code || null (cSources libBi)) $ do info verbosity "Building C Sources..." @@ -770,6 +766,9 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do -- TODO: problem here is we need the .c files built first, so we can load them -- with ghci, but .c files can depend on .h files generated by ghc by ffi -- exports. + whenReplLib $ do + when (null (allLibModules lib clbi)) $ warn verbosity "No exposed modules" + runGhcProg replOpts -- link: when has_code . unless forRepl $ do diff --git a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs index 53ad6216cdd..730950b9d4e 100644 --- a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs +++ b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs @@ -49,5 +49,5 @@ main = cabalTest $ do (Just (testCurrentDir env)) (testEnvironment env) (programPath configured_prog) - args + args Nothing recordLog r diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.test.hs index b75823a5b23..3f46a804583 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.test.hs @@ -3,7 +3,7 @@ main = setupAndCabalTest $ do skipUnless =<< ghcVersionIs (>= mkVersion [8,1]) withPackageDb $ do setup_install [] - _ <- runM "touch" ["repo/indef-0.1.0.0/Foo.hs"] + _ <- runM "touch" ["repo/indef-0.1.0.0/Foo.hs"] Nothing setup "build" [] runExe' "exe" [] >>= assertOutputContains "fromList [(0,2),(2,4)]" diff --git a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs index dd1b5c44989..24032abf49e 100644 --- a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs +++ b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs @@ -39,6 +39,7 @@ main = setupAndCabalTest . recordMode DoNotRecord $ do , "UseLib.c" , "-l", "myforeignlib" , "-L", flibdir installDirs ] + Nothing -- Run the C program let ldPath = case hostPlatform lbi of @@ -48,7 +49,7 @@ main = setupAndCabalTest . recordMode DoNotRecord $ do oldLdPath <- liftIO $ getEnv' ldPath withEnv [ (ldPath, Just $ flibdir installDirs ++ [searchPathSeparator] ++ oldLdPath) ] $ do cwd <- fmap testCurrentDir getTestEnv - result <- runM (cwd "uselib") [] + result <- runM (cwd "uselib") [] Nothing assertOutputContains "5678" result assertOutputContains "189" result @@ -70,7 +71,7 @@ main = setupAndCabalTest . recordMode DoNotRecord $ do objInfo <- runM (programPath objdump) [ "-x" , libdir libraryName - ] + ] Nothing assertBool "SONAME of 'libversionedlib.so.5.4.3' incorrect" $ elem "libversionedlib.so.5" $ words $ resultOutput objInfo _ -> return () diff --git a/cabal-testsuite/PackageTests/ReplCSources/Lib.hs b/cabal-testsuite/PackageTests/ReplCSources/Lib.hs new file mode 100644 index 00000000000..0ea9d872060 --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/Lib.hs @@ -0,0 +1,5 @@ +module Lib where + +foreign import ccall "foo" foo :: Int + +bar = foo diff --git a/cabal-testsuite/PackageTests/ReplCSources/cabal-csrc-repl.cabal b/cabal-testsuite/PackageTests/ReplCSources/cabal-csrc-repl.cabal new file mode 100644 index 00000000000..8df5fee5fb4 --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/cabal-csrc-repl.cabal @@ -0,0 +1,8 @@ +cabal-version: 2.4 +name: cabal-csrc-repl +version: 0.1.0.0 +library + exposed-modules: Lib + build-depends: base + C-sources: foo.c + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/ReplCSources/cabal.out b/cabal-testsuite/PackageTests/ReplCSources/cabal.out new file mode 100644 index 00000000000..f7fe5f202cf --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/cabal.out @@ -0,0 +1,2 @@ +# cabal clean +# cabal repl diff --git a/cabal-testsuite/PackageTests/ReplCSources/cabal.project b/cabal-testsuite/PackageTests/ReplCSources/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs b/cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs new file mode 100644 index 00000000000..ca7502d5a04 --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/cabal.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude + +main = cabalTest $ do + cabal' "clean" [] + res <- cabalWithStdin "repl" ["-v2"] "foo" + -- Make sure we don't get this ghci error + -- *Lib> ghc: ^^ Could not load '_foo', dependency unresolved. See top entry above. + assertOutputDoesNotContain "Could not load" res + assertOutputContains "Building C Sources..." res diff --git a/cabal-testsuite/PackageTests/ReplCSources/foo.c b/cabal-testsuite/PackageTests/ReplCSources/foo.c new file mode 100644 index 00000000000..bf7759e11ea --- /dev/null +++ b/cabal-testsuite/PackageTests/ReplCSources/foo.c @@ -0,0 +1 @@ +int foo() { return 42; } diff --git a/cabal-testsuite/Test/Cabal/Prelude.hs b/cabal-testsuite/Test/Cabal/Prelude.hs index 2f24c69a0d4..c283ac38157 100644 --- a/cabal-testsuite/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/Test/Cabal/Prelude.hs @@ -70,23 +70,24 @@ import System.Posix.Resource ------------------------------------------------------------------------ -- * Utilities -runM :: FilePath -> [String] -> TestM Result -runM path args = do +runM :: FilePath -> [String] -> Maybe String -> TestM Result +runM path args input = do env <- getTestEnv r <- liftIO $ run (testVerbosity env) (Just (testCurrentDir env)) (testEnvironment env) path args + input recordLog r requireSuccess r -runProgramM :: Program -> [String] -> TestM Result -runProgramM prog args = do +runProgramM :: Program -> [String] -> Maybe String -> TestM Result +runProgramM prog args input = do configured_prog <- requireProgramM prog -- TODO: Consider also using other information from -- ConfiguredProgram, e.g., env and args - runM (programPath configured_prog) args + runM (programPath configured_prog) args input getLocalBuildInfoM :: TestM LocalBuildInfo getLocalBuildInfoM = do @@ -188,13 +189,13 @@ setup'' prefix cmd args = do ] (a:|as) = full_args full_args' = if a `elem` legacyCmds then ("v1-" ++ a) : as else a:as - in runProgramM cabalProgram full_args' + in runProgramM cabalProgram full_args' Nothing else do pdfile <- liftIO $ tryFindPackageDesc (testVerbosity env) (testCurrentDir env prefix) pdesc <- liftIO $ readGenericPackageDescription (testVerbosity env) pdfile if buildType (packageDescription pdesc) == Simple - then runM (testSetupPath env) (NE.toList full_args) + then runM (testSetupPath env) (NE.toList full_args) Nothing -- Run the Custom script! else do r <- liftIO $ runghc (testScriptEnv env) @@ -204,6 +205,7 @@ setup'' prefix cmd args = do (NE.toList full_args) recordLog r requireSuccess r + -- This code is very tempting (and in principle should be quick: -- after all we are loading the built version of Cabal), but -- actually it costs quite a bit in wallclock time (e.g. 54sec to @@ -276,6 +278,9 @@ cabal cmd args = void (cabal' cmd args) cabal' :: String -> [String] -> TestM Result cabal' = cabalG' [] +cabalWithStdin :: String -> [String] -> String -> TestM Result +cabalWithStdin cmd args input = cabalGArgs [] cmd args (Just input) + cabalG :: [String] -> String -> [String] -> TestM () cabalG global_args cmd args = void (cabalG' global_args cmd args) @@ -285,7 +290,10 @@ cabalG' _ "sandbox" _ = -- possible that the first argument isn't the sub-sub-command. -- So make sure the user specifies it correctly. error "Use cabal_sandbox' instead" -cabalG' global_args cmd args = do +cabalG' global_args cmd args = cabalGArgs global_args cmd args Nothing + +cabalGArgs :: [String] -> String -> [String] -> Maybe String -> TestM Result +cabalGArgs global_args cmd args input = do env <- getTestEnv -- Freeze writes out cabal.config to source directory, this is not -- overwritable @@ -321,7 +329,7 @@ cabalG' global_args cmd args = do ++ args defaultRecordMode RecordMarked $ do recordHeader ["cabal", cmd] - cabal_raw' cabal_args + cabal_raw' cabal_args input cabal_sandbox :: String -> [String] -> TestM () cabal_sandbox cmd args = void $ cabal_sandbox' cmd args @@ -335,10 +343,10 @@ cabal_sandbox' cmd args = do ++ args defaultRecordMode RecordMarked $ do recordHeader ["cabal", "v1-sandbox", cmd] - cabal_raw' cabal_args + cabal_raw' cabal_args Nothing -cabal_raw' :: [String] -> TestM Result -cabal_raw' cabal_args = runProgramM cabalProgram cabal_args +cabal_raw' :: [String] -> Maybe String -> TestM Result +cabal_raw' cabal_args input = runProgramM cabalProgram cabal_args input withSandbox :: TestM a -> TestM a withSandbox m = do @@ -379,7 +387,7 @@ runPlanExe' pkg_name cname args = do (CExeName (mkUnqualComponentName cname)) defaultRecordMode RecordAll $ do recordHeader [pkg_name, cname] - runM (dist_dir "build" cname cname) args + runM (dist_dir "build" cname cname) args Nothing ------------------------------------------------------------------------ -- * Running ghc-pkg @@ -416,7 +424,7 @@ ghcPkg' cmd args = do (programVersion ghcConfProg)) db_stack recordHeader ["ghc-pkg", cmd] - runProgramM ghcPkgProgram (cmd : extraArgs ++ args) + runProgramM ghcPkgProgram (cmd : extraArgs ++ args) Nothing ghcPkgPackageDBParams :: Version -> PackageDBStack -> [String] ghcPkgPackageDBParams version dbs = concatMap convert dbs where @@ -444,7 +452,7 @@ runExe' exe_name args = do env <- getTestEnv defaultRecordMode RecordAll $ do recordHeader [exe_name] - runM (testDistDir env "build" exe_name exe_name) args + runM (testDistDir env "build" exe_name exe_name) args Nothing -- | Run an executable that was installed by cabal. The @exe_name@ -- is precisely the name of the executable. @@ -459,11 +467,11 @@ runInstalledExe' exe_name args = do env <- getTestEnv defaultRecordMode RecordAll $ do recordHeader [exe_name] - runM (testPrefixDir env "bin" exe_name) args + runM (testPrefixDir env "bin" exe_name) args Nothing -- | Run a shell command in the current directory. shell :: String -> [String] -> TestM Result -shell exe args = runM exe args +shell exe args = runM exe args Nothing ------------------------------------------------------------------------ -- * Repository manipulation @@ -504,7 +512,7 @@ hackageRepoTool cmd args = void $ hackageRepoTool' cmd args hackageRepoTool' :: String -> [String] -> TestM Result hackageRepoTool' cmd args = do recordHeader ["hackage-repo-tool", cmd] - runProgramM hackageRepoToolProgram (cmd : args) + runProgramM hackageRepoToolProgram (cmd : args) Nothing tar :: [String] -> TestM () tar args = void $ tar' args @@ -512,7 +520,7 @@ tar args = void $ tar' args tar' :: [String] -> TestM Result tar' args = do recordHeader ["tar"] - runProgramM tarProgram args + runProgramM tarProgram args Nothing -- | Creates a tarball of a directory, such that if you -- archive the directory "/foo/bar/baz" to "mine.tgz", @tar tf@ reports @@ -782,6 +790,7 @@ hasProfiledLibraries = do liftIO $ writeFile prof_test_hs "module Prof where" r <- liftIO $ run (testVerbosity env) (Just (testCurrentDir env)) (testEnvironment env) ghc_path ["-prof", "-c", prof_test_hs] + Nothing return (resultExitCode r == ExitSuccess) -- | Check if the GHC that is used for compiling package tests has @@ -885,7 +894,7 @@ git cmd args = void $ git' cmd args git' :: String -> [String] -> TestM Result git' cmd args = do recordHeader ["git", cmd] - runProgramM gitProgram (cmd : args) + runProgramM gitProgram (cmd : args) Nothing gcc :: [String] -> TestM () gcc args = void $ gcc' args @@ -893,7 +902,7 @@ gcc args = void $ gcc' args gcc' :: [String] -> TestM Result gcc' args = do recordHeader ["gcc"] - runProgramM gccProgram args + runProgramM gccProgram args Nothing ghc :: [String] -> TestM () ghc args = void $ ghc' args @@ -901,7 +910,7 @@ ghc args = void $ ghc' args ghc' :: [String] -> TestM Result ghc' args = do recordHeader ["ghc"] - runProgramM ghcProgram args + runProgramM ghcProgram args Nothing -- | If a test needs to modify or write out source files, it's -- necessary to make a hermetic copy of the source files to operate diff --git a/cabal-testsuite/Test/Cabal/Run.hs b/cabal-testsuite/Test/Cabal/Run.hs index 2823bf1695a..141be2575fa 100644 --- a/cabal-testsuite/Test/Cabal/Run.hs +++ b/cabal-testsuite/Test/Cabal/Run.hs @@ -5,12 +5,12 @@ module Test.Cabal.Run ( Result(..) ) where -import Distribution.Compat.CreatePipe (createPipe) +import qualified Distribution.Compat.CreatePipe as Compat import Distribution.Simple.Program.Run import Distribution.Verbosity import Control.Concurrent.Async -import System.Process (runProcess, waitForProcess, showCommandForUser) +import System.Process import System.IO import System.Exit import System.Directory @@ -25,8 +25,8 @@ data Result = Result -- | Run a command, streaming its output to stdout, and return a 'Result' -- with this information. -run :: Verbosity -> Maybe FilePath -> [(String, Maybe String)] -> FilePath -> [String] -> IO Result -run _verbosity mb_cwd env_overrides path0 args = do +run :: Verbosity -> Maybe FilePath -> [(String, Maybe String)] -> FilePath -> [String] -> Maybe String -> IO Result +run _verbosity mb_cwd env_overrides path0 args input = do -- In our test runner, we allow a path to be relative to the -- current directory using the same heuristic as shells: -- 'foo' refers to an executable in the PATH, but './foo' @@ -38,15 +38,15 @@ run _verbosity mb_cwd env_overrides path0 args = do -- subprocess will execute in. Thus, IF we have a relative -- path which is not a bare executable name, we have to tack on -- the CWD to make it resolve correctly - cwd <- getCurrentDirectory + cwdir <- getCurrentDirectory let path | length (splitPath path0) /= 1 && isRelative path0 - = cwd path0 + = cwdir path0 | otherwise = path0 mb_env <- getEffectiveEnvironment env_overrides putStrLn $ "+ " ++ showCommandForUser path args - (readh, writeh) <- createPipe + (readh, writeh) <- Compat.createPipe hSetBuffering readh LineBuffering hSetBuffering writeh LineBuffering let drain = do @@ -56,13 +56,24 @@ run _verbosity mb_cwd env_overrides path0 args = do return r withAsync drain $ \sync -> do - -- NB: do NOT extend this to take stdin; then we will - -- start deadlocking on AppVeyor. See https://github.com/haskell/process/issues/76 - pid <- runProcess path args mb_cwd mb_env Nothing {- no stdin -} - (Just writeh) (Just writeh) + let prc = (proc path args) + { cwd = mb_cwd + , env = mb_env + , std_in = case input of { Just _ -> CreatePipe; Nothing -> Inherit } + , std_out = UseHandle writeh + , std_err = UseHandle writeh + } + (stdin_h, _, _, procHandle) <- createProcess prc + + case input of + Just x -> + case stdin_h of + Just h -> hPutStr h x >> hClose h + Nothing -> error "No stdin handle when input was specified!" + Nothing -> return () -- wait for the program to terminate - exitcode <- waitForProcess pid + exitcode <- waitForProcess procHandle out <- wait sync return Result { diff --git a/cabal-testsuite/Test/Cabal/Script.hs b/cabal-testsuite/Test/Cabal/Script.hs index 7cbf68afc53..d509e6efe4a 100644 --- a/cabal-testsuite/Test/Cabal/Script.hs +++ b/cabal-testsuite/Test/Cabal/Script.hs @@ -70,7 +70,7 @@ runghc :: ScriptEnv -> Maybe FilePath -> [(String, Maybe String)] -> FilePath -> [String] -> IO Result runghc senv mb_cwd env_overrides script_path args = do (real_path, real_args) <- runnerCommand senv mb_cwd env_overrides script_path args - run (runnerVerbosity senv) mb_cwd env_overrides real_path real_args + run (runnerVerbosity senv) mb_cwd env_overrides real_path real_args Nothing -- | Compute the command line which should be used to run a Haskell -- script with 'runghc'. From 6bae128ffeaf1c5c6d45e5d5c24d5634343a1795 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 18 Oct 2019 11:00:14 -0400 Subject: [PATCH 4/9] Accept "linux-androideabi" as an alias for Android Google uses `armv7-none-linux-androideabi`, analogous to `armv7-unknown-linux-gnueabi` for e.g. a 32-bit regular linux. The existing alias it not a mistake, it is the right one for 64 bit. Google for that use `aarch64-linux-android`, analogous to `aarch64-unknown-linux-android` for a 64-bi regular linux. See https://developer.android.com/ndk/guides/standalone_toolchain for evidence/details. --- Cabal/Distribution/System.hs | 3 ++- changelog.d/pr-6301 | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/pr-6301 diff --git a/Cabal/Distribution/System.hs b/Cabal/Distribution/System.hs index c480d240160..89fcb5dea2c 100644 --- a/Cabal/Distribution/System.hs +++ b/Cabal/Distribution/System.hs @@ -122,7 +122,8 @@ osAliases Permissive FreeBSD = ["kfreebsdgnu"] osAliases Compat FreeBSD = ["kfreebsdgnu"] osAliases Permissive Solaris = ["solaris2"] osAliases Compat Solaris = ["solaris2"] -osAliases _ Android = ["linux-android"] +osAliases Permissive Android = ["linux-android", "linux-androideabi", "linux-androideabihf"] +osAliases Compat Android = ["linux-android"] osAliases _ _ = [] instance Pretty OS where diff --git a/changelog.d/pr-6301 b/changelog.d/pr-6301 new file mode 100644 index 00000000000..f233cd3902d --- /dev/null +++ b/changelog.d/pr-6301 @@ -0,0 +1,2 @@ +synopsis: Accept "linux-androideabi" for determining buildOS +prs: #6301 From 72a1347d21d8246be4648822d117f9b798a5e4dd Mon Sep 17 00:00:00 2001 From: Eric Conlon Date: Mon, 14 Sep 2020 11:11:27 -0700 Subject: [PATCH 5/9] Pass -optcxx for GHC >= 8.10 Fixes https://github.com/haskell/cabal/issues/6421 To summarize, Cabal passes all C and C++ flags through GHC to the underlying C or C++ compiler using -optc. This works for GHC < 8.10, but now GHC expects C++ flags to come through -optcxx. This means that anything through -optc is ignored, so we cannot pass any flags to the C++ compiler. This change simply detects the GHC version and uses the correct arguments. This PR has been tested manually and two PackageTests have been added to cabal-testsuite. They pass under GHC 8.8.4 and GHC 8.10.2. --- Cabal/Distribution/Simple/Program/GHC.hs | 6 +++++- .../PackageTests/FFI/ForeignOptsC/Main.hs | 16 ++++++++++++++++ .../PackageTests/FFI/ForeignOptsC/README.md | 5 +++++ .../PackageTests/FFI/ForeignOptsC/cabal.out | 10 ++++++++++ .../PackageTests/FFI/ForeignOptsC/cabal.project | 1 + .../PackageTests/FFI/ForeignOptsC/cabal.test.hs | 4 ++++ .../PackageTests/FFI/ForeignOptsC/cbits/clib.c | 13 +++++++++++++ .../PackageTests/FFI/ForeignOptsC/cbits/clib.h | 6 ++++++ .../FFI/ForeignOptsC/foreign-opts-c.cabal | 14 ++++++++++++++ .../PackageTests/FFI/ForeignOptsCxx/Main.hs | 16 ++++++++++++++++ .../PackageTests/FFI/ForeignOptsCxx/README.md | 7 +++++++ .../PackageTests/FFI/ForeignOptsCxx/cabal.out | 10 ++++++++++ .../FFI/ForeignOptsCxx/cabal.project | 1 + .../FFI/ForeignOptsCxx/cabal.test.hs | 4 ++++ .../FFI/ForeignOptsCxx/cxxbits/cxxlib.cpp | 13 +++++++++++++ .../FFI/ForeignOptsCxx/cxxbits/cxxlib.h | 12 ++++++++++++ .../FFI/ForeignOptsCxx/foreign-opts-cxx.cabal | 15 +++++++++++++++ 17 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/Main.hs create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/README.md create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.project create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.c create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.h create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsC/foreign-opts-c.cabal create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/Main.hs create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/README.md create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.project create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.cpp create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.h create mode 100644 cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/foreign-opts-cxx.cabal diff --git a/Cabal/Distribution/Simple/Program/GHC.hs b/Cabal/Distribution/Simple/Program/GHC.hs index cdb9b014b19..a9c6a573b1e 100644 --- a/Cabal/Distribution/Simple/Program/GHC.hs +++ b/Cabal/Distribution/Simple/Program/GHC.hs @@ -685,7 +685,11 @@ renderGhcOptions comp _platform@(Platform _arch os) opts , concat [ [ "-optP-include", "-optP" ++ inc] | inc <- flags ghcOptCppIncludes ] , [ "-optc" ++ opt | opt <- ghcOptCcOptions opts] - , [ "-optc" ++ opt | opt <- ghcOptCxxOptions opts] + , -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + let cxxflag = case compilerCompatVersion GHC comp of + Just v | v >= mkVersion [8, 10] -> "-optcxx" + _ -> "-optc" + in [ cxxflag ++ opt | opt <- ghcOptCxxOptions opts] , [ "-opta" ++ opt | opt <- ghcOptAsmOptions opts] ----------------- diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/Main.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/Main.hs new file mode 100644 index 00000000000..34c10adfd99 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/Main.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE ForeignFunctionInterface #-} + +module Main where + +import Foreign.C (CInt (..)) + +foreign import ccall "clib.h meaning_of_life_c" + meaning_of_life_c :: IO CInt + +main :: IO () +main = do + secret <- meaning_of_life_c + -- The value 11 comes from __TESTOPT_C__ - see the cabal file. + if (secret == 11) + then putStrLn ("The secret is " ++ show secret) + else error ("Expected value 11, got " ++ show secret) diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/README.md b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/README.md new file mode 100644 index 00000000000..8fbef899efd --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/README.md @@ -0,0 +1,5 @@ +# ForeignOptsC + +This test case asserts that cabal passes `cc-options` to the C compiler (and NOT `cxx-options`). + +See the additional case `ForeignOptsCxx`. diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out new file mode 100644 index 00000000000..8e20a55e25b --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - foreign-opts-c-0.1 (exe:foreign-opts-c-exe) (first run) +Configuring executable 'foreign-opts-c-exe' for foreign-opts-c-0.1.. +Preprocessing executable 'foreign-opts-c-exe' for foreign-opts-c-0.1.. +Building executable 'foreign-opts-c-exe' for foreign-opts-c-0.1.. +# foreign-opts-c foreign-opts-c-exe +The secret is 11 diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.project b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.test.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.test.hs new file mode 100644 index 00000000000..7d5d4f0aff9 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + cabal "v2-build" ["foreign-opts-c-exe"] + withPlan $ runPlanExe "foreign-opts-c" "foreign-opts-c-exe" [] diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.c b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.c new file mode 100644 index 00000000000..a7be6827444 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.c @@ -0,0 +1,13 @@ +#include "clib.h" + +#ifndef __TESTOPT_C__ +#error "Did not get required __TESTOPT_C__ from cc-options" +#endif + +#ifdef __TESTOPT_CXX__ +#error "Got unexpected __TESTOPT_CXX__ from cxx-options" +#endif + +int meaning_of_life_c() { + return __TESTOPT_C__; +} diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.h b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.h new file mode 100644 index 00000000000..0d55fe33783 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cbits/clib.h @@ -0,0 +1,6 @@ +#ifndef CLIB_H +#define CLIB_H + +int meaning_of_life_c(); + +#endif diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/foreign-opts-c.cabal b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/foreign-opts-c.cabal new file mode 100644 index 00000000000..72df2654a51 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/foreign-opts-c.cabal @@ -0,0 +1,14 @@ +cabal-version: 2.2 +name: foreign-opts-c +version: 0.1 +build-type: Simple + +executable foreign-opts-c-exe + main-is: Main.hs + build-depends: base + default-language: Haskell2010 + include-dirs: cbits + c-sources: cbits/clib.c + -- The following options are shared in all ForeignOpts cases: + cc-options: -D__TESTOPT_C__=11 + cxx-options: -D__TESTOPT_CXX__=22 diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/Main.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/Main.hs new file mode 100644 index 00000000000..2343305fc39 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/Main.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE ForeignFunctionInterface #-} + +module Main where + +import Foreign.C (CInt (..)) + +foreign import ccall "cxxlib.h meaning_of_life_cxx" + meaning_of_life_cxx :: IO CInt + +main :: IO () +main = do + secret <- meaning_of_life_cxx + -- The value 22 comes from __TESTOPT_CXX__ - see the cabal file. + if (secret == 22) + then putStrLn ("The secret is " ++ show secret) + else error ("Expected value 22, got " ++ show secret) diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/README.md b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/README.md new file mode 100644 index 00000000000..5db6d58e488 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/README.md @@ -0,0 +1,7 @@ +# ForeignOptsCxx + +This asserts that cabal passes `cxx-options` to the C++ compiler (and NOT `cc-options`). + +Since GHC 8.10, they are passed through GHC with `-optcxx`. Before that, they were passed with `-optc`. + +See the additional case `ForeignOptsC`. diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out new file mode 100644 index 00000000000..67d96847f4b --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - foreign-opts-cxx-0.1 (exe:foreign-opts-cxx-exe) (first run) +Configuring executable 'foreign-opts-cxx-exe' for foreign-opts-cxx-0.1.. +Preprocessing executable 'foreign-opts-cxx-exe' for foreign-opts-cxx-0.1.. +Building executable 'foreign-opts-cxx-exe' for foreign-opts-cxx-0.1.. +# foreign-opts-cxx foreign-opts-cxx-exe +The secret is 22 diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.project b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.test.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.test.hs new file mode 100644 index 00000000000..10024955a78 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + cabal "v2-build" ["foreign-opts-cxx-exe"] + withPlan $ runPlanExe "foreign-opts-cxx" "foreign-opts-cxx-exe" [] diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.cpp b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.cpp new file mode 100644 index 00000000000..7d58cb88f82 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.cpp @@ -0,0 +1,13 @@ +#include "cxxlib.h" + +#ifdef __TESTOPT_C__ +#error "Got unexpected __TESTOPT_C__ from cc-options" +#endif + +#ifndef __TESTOPT_CXX__ +#error "Did not get required __TESTOPT_CXX__ from cxx-options" +#endif + +int meaning_of_life_cxx() { + return __TESTOPT_CXX__; +} diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.h b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.h new file mode 100644 index 00000000000..500a168c6c6 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cxxbits/cxxlib.h @@ -0,0 +1,12 @@ +#ifndef CXXLIB_H +#define CXXLIB_H +#ifdef __cplusplus +extern "C" { +#endif + +int meaning_of_life_cxx(); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/foreign-opts-cxx.cabal b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/foreign-opts-cxx.cabal new file mode 100644 index 00000000000..04f150d7a69 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/foreign-opts-cxx.cabal @@ -0,0 +1,15 @@ +cabal-version: 2.2 +name: foreign-opts-cxx +version: 0.1 +build-type: Simple + +executable foreign-opts-cxx-exe + main-is: Main.hs + build-depends: base + default-language: Haskell2010 + include-dirs: cxxbits + extra-libraries: stdc++ + cxx-sources: cxxbits/cxxlib.cpp + -- The following options are shared in all ForeignOpts cases: + cc-options: -D__TESTOPT_C__=11 + cxx-options: -D__TESTOPT_CXX__=22 From 1515a1547cdceeb03b310081ded1e35c124e8f38 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 27 Sep 2020 14:42:26 +0300 Subject: [PATCH 6/9] Resolve #7091: Require custom-setup for cabal-version: 1.24 and later --- .../Distribution/PackageDescription/Parsec.hs | 20 ++++++++++++++++++- .../ParserTests/regressions/mixin-1.cabal | 1 + .../ParserTests/regressions/mixin-1.expr | 2 +- .../ParserTests/regressions/mixin-1.format | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Cabal/Distribution/PackageDescription/Parsec.hs b/Cabal/Distribution/PackageDescription/Parsec.hs index 136045c174d..1c42c8a10d8 100644 --- a/Cabal/Distribution/PackageDescription/Parsec.hs +++ b/Cabal/Distribution/PackageDescription/Parsec.hs @@ -199,6 +199,7 @@ parseGenericPackageDescription' cabalVerM lexWarnings utf8WarnPos fs = do gpd1 <- view stateGpd <$> execStateT (goSections specVer sectionFields) (SectionS gpd Map.empty) checkForUndefinedFlags gpd1 + checkForUndefinedCustomSetup gpd1 gpd1 `deepseq` return gpd1 where safeLast :: [a] -> Maybe a @@ -672,9 +673,14 @@ onAllBranches p = go mempty goBranch acc (CondBranch _ t (Just e)) = go acc t && go acc e ------------------------------------------------------------------------------- --- Flag check +-- Post parsing checks ------------------------------------------------------------------------------- +-- | Check that we +-- +-- * don't use undefined flags (very bad) +-- * define flags which are unused (just bad) +-- checkForUndefinedFlags :: GenericPackageDescription -> ParseResult () checkForUndefinedFlags gpd = do let definedFlags, usedFlags :: Set.Set FlagName @@ -689,6 +695,18 @@ checkForUndefinedFlags gpd = do f :: CondTree ConfVar c a -> Const (Set.Set FlagName) (CondTree ConfVar c a) f ct = Const (Set.fromList (freeVars ct)) +-- | Since @cabal-version: 1.24@ one can specify @custom-setup@. +-- Let us require it. +-- +checkForUndefinedCustomSetup :: GenericPackageDescription -> ParseResult () +checkForUndefinedCustomSetup gpd = do + let pd = packageDescription gpd + let csv = specVersion pd + + when (buildType pd == Custom && isNothing (setupBuildInfo pd)) $ + when (csv >= mkVersion [1,24]) $ parseFailure zeroPos $ + "Since cabal-version: 1.24 specifying custom-setup section is mandatory" + ------------------------------------------------------------------------------- -- Old syntax ------------------------------------------------------------------------------- diff --git a/Cabal/tests/ParserTests/regressions/mixin-1.cabal b/Cabal/tests/ParserTests/regressions/mixin-1.cabal index 5645cd9ebfb..af6689a1de3 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-1.cabal +++ b/Cabal/tests/ParserTests/regressions/mixin-1.cabal @@ -1,6 +1,7 @@ cabal-version: 2.0 name: mixin version: 0 +build-type: Simple executable str-example main-is: Main.hs diff --git a/Cabal/tests/ParserTests/regressions/mixin-1.expr b/Cabal/tests/ParserTests/regressions/mixin-1.expr index f49c417221f..3df491d5da8 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal/tests/ParserTests/regressions/mixin-1.expr @@ -88,7 +88,7 @@ GenericPackageDescription {author = "", benchmarks = [], bugReports = "", - buildTypeRaw = Nothing, + buildTypeRaw = Just Simple, category = "", copyright = "", customFieldsPD = [], diff --git a/Cabal/tests/ParserTests/regressions/mixin-1.format b/Cabal/tests/ParserTests/regressions/mixin-1.format index 5bf744429af..e427d1c1ce7 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-1.format +++ b/Cabal/tests/ParserTests/regressions/mixin-1.format @@ -1,6 +1,7 @@ cabal-version: 2.0 name: mixin version: 0 +build-type: Simple executable str-example main-is: Main.hs From 246c88ed19f0d9bd3f3d1cd46c384eaa7b73abad Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Fri, 16 Oct 2020 21:33:52 +0300 Subject: [PATCH 7/9] Fix #7126: Stricter checks for relative paths E.g. `foo/../../../bar` is now forbidden. That cannot work. --- Cabal/Cabal.cabal | 2 + .../Distribution/PackageDescription/Check.hs | 322 ++++++++++++++++-- Cabal/Distribution/Utils/Generic.hs | 1 + Cabal/tests/CheckTests.hs | 1 + .../regressions/denormalised-paths.cabal | 71 ++++ .../regressions/denormalised-paths.check | 12 + 6 files changed, 386 insertions(+), 23 deletions(-) create mode 100644 Cabal/tests/ParserTests/regressions/denormalised-paths.cabal create mode 100644 Cabal/tests/ParserTests/regressions/denormalised-paths.check diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index fb38a6c5a31..7fb9fed8b5d 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -133,6 +133,8 @@ extra-source-files: tests/ParserTests/regressions/common3.format tests/ParserTests/regressions/cxx-options-with-optimization.cabal tests/ParserTests/regressions/cxx-options-with-optimization.check + tests/ParserTests/regressions/denormalised-paths.cabal + tests/ParserTests/regressions/denormalised-paths.check tests/ParserTests/regressions/elif.cabal tests/ParserTests/regressions/elif.expr tests/ParserTests/regressions/elif.format diff --git a/Cabal/Distribution/PackageDescription/Check.hs b/Cabal/Distribution/PackageDescription/Check.hs index 25f65224a1a..3c2c7765339 100644 --- a/Cabal/Distribution/PackageDescription/Check.hs +++ b/Cabal/Distribution/PackageDescription/Check.hs @@ -79,6 +79,9 @@ import qualified Distribution.Types.BuildInfo.Lens as L import qualified Distribution.Types.GenericPackageDescription.Lens as L import qualified Distribution.Types.PackageDescription.Lens as L +-- $setup +-- >>> import Control.Arrow ((&&&)) + -- | Results of some kind of failed package check. -- -- There are a range of severities, from merely dubious to totally insane. @@ -773,6 +776,16 @@ checkSourceRepos pkg = , check (maybe False isAbsoluteOnAnyPlatform (repoSubdir repo)) $ PackageDistInexcusable "The 'subdir' field of a source-repository must be a relative path." + + , check (maybe False isAbsoluteOnAnyPlatform (repoSubdir repo)) $ + PackageDistInexcusable + "The 'subdir' field of a source-repository must be a relative path." + + , do + subdir <- repoSubdir repo + err <- isGoodRelativeDirectoryPath subdir + return $ PackageDistInexcusable $ + "The 'subdir' field of a source-repository is not a good relative path: " ++ show err ] | repo <- sourceRepos pkg ] @@ -1049,27 +1062,42 @@ checkAlternatives badField goodField flags = where (badFlags, goodFlags) = unzip flags +data PathKind + = PathKindFile + | PathKindDirectory + | PathKindGlob + checkPaths :: PackageDescription -> [PackageCheck] checkPaths pkg = [ PackageBuildWarning $ - quote (kind ++ ": " ++ path) + quote (field ++ ": " ++ path) ++ " is a relative path outside of the source tree. " ++ "This will not work when generating a tarball with 'sdist'." - | (path, kind) <- relPaths ++ absPaths + | (path, field, _) <- relPaths ++ absPaths , isOutsideTree path ] ++ [ PackageDistInexcusable $ - quote (kind ++ ": " ++ path) ++ " is an absolute path." - | (path, kind) <- relPaths + quote (field ++ ": " ++ path) ++ " is an absolute path." + | (path, field, _) <- relPaths , isAbsoluteOnAnyPlatform path ] ++ [ PackageDistInexcusable $ - quote (kind ++ ": " ++ path) ++ " points inside the 'dist' " + quote (field ++ ": " ++ path) ++ " is not good relative path: " ++ err + | (path, field, kind) <- relPaths + -- these are not paths, but globs... + , err <- maybeToList $ case kind of + PathKindFile -> isGoodRelativeFilePath path + PathKindGlob -> isGoodRelativeGlob path + PathKindDirectory -> isGoodRelativeDirectoryPath path + ] + ++ + [ PackageDistInexcusable $ + quote (field ++ ": " ++ path) ++ " points inside the 'dist' " ++ "directory. This is not reliable because the location of this " ++ "directory is configurable by the user (or package manager). In " ++ "addition the layout of the 'dist' directory is subject to change " ++ "in future versions of Cabal." - | (path, kind) <- relPaths ++ absPaths + | (path, field, _) <- relPaths ++ absPaths , isInsideDist path ] ++ [ PackageDistInexcusable $ @@ -1109,29 +1137,34 @@ checkPaths pkg = "dist" :_ -> True ".":"dist":_ -> True _ -> False + -- paths that must be relative + relPaths :: [(FilePath, String, PathKind)] relPaths = - [ (path, "extra-source-files") | path <- extraSrcFiles pkg ] - ++ [ (path, "extra-tmp-files") | path <- extraTmpFiles pkg ] - ++ [ (path, "extra-doc-files") | path <- extraDocFiles pkg ] - ++ [ (path, "data-files") | path <- dataFiles pkg ] - ++ [ (path, "data-dir") | path <- [dataDir pkg]] - ++ [ (path, "license-file") | path <- licenseFiles pkg ] + [ (path, "extra-source-files", PathKindGlob) | path <- extraSrcFiles pkg ] + ++ [ (path, "extra-tmp-files", PathKindFile) | path <- extraTmpFiles pkg ] + ++ [ (path, "extra-doc-files", PathKindGlob) | path <- extraDocFiles pkg ] + ++ [ (path, "data-files", PathKindGlob) | path <- dataFiles pkg ] + ++ [ (path, "data-dir", PathKindDirectory) | path <- [dataDir pkg]] + ++ [ (path, "license-file", PathKindFile) | path <- licenseFiles pkg ] ++ concat - [ [ (path, "asm-sources") | path <- asmSources bi ] - ++ [ (path, "cmm-sources") | path <- cmmSources bi ] - ++ [ (path, "c-sources") | path <- cSources bi ] - ++ [ (path, "cxx-sources") | path <- cxxSources bi ] - ++ [ (path, "js-sources") | path <- jsSources bi ] - ++ [ (path, "install-includes") | path <- installIncludes bi ] - ++ [ (path, "hs-source-dirs") | path <- hsSourceDirs bi ] + [ [ (path, "asm-sources", PathKindFile) | path <- asmSources bi ] + ++ [ (path, "cmm-sources", PathKindFile) | path <- cmmSources bi ] + ++ [ (path, "c-sources", PathKindFile) | path <- cSources bi ] + ++ [ (path, "cxx-sources", PathKindFile) | path <- cxxSources bi ] + ++ [ (path, "js-sources", PathKindFile) | path <- jsSources bi ] + ++ [ (path, "install-includes", PathKindFile) | path <- installIncludes bi ] + ++ [ (path, "hs-source-dirs", PathKindDirectory) | path <- hsSourceDirs bi ] | bi <- allBuildInfo pkg ] + -- paths that are allowed to be absolute + absPaths :: [(FilePath, String, PathKind)] absPaths = concat - [ [ (path, "includes") | path <- includes bi ] - ++ [ (path, "include-dirs") | path <- includeDirs bi ] - ++ [ (path, "extra-lib-dirs") | path <- extraLibDirs bi ] - | bi <- allBuildInfo pkg ] + [ [ (path, "includes", PathKindFile) | path <- includes bi ] ++ + [ (path, "include-dirs", PathKindDirectory) | path <- includeDirs bi ] ++ + [ (path, "extra-lib-dirs", PathKindDirectory) | path <- extraLibDirs bi ] + | bi <- allBuildInfo pkg + ] --TODO: check sets of paths that would be interpreted differently between Unix -- and windows, ie case-sensitive or insensitive. Things that might clash, or @@ -2285,3 +2318,246 @@ fileExtensionSupportedLanguage path = extension = takeExtension path isHaskell = extension `elem` [".hs", ".lhs"] isC = isJust (filenameCDialect extension) + +-- | Whether a path is a good relative path. +-- +-- >>> let test fp = putStrLn $ show (isGoodRelativeDirectoryPath fp) ++ "; " ++ show (isGoodRelativeFilePath fp) +-- +-- >>> test "foo/bar/quu" +-- Nothing; Nothing +-- +-- Trailing slash is not allowed for files, for directories it is ok. +-- +-- >>> test "foo/" +-- Nothing; Just "trailing slash" +-- +-- Leading @./@ is fine, but @.@ and @./@ are not valid files. +-- +-- >>> traverse_ test [".", "./", "./foo/bar"] +-- Nothing; Just "trailing dot segment" +-- Nothing; Just "trailing slash" +-- Nothing; Nothing +-- +-- Lastly, not good file nor directory cases: +-- +-- >>> traverse_ test ["", "/tmp/src", "foo//bar", "foo/.", "foo/./bar", "foo/../bar", "foo*bar"] +-- Just "empty path"; Just "empty path" +-- Just "posix absolute path"; Just "posix absolute path" +-- Just "empty path segment"; Just "empty path segment" +-- Just "trailing same directory segment: ."; Just "trailing same directory segment: ." +-- Just "same directory segment: ."; Just "same directory segment: .." +-- Just "parent directory segment: .."; Just "parent directory segment: .." +-- Just "reserved character '*'"; Just "reserved character '*'" +-- +-- For the last case, 'isGoodRelativeGlob' doesn't warn: +-- +-- >>> traverse_ (print . isGoodRelativeGlob) ["foo/../bar", "foo*bar"] +-- Just "parent directory segment: .." +-- Nothing +-- +isGoodRelativeFilePath :: FilePath -> Maybe String +isGoodRelativeFilePath = state0 + where + -- Reserved characters + -- https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file + isReserved c = c `elem` "<>:\"\\/|?*" + + -- initial state + state0 [] = Just "empty path" + state0 (c:cs) | c == '.' = state1 cs + | c == '/' = Just "posix absolute path" + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state3 cs + + -- after . + state1 [] = Just "trailing dot segment" + state1 (c:cs) | c == '.' = state4 cs + | c == '/' = state2 cs + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state5 cs + + -- after ./ + state2 [] = Just "trailing slash" + state2 (c:cs) | c == '.' = state3 cs + | c == '/' = Just "empty path segment" + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state5 cs + + -- after non-first segment's . + state3 [] = Just "trailing same directory segment: ." + state3 (c:cs) | c == '.' = state4 cs + | c == '/' = Just "same directory segment: .." + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state5 cs + + -- after non-first segment's .. + state4 [] = Just "trailing parent directory segment: .." + state4 (c:cs) | c == '.' = state5 cs + | c == '/' = Just "parent directory segment: .." + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state5 cs + + -- in a segment which is ok. + state5 [] = Nothing + state5 (c:cs) | c == '.' = state3 cs + | c == '/' = state2 cs + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state5 cs + +-- | See 'isGoodRelativeFilePath'. +-- +-- This is barebones function. We check whether the glob is a valid file +-- by replacing stars @*@ with @x@ses. +isGoodRelativeGlob :: FilePath -> Maybe String +isGoodRelativeGlob = isGoodRelativeFilePath . map f where + f '*' = 'x' + f c = c + +-- | See 'isGoodRelativeFilePath'. +isGoodRelativeDirectoryPath :: FilePath -> Maybe String +isGoodRelativeDirectoryPath = state0 + where + -- Reserved characters + -- https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file + isReserved c = c `elem` "<>:\"\\/|?*" + + -- initial state + state0 [] = Just "empty path" + state0 (c:cs) | c == '.' = state5 cs + | c == '/' = Just "posix absolute path" + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + + -- after ./ + state1 [] = Nothing -- "./" + state1 (c:cs) | c == '.' = state2 cs + | c == '/' = Just "empty path segment" + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + + -- after non-first setgment's . + state2 [] = Just "trailing same directory segment: ." + state2 (c:cs) | c == '.' = state3 cs + | c == '/' = Just "same directory segment: ." + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + + -- after non-first segment's .. + state3 [] = Just "trailing parent directory segment: ." + state3 (c:cs) | c == '.' = state4 cs + | c == '/' = Just "parent directory segment: .." + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + + -- in a segment which is ok. + state4 [] = Nothing + state4 (c:cs) | c == '.' = state4 cs + | c == '/' = state1 cs + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + + -- after . + state5 [] = Nothing -- "." + state5 (c:cs) | c == '.' = state3 cs + | c == '/' = state1 cs + | isReserved c = Just ("reserved character " ++ show c) + | otherwise = state4 cs + +-- [Note: Good relative paths] +-- +-- Using @kleene@ we can define an extended regex: +-- +-- @ +-- import Algebra.Lattice +-- import Kleene +-- import Kleene.ERE (ERE (..), intersections) +-- +-- data C = CDot | CSlash | COtherReserved | CChar +-- deriving (Eq, Ord, Enum, Bounded, Show) +-- +-- reservedR :: ERE C +-- reservedR = notChar CSlash /\ notChar COtherReserved +-- +-- pathPieceR :: ERE C +-- pathPieceR = intersections +-- [ plus reservedR +-- , ERENot (string [CDot]) +-- , ERENot (string [CDot,CDot]) +-- ] +-- +-- filePathR :: ERE C +-- filePathR = optional (string [CDot, CSlash]) <> pathPieceR <> star (char CSlash <> pathPieceR) +-- +-- dirPathR :: ERE C +-- dirPathR = (char CDot \/ filePathR) <> optional (char CSlash) +-- +-- plus :: ERE C -> ERE C +-- plus r = r <> star r +-- +-- optional :: ERE C -> ERE C +-- optional r = mempty \/ r +-- @ +-- +-- Results in following state machine for @filePathR@ +-- +-- @ +-- 0 -> \x -> if +-- | x <= CDot -> 1 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 1 -> \x -> if +-- | x <= CDot -> 4 +-- | x <= CSlash -> 2 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 2 -> \x -> if +-- | x <= CDot -> 3 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 3 -> \x -> if +-- | x <= CDot -> 4 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 4 -> \x -> if +-- | x <= CDot -> 5 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 5+ -> \x -> if +-- | x <= CDot -> 5 +-- | x <= CSlash -> 2 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 5 +-- 6 -> \_ -> 6 -- black hole +-- @ +-- +-- and @dirPathR@: +-- +-- @ +-- 0 -> \x -> if +-- | x <= CDot -> 5 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 1+ -> \x -> if +-- | x <= CDot -> 2 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 2 -> \x -> if +-- | x <= CDot -> 3 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 3 -> \x -> if +-- | x <= CDot -> 4 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 4+ -> \x -> if +-- | x <= CDot -> 4 +-- | x <= CSlash -> 1 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 5+ -> \x -> if +-- | x <= CDot -> 3 +-- | x <= CSlash -> 1 +-- | x <= COtherReserved -> 6 +-- | otherwise -> 4 +-- 6 -> \_ -> 6 -- black hole +-- @ diff --git a/Cabal/Distribution/Utils/Generic.hs b/Cabal/Distribution/Utils/Generic.hs index e0e72cec51f..37fb351064d 100644 --- a/Cabal/Distribution/Utils/Generic.hs +++ b/Cabal/Distribution/Utils/Generic.hs @@ -542,6 +542,7 @@ unsnocNE (x:|xs) = go x xs where isAbsoluteOnAnyPlatform :: FilePath -> Bool -- C:\\directory isAbsoluteOnAnyPlatform (drive:':':'\\':_) = isAlpha drive +isAbsoluteOnAnyPlatform (drive:':':'/':_) = isAlpha drive -- UNC isAbsoluteOnAnyPlatform ('\\':'\\':_) = True -- Posix root diff --git a/Cabal/tests/CheckTests.hs b/Cabal/tests/CheckTests.hs index 97f1ca07558..b0dbd6a60ad 100644 --- a/Cabal/tests/CheckTests.hs +++ b/Cabal/tests/CheckTests.hs @@ -40,6 +40,7 @@ checkTests = testGroup "regressions" , checkTest "ghc-option-j.cabal" , checkTest "multiple-libs-2.cabal" , checkTest "assoc-cpp-options.cabal" + , checkTest "denormalised-paths.cabal" ] checkTest :: FilePath -> TestTree diff --git a/Cabal/tests/ParserTests/regressions/denormalised-paths.cabal b/Cabal/tests/ParserTests/regressions/denormalised-paths.cabal new file mode 100644 index 00000000000..338109cabda --- /dev/null +++ b/Cabal/tests/ParserTests/regressions/denormalised-paths.cabal @@ -0,0 +1,71 @@ +cabal-version: 2.4 +name: assoc +version: 1.1 +license: BSD-3-Clause +license-files: LICENSE LICENSE2/ . +synopsis: swap and assoc: Symmetric and Semigroupy Bifunctors +category: Data +description: + Provides generalisations of + @swap :: (a,b) -> (b,a)@ and + @assoc :: ((a,b),c) -> (a,(b,c))@ + to + @Bifunctor@s supporting similar operations (e.g. @Either@, @These@). + +author: Oleg Grenrus +maintainer: Oleg Grenrus +build-type: Simple +tested-with: + GHC ==7.0.4 + || ==7.2.2 + || ==7.4.2 + || ==7.6.3 + || ==7.8.4 + || ==7.10.3 + || ==8.0.2 + || ==8.2.2 + || ==8.4.4 + || ==8.6.5 + || ==8.8.1 + +extra-source-files: + files/**/*.txt/ + files/../foo.txt + +source-repository head + type: git + location: https://github.com/phadej/assoc.git + subdir: ./. + +source-repository this + type: git + location: https://github.com/phadej/assoc.git + tag: v1.1 + subdir: foo/ + +library + default-language: Haskell2010 + build-depends: + base >=4.3 && <4.13 + , bifunctors >=5.5.4 && <5.6 + + exposed-modules: + Data.Bifunctor.Assoc + Data.Bifunctor.Swap + + -- this is fine + hs-source-dirs: src/ + + -- collection of invalid sources + hs-source-dirs: src/. + hs-source-dirs: src/../src + hs-source-dirs: src/../../assoc/src + -- this is forbidden by a parser + -- hs-source-dirs: C:/foo/bar + hs-source-dirs: C:foo/bar + hs-source-dirs: ||s + -- this is forbidden by a parser + -- hs-source-dirs: /var/secret/source + + -- this is the only case catched by Cabal-3.0.2.0 + hs-source-dirs: ../../assoc/src diff --git a/Cabal/tests/ParserTests/regressions/denormalised-paths.check b/Cabal/tests/ParserTests/regressions/denormalised-paths.check new file mode 100644 index 00000000000..02fe04a457b --- /dev/null +++ b/Cabal/tests/ParserTests/regressions/denormalised-paths.check @@ -0,0 +1,12 @@ +The 'subdir' field of a source-repository is not a good relative path: "trailing same directory segment: ." +'hs-source-dirs: ../../assoc/src' is a relative path outside of the source tree. This will not work when generating a tarball with 'sdist'. +'extra-source-files: files/**/*.txt/' is not good relative path: trailing slash +'extra-source-files: files/../foo.txt' is not good relative path: parent directory segment: .. +'license-file: LICENSE2/' is not good relative path: trailing slash +'license-file: .' is not good relative path: trailing dot segment +'hs-source-dirs: src/.' is not good relative path: trailing same directory segment: . +'hs-source-dirs: src/../src' is not good relative path: parent directory segment: .. +'hs-source-dirs: src/../../assoc/src' is not good relative path: parent directory segment: .. +'hs-source-dirs: C:foo/bar' is not good relative path: reserved character ':' +'hs-source-dirs: ||s' is not good relative path: reserved character '|' +'hs-source-dirs: ../../assoc/src' is not good relative path: parent directory segment: .. From bf7be535c7ef31c691160ad12cdd28d30eb4ebed Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 5 Apr 2020 12:39:33 +0300 Subject: [PATCH 8/9] require cabal-versions >=1.25 to be exact --- .docker/validate-8.8.1.dockerfile | 2 +- Cabal/Distribution/CabalSpecVersion.hs | 68 ++++++++++++++----- .../PackageDescription/FieldGrammar.hs | 2 +- .../Distribution/PackageDescription/Parsec.hs | 5 +- .../PackageDescription/PrettyPrint.hs | 4 +- .../Distribution/Types/PackageDescription.hs | 2 +- Cabal/tests/HackageTests.hs | 60 +++++++++++++--- Cabal/tests/ParserTests/errors/common1.cabal | 2 +- Cabal/tests/ParserTests/errors/common1.errors | 2 +- Cabal/tests/ParserTests/errors/common2.cabal | 2 +- Cabal/tests/ParserTests/errors/common2.errors | 2 +- Cabal/tests/ParserTests/errors/common3.cabal | 2 +- Cabal/tests/ParserTests/errors/common3.errors | 2 +- .../ParserTests/errors/forward-compat2.cabal | 2 +- .../ParserTests/errors/forward-compat2.errors | 2 +- .../ParserTests/errors/forward-compat3.errors | 1 + .../ParserTests/errors/leading-comma-2c.cabal | 2 +- .../errors/leading-comma-2c.errors | 2 +- .../ParserTests/errors/removed-fields.cabal | 2 +- .../ParserTests/errors/removed-fields.errors | 2 +- .../ParserTests/errors/version-sets-1.cabal | 2 +- .../ParserTests/errors/version-sets-1.errors | 2 +- .../ParserTests/errors/version-sets-2.cabal | 2 +- .../ParserTests/errors/version-sets-2.errors | 2 +- .../ParserTests/errors/version-sets-3.cabal | 2 +- .../ParserTests/errors/version-sets-3.errors | 2 +- .../ParserTests/errors/version-sets-4.cabal | 2 +- .../ParserTests/errors/version-sets-4.errors | 2 +- .../ParserTests/regressions/Octree-0.5.expr | 2 +- .../ParserTests/regressions/big-version.expr | 2 +- .../regressions/common-conditional.cabal | 2 +- .../regressions/common-conditional.expr | 4 +- .../regressions/common-conditional.format | 2 +- .../tests/ParserTests/regressions/common.expr | 2 +- .../ParserTests/regressions/common2.cabal | 2 +- .../ParserTests/regressions/common2.expr | 4 +- .../ParserTests/regressions/common2.format | 2 +- .../ParserTests/regressions/common3.expr | 2 +- Cabal/tests/ParserTests/regressions/elif.expr | 2 +- .../tests/ParserTests/regressions/elif2.cabal | 2 +- .../tests/ParserTests/regressions/elif2.expr | 4 +- .../ParserTests/regressions/elif2.format | 2 +- .../ParserTests/regressions/encoding-0.8.expr | 2 +- .../ParserTests/regressions/generics-sop.expr | 2 +- .../regressions/hidden-main-lib.cabal | 2 +- .../regressions/hidden-main-lib.expr | 4 +- .../regressions/hidden-main-lib.format | 2 +- .../ParserTests/regressions/indentation.expr | 2 +- .../ParserTests/regressions/indentation2.expr | 2 +- .../ParserTests/regressions/indentation3.expr | 2 +- .../ParserTests/regressions/issue-5055.expr | 2 +- .../ParserTests/regressions/issue-5846.expr | 2 +- .../regressions/issue-6083-pkg-pkg.expr | 2 +- .../ParserTests/regressions/issue-774.expr | 2 +- .../regressions/jaeger-flamegraph.expr | 2 +- .../regressions/leading-comma-2.cabal | 2 +- .../regressions/leading-comma-2.expr | 4 +- .../regressions/leading-comma-2.format | 2 +- .../regressions/leading-comma.cabal | 2 +- .../regressions/leading-comma.expr | 4 +- .../regressions/leading-comma.format | 2 +- .../tests/ParserTests/regressions/libpq1.expr | 2 +- .../tests/ParserTests/regressions/libpq2.expr | 2 +- .../ParserTests/regressions/mixin-1.expr | 2 +- .../ParserTests/regressions/mixin-2.expr | 2 +- .../ParserTests/regressions/mixin-3.expr | 2 +- .../regressions/multiple-libs-2.expr | 2 +- .../ParserTests/regressions/noVersion.expr | 2 +- .../regressions/nothing-unicode.expr | 2 +- .../tests/ParserTests/regressions/shake.expr | 2 +- .../tests/ParserTests/regressions/spdx-1.expr | 2 +- .../tests/ParserTests/regressions/spdx-2.expr | 2 +- .../tests/ParserTests/regressions/spdx-3.expr | 2 +- .../regressions/th-lift-instances.expr | 2 +- .../regressions/version-sets.cabal | 2 +- .../ParserTests/regressions/version-sets.expr | 4 +- .../regressions/version-sets.format | 2 +- .../regressions/wl-pprint-indef.expr | 2 +- .../AutogenModules/Package/my.cabal | 2 +- .../PackageTests/Backpack/Fail1/Fail1.cabal | 2 +- .../PackageTests/Backpack/Fail2/Fail2.cabal | 2 +- .../PackageTests/Backpack/Fail3/Fail3.cabal | 2 +- .../Backpack/Includes1/Includes1.cabal | 2 +- .../Backpack/Includes2/Includes2.cabal | 2 +- .../Backpack/Includes2/Includes2.cabal.fail | 2 +- .../Backpack/Includes2/exe/exe.cabal | 2 +- .../Backpack/Includes2/mylib/mylib.cabal | 2 +- .../Backpack/Includes2/mysql/mysql.cabal | 2 +- .../Includes2/postgresql/postgresql.cabal | 2 +- .../Backpack/Includes2/src/src.cabal | 2 +- .../Backpack/Includes3/Includes3.cabal | 2 +- .../Includes3/repo/exe-0.1.0.0/exe.cabal | 2 +- .../Includes3/repo/indef-0.1.0.0/indef.cabal | 2 +- .../Includes3/repo/sigs-0.1.0.0/sigs.cabal | 2 +- .../Backpack/Includes4/Includes4.cabal | 2 +- .../Backpack/Includes5/Includes5.cabal | 2 +- .../PackageTests/Backpack/Indef1/Indef1.cabal | 2 +- .../PackageTests/Backpack/Indef2/Indef2.cabal | 2 +- .../PackageTests/Backpack/Reexport1/p/p.cabal | 2 +- .../Backpack/Reexport2/Reexport2.cabal | 2 +- .../Backpack/TemplateHaskell/bkpth.cabal | 2 +- .../PackageTests/COnlyMain/my.cabal | 2 +- .../PackageTests/CabalMacros/my.cabal | 16 +++++ .../PackageTests/CaretOperator/my.cabal | 2 +- .../PackageTests/PathsModule/Library/my.cabal | 2 +- cabal-testsuite/PackageTests/SPDX/my.cabal | 2 +- .../PackageTests/SimpleDefault/my.cabal | 2 +- 107 files changed, 233 insertions(+), 137 deletions(-) create mode 100644 cabal-testsuite/PackageTests/CabalMacros/my.cabal diff --git a/.docker/validate-8.8.1.dockerfile b/.docker/validate-8.8.1.dockerfile index 7f1d0172c29..367588eb3d9 100644 --- a/.docker/validate-8.8.1.dockerfile +++ b/.docker/validate-8.8.1.dockerfile @@ -56,4 +56,4 @@ RUN cabal v2-install -w ghc-8.8.1 --lib \ # Validate WORKDIR /build COPY . /build -RUN sh ./validate.sh -w ghc-8.8.1 -v --doctest --solver-benchmarks +RUN sh ./validate.sh -w ghc-8.8.1 -v --doctest --solver-benchmarks --complete-hackage-tests diff --git a/Cabal/Distribution/CabalSpecVersion.hs b/Cabal/Distribution/CabalSpecVersion.hs index f53d999ae66..e6a86864353 100644 --- a/Cabal/Distribution/CabalSpecVersion.hs +++ b/Cabal/Distribution/CabalSpecVersion.hs @@ -51,23 +51,59 @@ showCabalSpecVersion CabalSpecV1_0 = "1.0" cabalSpecLatest :: CabalSpecVersion cabalSpecLatest = CabalSpecV3_0 -cabalSpecFromVersionDigits :: [Int] -> CabalSpecVersion +cabalSpecFromVersionDigits :: [Int] -> Maybe CabalSpecVersion cabalSpecFromVersionDigits v - | v >= [2,5] = CabalSpecV3_0 - | v >= [2,3] = CabalSpecV2_4 - | v >= [2,1] = CabalSpecV2_2 - | v >= [1,25] = CabalSpecV2_0 - | v >= [1,23] = CabalSpecV1_24 - | v >= [1,21] = CabalSpecV1_22 - | v >= [1,19] = CabalSpecV1_20 - | v >= [1,17] = CabalSpecV1_18 - | v >= [1,11] = CabalSpecV1_12 - | v >= [1,9] = CabalSpecV1_10 - | v >= [1,7] = CabalSpecV1_8 - | v >= [1,5] = CabalSpecV1_6 - | v >= [1,3] = CabalSpecV1_4 - | v >= [1,1] = CabalSpecV1_2 - | otherwise = CabalSpecV1_0 + | v == [3,0] = Just CabalSpecV3_0 + | v == [2,4] = Just CabalSpecV2_4 + | v == [2,2] = Just CabalSpecV2_2 + | v == [2,0] = Just CabalSpecV2_0 + | v >= [1,25] = Nothing + | v >= [1,23] = Just CabalSpecV1_24 + | v >= [1,21] = Just CabalSpecV1_22 + | v >= [1,19] = Just CabalSpecV1_20 + | v >= [1,17] = Just CabalSpecV1_18 + | v >= [1,11] = Just CabalSpecV1_12 + | v >= [1,9] = Just CabalSpecV1_10 + | v >= [1,7] = Just CabalSpecV1_8 + | v >= [1,5] = Just CabalSpecV1_6 + | v >= [1,3] = Just CabalSpecV1_4 + | v >= [1,1] = Just CabalSpecV1_2 + | otherwise = Just CabalSpecV1_0 + +cabalSpecToVersionDigits :: CabalSpecVersion -> [Int] +cabalSpecToVersionDigits CabalSpecV3_0 = [3,0] +cabalSpecToVersionDigits CabalSpecV2_4 = [2,4] +cabalSpecToVersionDigits CabalSpecV2_2 = [2,2] +cabalSpecToVersionDigits CabalSpecV2_0 = [2,0] +cabalSpecToVersionDigits CabalSpecV1_24 = [1,24] +cabalSpecToVersionDigits CabalSpecV1_22 = [1,22] +cabalSpecToVersionDigits CabalSpecV1_20 = [1,20] +cabalSpecToVersionDigits CabalSpecV1_18 = [1,18] +cabalSpecToVersionDigits CabalSpecV1_12 = [1,12] +cabalSpecToVersionDigits CabalSpecV1_10 = [1,10] +cabalSpecToVersionDigits CabalSpecV1_8 = [1,8] +cabalSpecToVersionDigits CabalSpecV1_6 = [1,6] +cabalSpecToVersionDigits CabalSpecV1_4 = [1,4] +cabalSpecToVersionDigits CabalSpecV1_2 = [1,2] +cabalSpecToVersionDigits CabalSpecV1_0 = [1,0] + +-- | What is the minimum Cabal library version which knows how handle +-- this spec version. +-- +-- /Note:/ this is a point where we could decouple cabal-spec and Cabal +-- versions, if we ever want that. +-- +-- >>> cabalSpecMinimumLibraryVersion CabalSpecV3_0 +-- [2,5] +-- +-- >>> cabalSpecMinimumLibraryVersion CabalSpecV2_4 +-- [2,3] +-- +cabalSpecMinimumLibraryVersion :: CabalSpecVersion -> [Int] +cabalSpecMinimumLibraryVersion CabalSpecV1_0 = [1,0] +cabalSpecMinimumLibraryVersion csv = case cabalSpecToVersionDigits (pred csv) of + [x,y] -> [x, y+1] + xs -> xs specHasCommonStanzas :: CabalSpecVersion -> HasCommonStanzas specHasCommonStanzas v = diff --git a/Cabal/Distribution/PackageDescription/FieldGrammar.hs b/Cabal/Distribution/PackageDescription/FieldGrammar.hs index 2c6e8b4d121..7f72080361f 100644 --- a/Cabal/Distribution/PackageDescription/FieldGrammar.hs +++ b/Cabal/Distribution/PackageDescription/FieldGrammar.hs @@ -100,7 +100,7 @@ packageDescriptionFieldGrammar = PackageDescription <*> pure [] -- benchmarks -- * Files <*> monoidalFieldAla "data-files" (alaList' VCat FilePathNT) L.dataFiles - <*> optionalFieldDefAla "data-dir" FilePathNT L.dataDir "" + <*> optionalFieldDefAla "data-dir" FilePathNT L.dataDir "." <*> monoidalFieldAla "extra-source-files" (alaList' VCat FilePathNT) L.extraSrcFiles <*> monoidalFieldAla "extra-tmp-files" (alaList' VCat FilePathNT) L.extraTmpFiles <*> monoidalFieldAla "extra-doc-files" (alaList' VCat FilePathNT) L.extraDocFiles diff --git a/Cabal/Distribution/PackageDescription/Parsec.hs b/Cabal/Distribution/PackageDescription/Parsec.hs index 1c42c8a10d8..e27682eef0f 100644 --- a/Cabal/Distribution/PackageDescription/Parsec.hs +++ b/Cabal/Distribution/PackageDescription/Parsec.hs @@ -179,7 +179,10 @@ parseGenericPackageDescription' cabalVerM lexWarnings utf8WarnPos fs = do return v - let specVer = cabalSpecFromVersionDigits (versionNumbers cabalVer) + specVer <- case cabalSpecFromVersionDigits (versionNumbers cabalVer) of + Just csv -> return csv + Nothing -> parseFatalFailure zeroPos $ + "Unsupported cabal-version " ++ prettyShow cabalVer ++ ". See https://github.com/haskell/cabal/issues/4899." -- reset cabal version setCabalSpecVersion (Just cabalVer) diff --git a/Cabal/Distribution/PackageDescription/PrettyPrint.hs b/Cabal/Distribution/PackageDescription/PrettyPrint.hs index aed448bcbaa..77d558616ff 100644 --- a/Cabal/Distribution/PackageDescription/PrettyPrint.hs +++ b/Cabal/Distribution/PackageDescription/PrettyPrint.hs @@ -64,7 +64,9 @@ writeGenericPackageDescription fpath pkg = writeUTF8File fpath (showGenericPacka showGenericPackageDescription :: GenericPackageDescription -> String showGenericPackageDescription gpd = showFields (const []) $ ppGenericPackageDescription v gpd where - v = cabalSpecFromVersionDigits + v :: CabalSpecVersion + v = fromMaybe cabalSpecLatest + $ cabalSpecFromVersionDigits $ versionNumbers $ specVersion $ packageDescription gpd diff --git a/Cabal/Distribution/Types/PackageDescription.hs b/Cabal/Distribution/Types/PackageDescription.hs index a1f563be2b9..c27f49eb599 100644 --- a/Cabal/Distribution/Types/PackageDescription.hs +++ b/Cabal/Distribution/Types/PackageDescription.hs @@ -246,7 +246,7 @@ emptyPackageDescription testSuites = [], benchmarks = [], dataFiles = [], - dataDir = "", + dataDir = ".", extraSrcFiles = [], extraTmpFiles = [], extraDocFiles = [] diff --git a/Cabal/tests/HackageTests.hs b/Cabal/tests/HackageTests.hs index aae8beb0eec..f0d21febfd2 100644 --- a/Cabal/tests/HackageTests.hs +++ b/Cabal/tests/HackageTests.hs @@ -152,16 +152,47 @@ readFieldTest fpath bs = case Parsec.readFields bs' of -- Parsec test: whether we can parse everything ------------------------------------------------------------------------------- -parseParsecTest :: FilePath -> B.ByteString -> IO (Sum Int) -parseParsecTest fpath bs = do - let (_warnings, parsec) = Parsec.runParseResult $ - Parsec.parseGenericPackageDescription bs - case parsec of - Right _ -> return (Sum 1) - Left (_, errors) -> do +parseParsecTest :: Bool -> FilePath -> B.ByteString -> IO ParsecResult +parseParsecTest keepGoing fpath bs = do + let (warnings, result) = Parsec.runParseResult $ + Parsec.parseGenericPackageDescription bs + + let w | null warnings = 0 + | otherwise = 1 + + case result of + Right gpd -> do + forEachGPD fpath bs gpd + return (ParsecResult 1 w 0) + + Left (_, errors) | keepGoing -> do + traverse_ (putStrLn . Parsec.showPError fpath) errors + return (ParsecResult 1 w 1) + | otherwise -> do traverse_ (putStrLn . Parsec.showPError fpath) errors exitFailure +-- | A hook to make queries on Hackage +forEachGPD :: FilePath -> B8.ByteString -> L.GenericPackageDescription -> IO () +forEachGPD _ _ _ = return () + +------------------------------------------------------------------------------- +-- ParsecResult +------------------------------------------------------------------------------- + +data ParsecResult = ParsecResult !Int !Int !Int + deriving (Eq, Show) + +instance Semigroup ParsecResult where + ParsecResult x y z <> ParsecResult u v w = ParsecResult (x + u) (y + v) (z + w) + +instance Monoid ParsecResult where + mempty = ParsecResult 0 0 0 + mappend = (<>) + +instance NFData ParsecResult where + rnf (ParsecResult _ _ _) = () + ------------------------------------------------------------------------------- -- Check test ------------------------------------------------------------------------------- @@ -309,15 +340,22 @@ main = join (O.execParser opts) defaultA = do putStrLn "Default action: parsec k" - parsecA (mkPredicate ["k"]) + parsecA (mkPredicate ["k"]) False readFieldsP = readFieldsA <$> prefixP readFieldsA pfx = parseIndex pfx readFieldTest - parsecP = parsecA <$> prefixP - parsecA pfx = do - Sum n <- parseIndex pfx parseParsecTest + parsecP = parsecA <$> prefixP <*> keepGoingP + keepGoingP = + O.flag' True (O.long "keep-going") <|> + O.flag' False (O.long "no-keep-going") <|> + pure False + + parsecA pfx keepGoing = do + ParsecResult n w f <- parseIndex pfx (parseParsecTest keepGoing) putStrLn $ show n ++ " files processed" + putStrLn $ show w ++ " files contained warnings" + putStrLn $ show f ++ " files failed to parse" roundtripP = roundtripA <$> prefixP <*> testFieldsP roundtripA pfx testFieldsTransform = do diff --git a/Cabal/tests/ParserTests/errors/common1.cabal b/Cabal/tests/ParserTests/errors/common1.cabal index 7a3c3def607..7a346e66b90 100644 --- a/Cabal/tests/ParserTests/errors/common1.cabal +++ b/Cabal/tests/ParserTests/errors/common1.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: common version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/errors/common1.errors b/Cabal/tests/ParserTests/errors/common1.errors index 2e257e0c077..3da5139a90d 100644 --- a/Cabal/tests/ParserTests/errors/common1.errors +++ b/Cabal/tests/ParserTests/errors/common1.errors @@ -1,2 +1,2 @@ -VERSION: Just (mkVersion [2,1]) +VERSION: Just (mkVersion [2,2]) common1.cabal:17:3: Undefined common stanza imported: windo diff --git a/Cabal/tests/ParserTests/errors/common2.cabal b/Cabal/tests/ParserTests/errors/common2.cabal index fff797c2c88..9718449f8a5 100644 --- a/Cabal/tests/ParserTests/errors/common2.cabal +++ b/Cabal/tests/ParserTests/errors/common2.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: common version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/errors/common2.errors b/Cabal/tests/ParserTests/errors/common2.errors index 17b7d72dc99..3dc45b29dc5 100644 --- a/Cabal/tests/ParserTests/errors/common2.errors +++ b/Cabal/tests/ParserTests/errors/common2.errors @@ -1,2 +1,2 @@ -VERSION: Just (mkVersion [2,1]) +VERSION: Just (mkVersion [2,2]) common2.cabal:13:3: Undefined common stanza imported: windows diff --git a/Cabal/tests/ParserTests/errors/common3.cabal b/Cabal/tests/ParserTests/errors/common3.cabal index 3dedb63adbf..fb85ca5f054 100644 --- a/Cabal/tests/ParserTests/errors/common3.cabal +++ b/Cabal/tests/ParserTests/errors/common3.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: common version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/errors/common3.errors b/Cabal/tests/ParserTests/errors/common3.errors index db3cb5ee4cc..03153742955 100644 --- a/Cabal/tests/ParserTests/errors/common3.errors +++ b/Cabal/tests/ParserTests/errors/common3.errors @@ -1,2 +1,2 @@ -VERSION: Just (mkVersion [2,1]) +VERSION: Just (mkVersion [2,2]) common3.cabal:22:1: Duplicate common stanza: deps diff --git a/Cabal/tests/ParserTests/errors/forward-compat2.cabal b/Cabal/tests/ParserTests/errors/forward-compat2.cabal index 6784048251c..3f190b56e1b 100644 --- a/Cabal/tests/ParserTests/errors/forward-compat2.cabal +++ b/Cabal/tests/ParserTests/errors/forward-compat2.cabal @@ -2,7 +2,7 @@ name: common version: 0 synopsis: Common-stanza demo demo build-type: Simple -cabal-version: 2.1 +cabal-version: 2.2 source-repository head Type: git diff --git a/Cabal/tests/ParserTests/errors/forward-compat2.errors b/Cabal/tests/ParserTests/errors/forward-compat2.errors index 2cf006500b2..5270a2d53a3 100644 --- a/Cabal/tests/ParserTests/errors/forward-compat2.errors +++ b/Cabal/tests/ParserTests/errors/forward-compat2.errors @@ -1,2 +1,2 @@ -VERSION: Just (mkVersion [2,1]) +VERSION: Just (mkVersion [2,2]) forward-compat2.cabal:5:1: cabal-version should be at the beginning of the file starting with spec version 2.2. See https://github.com/haskell/cabal/issues/4899 diff --git a/Cabal/tests/ParserTests/errors/forward-compat3.errors b/Cabal/tests/ParserTests/errors/forward-compat3.errors index a7d3174a0bd..b64700427bf 100644 --- a/Cabal/tests/ParserTests/errors/forward-compat3.errors +++ b/Cabal/tests/ParserTests/errors/forward-compat3.errors @@ -1,2 +1,3 @@ VERSION: Just (mkVersion [99999,99]) +forward-compat3.cabal:0:0: Unsupported cabal-version 99999.99. See https://github.com/haskell/cabal/issues/4899. forward-compat3.cabal:0:0: Unsupported cabal-version. See https://github.com/haskell/cabal/issues/4899. diff --git a/Cabal/tests/ParserTests/errors/leading-comma-2c.cabal b/Cabal/tests/ParserTests/errors/leading-comma-2c.cabal index 7adf522bacb..42fb9a319ba 100644 --- a/Cabal/tests/ParserTests/errors/leading-comma-2c.cabal +++ b/Cabal/tests/ParserTests/errors/leading-comma-2c.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: leading-comma version: 0 synopsis: leading comma, trailing comma, or ordinary diff --git a/Cabal/tests/ParserTests/errors/leading-comma-2c.errors b/Cabal/tests/ParserTests/errors/leading-comma-2c.errors index b69d44bf5c6..dcc71927d9e 100644 --- a/Cabal/tests/ParserTests/errors/leading-comma-2c.errors +++ b/Cabal/tests/ParserTests/errors/leading-comma-2c.errors @@ -1,4 +1,4 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) leading-comma-2c.cabal:10:30: unexpected 'N' expecting space, comma, white space or end of input diff --git a/Cabal/tests/ParserTests/errors/removed-fields.cabal b/Cabal/tests/ParserTests/errors/removed-fields.cabal index dbee53f7544..aed6bdb2e1c 100644 --- a/Cabal/tests/ParserTests/errors/removed-fields.cabal +++ b/Cabal/tests/ParserTests/errors/removed-fields.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: removed-fields version: 0 synopsis: some fields are removed diff --git a/Cabal/tests/ParserTests/errors/removed-fields.errors b/Cabal/tests/ParserTests/errors/removed-fields.errors index e41a0aee826..17259790b2c 100644 --- a/Cabal/tests/ParserTests/errors/removed-fields.errors +++ b/Cabal/tests/ParserTests/errors/removed-fields.errors @@ -1,3 +1,3 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) removed-fields.cabal:13:3: The field "extensions" is removed in the Cabal specification version 3.0. Please use 'default-extensions' or 'other-extensions' fields. removed-fields.cabal:14:3: The field "extensions" is removed in the Cabal specification version 3.0. Please use 'default-extensions' or 'other-extensions' fields. diff --git a/Cabal/tests/ParserTests/errors/version-sets-1.cabal b/Cabal/tests/ParserTests/errors/version-sets-1.cabal index c6c73575953..5a4b3cc8bb1 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-1.cabal +++ b/Cabal/tests/ParserTests/errors/version-sets-1.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 synopsis: version set notation diff --git a/Cabal/tests/ParserTests/errors/version-sets-1.errors b/Cabal/tests/ParserTests/errors/version-sets-1.errors index 89a46ae14a8..408c5014806 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-1.errors +++ b/Cabal/tests/ParserTests/errors/version-sets-1.errors @@ -1,4 +1,4 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) version-sets-1.cabal:8:31: unexpected "}" expecting space or version digit (integral without leading zeroes) diff --git a/Cabal/tests/ParserTests/errors/version-sets-2.cabal b/Cabal/tests/ParserTests/errors/version-sets-2.cabal index 4b97a806929..db3436b6c99 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-2.cabal +++ b/Cabal/tests/ParserTests/errors/version-sets-2.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 synopsis: version set notation diff --git a/Cabal/tests/ParserTests/errors/version-sets-2.errors b/Cabal/tests/ParserTests/errors/version-sets-2.errors index c874909338c..e172c54dbae 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-2.errors +++ b/Cabal/tests/ParserTests/errors/version-sets-2.errors @@ -1,4 +1,4 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) version-sets-2.cabal:8:29: unexpected "{" expecting space or version digit (integral without leading zeroes) diff --git a/Cabal/tests/ParserTests/errors/version-sets-3.cabal b/Cabal/tests/ParserTests/errors/version-sets-3.cabal index 63e14da920f..2b6dc9c9367 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-3.cabal +++ b/Cabal/tests/ParserTests/errors/version-sets-3.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 synopsis: version set notation diff --git a/Cabal/tests/ParserTests/errors/version-sets-3.errors b/Cabal/tests/ParserTests/errors/version-sets-3.errors index 48aeabd8623..92f62998fcf 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-3.errors +++ b/Cabal/tests/ParserTests/errors/version-sets-3.errors @@ -1,4 +1,4 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) version-sets-3.cabal:8:40: unexpected "}" expecting space or version digit (integral without leading zeroes) diff --git a/Cabal/tests/ParserTests/errors/version-sets-4.cabal b/Cabal/tests/ParserTests/errors/version-sets-4.cabal index 76ce030bcb4..01a51305a70 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-4.cabal +++ b/Cabal/tests/ParserTests/errors/version-sets-4.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 synopsis: version set notation diff --git a/Cabal/tests/ParserTests/errors/version-sets-4.errors b/Cabal/tests/ParserTests/errors/version-sets-4.errors index c9554774c10..f3a838f9814 100644 --- a/Cabal/tests/ParserTests/errors/version-sets-4.errors +++ b/Cabal/tests/ParserTests/errors/version-sets-4.errors @@ -1,4 +1,4 @@ -VERSION: Just (mkVersion [2,5]) +VERSION: Just (mkVersion [3,0]) version-sets-4.cabal:8:35: unexpected "*" expecting version digit (integral without leading zeroes) diff --git a/Cabal/tests/ParserTests/regressions/Octree-0.5.expr b/Cabal/tests/ParserTests/regressions/Octree-0.5.expr index 97823233724..796adc008e9 100644 --- a/Cabal/tests/ParserTests/regressions/Octree-0.5.expr +++ b/Cabal/tests/ParserTests/regressions/Octree-0.5.expr @@ -292,7 +292,7 @@ GenericPackageDescription category = "Data", copyright = "Copyright by Michal J. Gajda '2012", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "Octree data structure is relatively shallow data structure for space partitioning.", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/big-version.expr b/Cabal/tests/ParserTests/regressions/big-version.expr index b0f67fad70f..7ad39d01998 100644 --- a/Cabal/tests/ParserTests/regressions/big-version.expr +++ b/Cabal/tests/ParserTests/regressions/big-version.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/common-conditional.cabal b/Cabal/tests/ParserTests/regressions/common-conditional.cabal index 502cb0b8142..cc799d32d1b 100644 --- a/Cabal/tests/ParserTests/regressions/common-conditional.cabal +++ b/Cabal/tests/ParserTests/regressions/common-conditional.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.6 +cabal-version: 3.0 name: common-conditional version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/regressions/common-conditional.expr b/Cabal/tests/ParserTests/regressions/common-conditional.expr index 50d2560f7de..e504aac413d 100644 --- a/Cabal/tests/ParserTests/regressions/common-conditional.expr +++ b/Cabal/tests/ParserTests/regressions/common-conditional.expr @@ -599,7 +599,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -625,7 +625,7 @@ GenericPackageDescription repoSubdir = Nothing, repoTag = Nothing, repoType = Just Git}], - specVersionRaw = Left `mkVersion [2,6]`, + specVersionRaw = Left `mkVersion [3,0]`, stability = "", subLibraries = [], synopsis = "Common-stanza demo demo", diff --git a/Cabal/tests/ParserTests/regressions/common-conditional.format b/Cabal/tests/ParserTests/regressions/common-conditional.format index ab0a308c7e2..5a9cdd13b6a 100644 --- a/Cabal/tests/ParserTests/regressions/common-conditional.format +++ b/Cabal/tests/ParserTests/regressions/common-conditional.format @@ -1,4 +1,4 @@ -cabal-version: 2.6 +cabal-version: 3.0 name: common-conditional version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/regressions/common.expr b/Cabal/tests/ParserTests/regressions/common.expr index 7408732f7b3..f04207769a3 100644 --- a/Cabal/tests/ParserTests/regressions/common.expr +++ b/Cabal/tests/ParserTests/regressions/common.expr @@ -138,7 +138,7 @@ GenericPackageDescription copyright = "", customFieldsPD = [_×_ "x-revision" "1", _×_ "x-follows-version-policy" ""], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/common2.cabal b/Cabal/tests/ParserTests/regressions/common2.cabal index 0b63fdaf87c..0d9b9059947 100644 --- a/Cabal/tests/ParserTests/regressions/common2.cabal +++ b/Cabal/tests/ParserTests/regressions/common2.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: common version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/regressions/common2.expr b/Cabal/tests/ParserTests/regressions/common2.expr index c62cc295410..dcf95d537c8 100644 --- a/Cabal/tests/ParserTests/regressions/common2.expr +++ b/Cabal/tests/ParserTests/regressions/common2.expr @@ -627,7 +627,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -653,7 +653,7 @@ GenericPackageDescription repoSubdir = Nothing, repoTag = Nothing, repoType = Just Git}], - specVersionRaw = Left `mkVersion [2,1]`, + specVersionRaw = Left `mkVersion [2,2]`, stability = "", subLibraries = [], synopsis = "Common-stanza demo demo", diff --git a/Cabal/tests/ParserTests/regressions/common2.format b/Cabal/tests/ParserTests/regressions/common2.format index f18ec7e361c..ba1434c24b7 100644 --- a/Cabal/tests/ParserTests/regressions/common2.format +++ b/Cabal/tests/ParserTests/regressions/common2.format @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: common version: 0 synopsis: Common-stanza demo demo diff --git a/Cabal/tests/ParserTests/regressions/common3.expr b/Cabal/tests/ParserTests/regressions/common3.expr index 3e0ed2d5867..f22c007e52a 100644 --- a/Cabal/tests/ParserTests/regressions/common3.expr +++ b/Cabal/tests/ParserTests/regressions/common3.expr @@ -162,7 +162,7 @@ GenericPackageDescription copyright = "", customFieldsPD = [_×_ "x-revision" "1", _×_ "x-follows-version-policy" ""], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/elif.expr b/Cabal/tests/ParserTests/regressions/elif.expr index fe0d1195668..faaa6e96390 100644 --- a/Cabal/tests/ParserTests/regressions/elif.expr +++ b/Cabal/tests/ParserTests/regressions/elif.expr @@ -140,7 +140,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/elif2.cabal b/Cabal/tests/ParserTests/regressions/elif2.cabal index 46185b0ae3b..88c39d62128 100644 --- a/Cabal/tests/ParserTests/regressions/elif2.cabal +++ b/Cabal/tests/ParserTests/regressions/elif2.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: elif version: 0 synopsis: The elif demo diff --git a/Cabal/tests/ParserTests/regressions/elif2.expr b/Cabal/tests/ParserTests/regressions/elif2.expr index 3de829c72d6..3a167efb58e 100644 --- a/Cabal/tests/ParserTests/regressions/elif2.expr +++ b/Cabal/tests/ParserTests/regressions/elif2.expr @@ -336,7 +336,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -362,7 +362,7 @@ GenericPackageDescription repoSubdir = Nothing, repoTag = Nothing, repoType = Just Git}], - specVersionRaw = Left `mkVersion [2,1]`, + specVersionRaw = Left `mkVersion [2,2]`, stability = "", subLibraries = [], synopsis = "The elif demo", diff --git a/Cabal/tests/ParserTests/regressions/elif2.format b/Cabal/tests/ParserTests/regressions/elif2.format index 615b4d26e63..b888676e14b 100644 --- a/Cabal/tests/ParserTests/regressions/elif2.format +++ b/Cabal/tests/ParserTests/regressions/elif2.format @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: elif version: 0 synopsis: The elif demo diff --git a/Cabal/tests/ParserTests/regressions/encoding-0.8.expr b/Cabal/tests/ParserTests/regressions/encoding-0.8.expr index 32fc912232e..56c03e75431 100644 --- a/Cabal/tests/ParserTests/regressions/encoding-0.8.expr +++ b/Cabal/tests/ParserTests/regressions/encoding-0.8.expr @@ -89,7 +89,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/generics-sop.expr b/Cabal/tests/ParserTests/regressions/generics-sop.expr index 299c14c3a80..37300615c59 100644 --- a/Cabal/tests/ParserTests/regressions/generics-sop.expr +++ b/Cabal/tests/ParserTests/regressions/generics-sop.expr @@ -655,7 +655,7 @@ GenericPackageDescription category = "Generics", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["A library to support the definition of generic functions.\n", diff --git a/Cabal/tests/ParserTests/regressions/hidden-main-lib.cabal b/Cabal/tests/ParserTests/regressions/hidden-main-lib.cabal index 94bb17ef817..ccbab3f513f 100644 --- a/Cabal/tests/ParserTests/regressions/hidden-main-lib.cabal +++ b/Cabal/tests/ParserTests/regressions/hidden-main-lib.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: hidden-main-lib version: 0 synopsis: main lib have to be visible diff --git a/Cabal/tests/ParserTests/regressions/hidden-main-lib.expr b/Cabal/tests/ParserTests/regressions/hidden-main-lib.expr index 656549e5bfe..d89bd1330f4 100644 --- a/Cabal/tests/ParserTests/regressions/hidden-main-lib.expr +++ b/Cabal/tests/ParserTests/regressions/hidden-main-lib.expr @@ -75,7 +75,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -94,7 +94,7 @@ GenericPackageDescription pkgUrl = "", setupBuildInfo = Nothing, sourceRepos = [], - specVersionRaw = Left `mkVersion [2,5]`, + specVersionRaw = Left `mkVersion [3,0]`, stability = "", subLibraries = [], synopsis = "main lib have to be visible", diff --git a/Cabal/tests/ParserTests/regressions/hidden-main-lib.format b/Cabal/tests/ParserTests/regressions/hidden-main-lib.format index a040f606987..62aeecaa190 100644 --- a/Cabal/tests/ParserTests/regressions/hidden-main-lib.format +++ b/Cabal/tests/ParserTests/regressions/hidden-main-lib.format @@ -1,5 +1,5 @@ hidden-main-lib.cabal:11:3: Unknown field: "visibility" -cabal-version: 2.5 +cabal-version: 3.0 name: hidden-main-lib version: 0 synopsis: main lib have to be visible diff --git a/Cabal/tests/ParserTests/regressions/indentation.expr b/Cabal/tests/ParserTests/regressions/indentation.expr index 138bfb272fc..c41cc3500a0 100644 --- a/Cabal/tests/ParserTests/regressions/indentation.expr +++ b/Cabal/tests/ParserTests/regressions/indentation.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["* foo\n", diff --git a/Cabal/tests/ParserTests/regressions/indentation2.expr b/Cabal/tests/ParserTests/regressions/indentation2.expr index c017bb44fad..f60af291235 100644 --- a/Cabal/tests/ParserTests/regressions/indentation2.expr +++ b/Cabal/tests/ParserTests/regressions/indentation2.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["foo\n", " indent2\n", " indent4"], executables = [], diff --git a/Cabal/tests/ParserTests/regressions/indentation3.expr b/Cabal/tests/ParserTests/regressions/indentation3.expr index cbe7d26d0c3..4bfd2747de1 100644 --- a/Cabal/tests/ParserTests/regressions/indentation3.expr +++ b/Cabal/tests/ParserTests/regressions/indentation3.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["indent0\n", diff --git a/Cabal/tests/ParserTests/regressions/issue-5055.expr b/Cabal/tests/ParserTests/regressions/issue-5055.expr index a4bea5c8a29..40b7d8415a2 100644 --- a/Cabal/tests/ParserTests/regressions/issue-5055.expr +++ b/Cabal/tests/ParserTests/regressions/issue-5055.expr @@ -210,7 +210,7 @@ GenericPackageDescription category = "Test", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "no type in all branches.", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/issue-5846.expr b/Cabal/tests/ParserTests/regressions/issue-5846.expr index 6b2b7f707ea..e290d4fd460 100644 --- a/Cabal/tests/ParserTests/regressions/issue-5846.expr +++ b/Cabal/tests/ParserTests/regressions/issue-5846.expr @@ -118,7 +118,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr b/Cabal/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr index 9192103977f..67c7617b54c 100644 --- a/Cabal/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr +++ b/Cabal/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr @@ -84,7 +84,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/issue-774.expr b/Cabal/tests/ParserTests/regressions/issue-774.expr index 1b27a8cf0b6..af25bc57260 100644 --- a/Cabal/tests/ParserTests/regressions/issue-774.expr +++ b/Cabal/tests/ParserTests/regressions/issue-774.expr @@ -73,7 +73,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["Here is some C code:\n", diff --git a/Cabal/tests/ParserTests/regressions/jaeger-flamegraph.expr b/Cabal/tests/ParserTests/regressions/jaeger-flamegraph.expr index eeb49511f54..d48b4ffadbd 100644 --- a/Cabal/tests/ParserTests/regressions/jaeger-flamegraph.expr +++ b/Cabal/tests/ParserTests/regressions/jaeger-flamegraph.expr @@ -343,7 +343,7 @@ GenericPackageDescription category = "Testing", copyright = "(c) 2018 Symbiont.io", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["This is a small tool to convert JSON dumps obtained from a Jaeger\n", diff --git a/Cabal/tests/ParserTests/regressions/leading-comma-2.cabal b/Cabal/tests/ParserTests/regressions/leading-comma-2.cabal index f128f862c97..d352d605553 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma-2.cabal +++ b/Cabal/tests/ParserTests/regressions/leading-comma-2.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: leading-comma version: 0 synopsis: leading comma, trailing comma, or ordinary diff --git a/Cabal/tests/ParserTests/regressions/leading-comma-2.expr b/Cabal/tests/ParserTests/regressions/leading-comma-2.expr index 44b54cbdc64..6d08cbf3b00 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma-2.expr +++ b/Cabal/tests/ParserTests/regressions/leading-comma-2.expr @@ -127,7 +127,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -146,7 +146,7 @@ GenericPackageDescription pkgUrl = "", setupBuildInfo = Nothing, sourceRepos = [], - specVersionRaw = Left `mkVersion [2,5]`, + specVersionRaw = Left `mkVersion [3,0]`, stability = "", subLibraries = [], synopsis = "leading comma, trailing comma, or ordinary", diff --git a/Cabal/tests/ParserTests/regressions/leading-comma-2.format b/Cabal/tests/ParserTests/regressions/leading-comma-2.format index 0bfdf0fe6d8..e69731528c0 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma-2.format +++ b/Cabal/tests/ParserTests/regressions/leading-comma-2.format @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: leading-comma version: 0 synopsis: leading comma, trailing comma, or ordinary diff --git a/Cabal/tests/ParserTests/regressions/leading-comma.cabal b/Cabal/tests/ParserTests/regressions/leading-comma.cabal index 0c407a79947..fcafa34b3e3 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma.cabal +++ b/Cabal/tests/ParserTests/regressions/leading-comma.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: leading-comma version: 0 synopsis: leading comma, trailing comma, or ordinary diff --git a/Cabal/tests/ParserTests/regressions/leading-comma.expr b/Cabal/tests/ParserTests/regressions/leading-comma.expr index 7548ac5cb00..fc5769de438 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma.expr +++ b/Cabal/tests/ParserTests/regressions/leading-comma.expr @@ -120,7 +120,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -139,7 +139,7 @@ GenericPackageDescription pkgUrl = "", setupBuildInfo = Nothing, sourceRepos = [], - specVersionRaw = Left `mkVersion [2,1]`, + specVersionRaw = Left `mkVersion [2,2]`, stability = "", subLibraries = [], synopsis = "leading comma, trailing comma, or ordinary", diff --git a/Cabal/tests/ParserTests/regressions/leading-comma.format b/Cabal/tests/ParserTests/regressions/leading-comma.format index da805109807..b842c0e7bd9 100644 --- a/Cabal/tests/ParserTests/regressions/leading-comma.format +++ b/Cabal/tests/ParserTests/regressions/leading-comma.format @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: leading-comma version: 0 synopsis: leading comma, trailing comma, or ordinary diff --git a/Cabal/tests/ParserTests/regressions/libpq1.expr b/Cabal/tests/ParserTests/regressions/libpq1.expr index 1fa3f47d470..ef4823df0f5 100644 --- a/Cabal/tests/ParserTests/regressions/libpq1.expr +++ b/Cabal/tests/ParserTests/regressions/libpq1.expr @@ -581,7 +581,7 @@ GenericPackageDescription copyright = concat ["(c) 2010 Grant Monroe\n", "(c) 2011 Leon P Smith"], customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["This is a binding to libpq: the C application\n", diff --git a/Cabal/tests/ParserTests/regressions/libpq2.expr b/Cabal/tests/ParserTests/regressions/libpq2.expr index 2aa2cff8ec3..7cfd50be93a 100644 --- a/Cabal/tests/ParserTests/regressions/libpq2.expr +++ b/Cabal/tests/ParserTests/regressions/libpq2.expr @@ -581,7 +581,7 @@ GenericPackageDescription copyright = concat ["(c) 2010 Grant Monroe\n", "(c) 2011 Leon P Smith"], customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["This is a binding to libpq: the C application\n", diff --git a/Cabal/tests/ParserTests/regressions/mixin-1.expr b/Cabal/tests/ParserTests/regressions/mixin-1.expr index 3df491d5da8..21d25aa120e 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal/tests/ParserTests/regressions/mixin-1.expr @@ -92,7 +92,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/mixin-2.expr b/Cabal/tests/ParserTests/regressions/mixin-2.expr index 9baa2b18908..253fa912fc5 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-2.expr +++ b/Cabal/tests/ParserTests/regressions/mixin-2.expr @@ -92,7 +92,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/mixin-3.expr b/Cabal/tests/ParserTests/regressions/mixin-3.expr index c0bf4c03bd3..9013721467c 100644 --- a/Cabal/tests/ParserTests/regressions/mixin-3.expr +++ b/Cabal/tests/ParserTests/regressions/mixin-3.expr @@ -91,7 +91,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/multiple-libs-2.expr b/Cabal/tests/ParserTests/regressions/multiple-libs-2.expr index 55b3d0acdc3..480bd094460 100644 --- a/Cabal/tests/ParserTests/regressions/multiple-libs-2.expr +++ b/Cabal/tests/ParserTests/regressions/multiple-libs-2.expr @@ -140,7 +140,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/noVersion.expr b/Cabal/tests/ParserTests/regressions/noVersion.expr index 80e2d4c7b35..a2cb159f031 100644 --- a/Cabal/tests/ParserTests/regressions/noVersion.expr +++ b/Cabal/tests/ParserTests/regressions/noVersion.expr @@ -81,7 +81,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/nothing-unicode.expr b/Cabal/tests/ParserTests/regressions/nothing-unicode.expr index 96e2ed49a29..f56ab8f40a5 100644 --- a/Cabal/tests/ParserTests/regressions/nothing-unicode.expr +++ b/Cabal/tests/ParserTests/regressions/nothing-unicode.expr @@ -136,7 +136,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [_×_ "x-\28961" "\28961"], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/shake.expr b/Cabal/tests/ParserTests/regressions/shake.expr index c67b75f07de..0a87c920f64 100644 --- a/Cabal/tests/ParserTests/regressions/shake.expr +++ b/Cabal/tests/ParserTests/regressions/shake.expr @@ -2059,7 +2059,7 @@ GenericPackageDescription category = "Development, Shake", copyright = "Neil Mitchell 2011-2017", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = ["html/viz.js", "html/profile.html", "html/progress.html", diff --git a/Cabal/tests/ParserTests/regressions/spdx-1.expr b/Cabal/tests/ParserTests/regressions/spdx-1.expr index c1c45218a2b..158a361ae20 100644 --- a/Cabal/tests/ParserTests/regressions/spdx-1.expr +++ b/Cabal/tests/ParserTests/regressions/spdx-1.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/spdx-2.expr b/Cabal/tests/ParserTests/regressions/spdx-2.expr index 3beaa44ce13..07863c6d476 100644 --- a/Cabal/tests/ParserTests/regressions/spdx-2.expr +++ b/Cabal/tests/ParserTests/regressions/spdx-2.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/spdx-3.expr b/Cabal/tests/ParserTests/regressions/spdx-3.expr index 9120fa0fad8..4b5eee8b1b1 100644 --- a/Cabal/tests/ParserTests/regressions/spdx-3.expr +++ b/Cabal/tests/ParserTests/regressions/spdx-3.expr @@ -68,7 +68,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], diff --git a/Cabal/tests/ParserTests/regressions/th-lift-instances.expr b/Cabal/tests/ParserTests/regressions/th-lift-instances.expr index af9d3025d3f..9e699b5e325 100644 --- a/Cabal/tests/ParserTests/regressions/th-lift-instances.expr +++ b/Cabal/tests/ParserTests/regressions/th-lift-instances.expr @@ -476,7 +476,7 @@ GenericPackageDescription category = "Template Haskell", copyright = "Copyright (C) 2013-2014 Benno F\252nfst\252ck", customFieldsPD = [_×_ "x-revision" "1"], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["Most data types in haskell platform do not have Lift instances. This package provides orphan instances\n", diff --git a/Cabal/tests/ParserTests/regressions/version-sets.cabal b/Cabal/tests/ParserTests/regressions/version-sets.cabal index 62c6198bad0..6dedbe79819 100644 --- a/Cabal/tests/ParserTests/regressions/version-sets.cabal +++ b/Cabal/tests/ParserTests/regressions/version-sets.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 synopsis: version set notation diff --git a/Cabal/tests/ParserTests/regressions/version-sets.expr b/Cabal/tests/ParserTests/regressions/version-sets.expr index a1159fb210d..b01ecf149b8 100644 --- a/Cabal/tests/ParserTests/regressions/version-sets.expr +++ b/Cabal/tests/ParserTests/regressions/version-sets.expr @@ -198,7 +198,7 @@ GenericPackageDescription category = "", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = "", executables = [], @@ -217,7 +217,7 @@ GenericPackageDescription pkgUrl = "", setupBuildInfo = Nothing, sourceRepos = [], - specVersionRaw = Left `mkVersion [2,5]`, + specVersionRaw = Left `mkVersion [3,0]`, stability = "", subLibraries = [], synopsis = "version set notation", diff --git a/Cabal/tests/ParserTests/regressions/version-sets.format b/Cabal/tests/ParserTests/regressions/version-sets.format index 7d665198e20..63a321583f1 100644 --- a/Cabal/tests/ParserTests/regressions/version-sets.format +++ b/Cabal/tests/ParserTests/regressions/version-sets.format @@ -1,4 +1,4 @@ -cabal-version: 2.5 +cabal-version: 3.0 name: version-sets version: 0 tested-with: diff --git a/Cabal/tests/ParserTests/regressions/wl-pprint-indef.expr b/Cabal/tests/ParserTests/regressions/wl-pprint-indef.expr index 941c90e1f4e..12d2444cddb 100644 --- a/Cabal/tests/ParserTests/regressions/wl-pprint-indef.expr +++ b/Cabal/tests/ParserTests/regressions/wl-pprint-indef.expr @@ -165,7 +165,7 @@ GenericPackageDescription category = "Text", copyright = "", customFieldsPD = [], - dataDir = "", + dataDir = ".", dataFiles = [], description = concat ["This is a pretty printing library based on Wadler's paper \"A Prettier\n", diff --git a/cabal-testsuite/PackageTests/AutogenModules/Package/my.cabal b/cabal-testsuite/PackageTests/AutogenModules/Package/my.cabal index 28fa4a32935..4119742ce24 100644 --- a/cabal-testsuite/PackageTests/AutogenModules/Package/my.cabal +++ b/cabal-testsuite/PackageTests/AutogenModules/Package/my.cabal @@ -7,7 +7,7 @@ maintainer: Federico Mastellone synopsis: AutogenModules category: PackageTests build-type: Simple -cabal-version: 1.25 +cabal-version: 2.0 description: Check that Cabal recognizes the autogen-modules fields below. diff --git a/cabal-testsuite/PackageTests/Backpack/Fail1/Fail1.cabal b/cabal-testsuite/PackageTests/Backpack/Fail1/Fail1.cabal index 83204e52e90..aaeb0b2d31b 100644 --- a/cabal-testsuite/PackageTests/Backpack/Fail1/Fail1.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Fail1/Fail1.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library sig signatures: A diff --git a/cabal-testsuite/PackageTests/Backpack/Fail2/Fail2.cabal b/cabal-testsuite/PackageTests/Backpack/Fail2/Fail2.cabal index e23f12ff040..4a0ae7e5855 100644 --- a/cabal-testsuite/PackageTests/Backpack/Fail2/Fail2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Fail2/Fail2.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library mixins: non-existent diff --git a/cabal-testsuite/PackageTests/Backpack/Fail3/Fail3.cabal b/cabal-testsuite/PackageTests/Backpack/Fail3/Fail3.cabal index b8489defcc4..5f42befc16b 100644 --- a/cabal-testsuite/PackageTests/Backpack/Fail3/Fail3.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Fail3/Fail3.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library signatures: UnfilledSig diff --git a/cabal-testsuite/PackageTests/Backpack/Includes1/Includes1.cabal b/cabal-testsuite/PackageTests/Backpack/Includes1/Includes1.cabal index 2d3d0c4baa7..0ec3b271c1a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes1/Includes1.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes1/Includes1.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base, containers diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal index 0c07c997d8d..7a02fcd961c 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library mylib build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail index dc3f65745fe..e0a014fae46 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: >=2.0 library mylib build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/exe/exe.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/exe/exe.cabal index 707ea843e4c..cb3873d055a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/exe/exe.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/exe/exe.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 executable exe build-depends: base, src diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/mylib/mylib.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/mylib/mylib.cabal index cc0e3e3ec28..d057cfa7e59 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/mylib/mylib.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/mylib/mylib.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/mysql/mysql.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/mysql/mysql.cabal index bb331f5c836..de4f284b8fe 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/mysql/mysql.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/mysql/mysql.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/postgresql/postgresql.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/postgresql/postgresql.cabal index 1ba91f5d81b..4e8d37561e7 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/postgresql/postgresql.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/postgresql/postgresql.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/src/src.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/src/src.cabal index 3371a3c6df1..5bd7f7a08b4 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/src/src.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/src/src.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base, mysql, postgresql, mylib diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal index 9bd96154738..7016e221218 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: 1.25 +cabal-version: 2.0 library sigs build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/exe-0.1.0.0/exe.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/exe-0.1.0.0/exe.cabal index 2422fffc031..2896d952e08 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/exe-0.1.0.0/exe.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/exe-0.1.0.0/exe.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 executable exe build-depends: base, containers, indef diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/indef-0.1.0.0/indef.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/indef-0.1.0.0/indef.cabal index 625ff165caa..1281fd7231e 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/indef-0.1.0.0/indef.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/indef-0.1.0.0/indef.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base, sigs diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/sigs-0.1.0.0/sigs.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/sigs-0.1.0.0/sigs.cabal index d1bbb828597..0d7d1fb50ad 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/repo/sigs-0.1.0.0/sigs.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/repo/sigs-0.1.0.0/sigs.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes4/Includes4.cabal b/cabal-testsuite/PackageTests/Backpack/Includes4/Includes4.cabal index ea7b01d4fe2..022c44d16ce 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes4/Includes4.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes4/Includes4.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library indef build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Includes5/Includes5.cabal b/cabal-testsuite/PackageTests/Backpack/Includes5/Includes5.cabal index a4b2530a873..4f3c08cf69a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes5/Includes5.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes5/Includes5.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library impl build-depends: base diff --git a/cabal-testsuite/PackageTests/Backpack/Indef1/Indef1.cabal b/cabal-testsuite/PackageTests/Backpack/Indef1/Indef1.cabal index c2828f72cfd..1b0392a0070 100644 --- a/cabal-testsuite/PackageTests/Backpack/Indef1/Indef1.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Indef1/Indef1.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library exposed-modules: Provide diff --git a/cabal-testsuite/PackageTests/Backpack/Indef2/Indef2.cabal b/cabal-testsuite/PackageTests/Backpack/Indef2/Indef2.cabal index 880230fec36..015310e3384 100644 --- a/cabal-testsuite/PackageTests/Backpack/Indef2/Indef2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Indef2/Indef2.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library asig1 signatures: A diff --git a/cabal-testsuite/PackageTests/Backpack/Reexport1/p/p.cabal b/cabal-testsuite/PackageTests/Backpack/Reexport1/p/p.cabal index 0d629cb80d8..59a7c86526a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Reexport1/p/p.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Reexport1/p/p.cabal @@ -4,7 +4,7 @@ license: BSD3 author: Edward Z. Yang maintainer: ezyang@cs.stanford.edu build-type: Simple -cabal-version: >=1.25 +cabal-version: 2.0 library mixins: containers (Data.Map as Map) diff --git a/cabal-testsuite/PackageTests/Backpack/Reexport2/Reexport2.cabal b/cabal-testsuite/PackageTests/Backpack/Reexport2/Reexport2.cabal index 8766663559b..25e1b515d67 100644 --- a/cabal-testsuite/PackageTests/Backpack/Reexport2/Reexport2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Reexport2/Reexport2.cabal @@ -1,7 +1,7 @@ name: Reexport2 version: 1.0 build-type: Simple -cabal-version: >= 1.25 +cabal-version: 2.0 library signatures: Asdf diff --git a/cabal-testsuite/PackageTests/Backpack/TemplateHaskell/bkpth.cabal b/cabal-testsuite/PackageTests/Backpack/TemplateHaskell/bkpth.cabal index 21d8ce3e37f..284553105e1 100644 --- a/cabal-testsuite/PackageTests/Backpack/TemplateHaskell/bkpth.cabal +++ b/cabal-testsuite/PackageTests/Backpack/TemplateHaskell/bkpth.cabal @@ -1,7 +1,7 @@ name: bkpth version: 1.0 build-type: Simple -cabal-version: >= 1.25 +cabal-version: 2.0 library helper signatures: A diff --git a/cabal-testsuite/PackageTests/COnlyMain/my.cabal b/cabal-testsuite/PackageTests/COnlyMain/my.cabal index af207340620..ccfe1e9e17f 100644 --- a/cabal-testsuite/PackageTests/COnlyMain/my.cabal +++ b/cabal-testsuite/PackageTests/COnlyMain/my.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: my version: 0.1 license: BSD-3-Clause diff --git a/cabal-testsuite/PackageTests/CabalMacros/my.cabal b/cabal-testsuite/PackageTests/CabalMacros/my.cabal new file mode 100644 index 00000000000..0ed91e08613 --- /dev/null +++ b/cabal-testsuite/PackageTests/CabalMacros/my.cabal @@ -0,0 +1,16 @@ +cabal-version: 2.2 +name: CabalMacros +version: 0.1 +license: BSD-3-Clause +author: Oleg Grenrus +stability: stable +category: PackageTests +build-type: Simple + +description: + Check that the generated cabal_macros.h is intact. + +Library + exposed-modules: Mdl + build-depends: base + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CaretOperator/my.cabal b/cabal-testsuite/PackageTests/CaretOperator/my.cabal index d61eb6084aa..fabb58493b3 100644 --- a/cabal-testsuite/PackageTests/CaretOperator/my.cabal +++ b/cabal-testsuite/PackageTests/CaretOperator/my.cabal @@ -4,7 +4,7 @@ license: BSD3 author: HVR category: PackageTests build-type: Simple -cabal-version: >= 1.25 +cabal-version: 2.0 description: Check that Cabal recognizes the caret operator diff --git a/cabal-testsuite/PackageTests/PathsModule/Library/my.cabal b/cabal-testsuite/PackageTests/PathsModule/Library/my.cabal index 4eb489be6d0..5260d9cbd5c 100644 --- a/cabal-testsuite/PackageTests/PathsModule/Library/my.cabal +++ b/cabal-testsuite/PackageTests/PathsModule/Library/my.cabal @@ -1,4 +1,4 @@ -Cabal-version: 2.1 +Cabal-version: 2.2 name: PathsModule version: 0.1 license: BSD-3-Clause diff --git a/cabal-testsuite/PackageTests/SPDX/my.cabal b/cabal-testsuite/PackageTests/SPDX/my.cabal index 9b90fb30d36..a6fafa4cfc2 100644 --- a/cabal-testsuite/PackageTests/SPDX/my.cabal +++ b/cabal-testsuite/PackageTests/SPDX/my.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: my version: 0 build-type: Simple diff --git a/cabal-testsuite/PackageTests/SimpleDefault/my.cabal b/cabal-testsuite/PackageTests/SimpleDefault/my.cabal index 5dd8aeb8087..7840f18e88f 100644 --- a/cabal-testsuite/PackageTests/SimpleDefault/my.cabal +++ b/cabal-testsuite/PackageTests/SimpleDefault/my.cabal @@ -1,4 +1,4 @@ -cabal-version: 2.1 +cabal-version: 2.2 name: my version: 0 -- tests whether the default is `build-type: Simple` From 3ccf5ba4833a7bda13e3a36d65ebd1ad668fadf4 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Sun, 25 Oct 2020 16:23:32 +0200 Subject: [PATCH 9/9] Use actions/checkout@v2 --- .github/workflows/linux.yml | 170 +++++++++++++++++++++++------------- boot/ci-linux.template.yml | 17 ++-- 2 files changed, 121 insertions(+), 66 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 296f9db6399..e63fed5fbc2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,6 +30,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -41,12 +46,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.10.1 -v -s print-config - name: Validate print-tool-versions @@ -73,6 +78,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -84,12 +94,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.8.3 -v --solver-benchmarks -s print-config - name: Validate print-tool-versions @@ -117,6 +127,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -128,12 +143,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.6.5 -v --complete-hackage-tests -s print-config - name: Validate print-tool-versions @@ -161,6 +176,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -172,12 +192,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.4.4 -v -s print-config - name: Validate print-tool-versions @@ -205,6 +225,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -216,12 +241,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.2.2 -v -s print-config - name: Validate print-tool-versions @@ -249,6 +274,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -260,12 +290,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.0.2 -v -s print-config - name: Validate print-tool-versions @@ -293,6 +323,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -304,12 +339,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-7.10.3 -v -s print-config - name: Validate print-tool-versions @@ -337,6 +372,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -348,12 +388,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-7.8.4 -v --lib-only -s print-config - name: Validate print-tool-versions @@ -375,6 +415,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -390,12 +435,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-7.6.3 -v --lib-only -s print-config - name: Validate print-tool-versions @@ -417,6 +462,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -434,12 +484,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) - name: Validate print-config run: sh validate.sh -j 2 -w ghc-8.8.3 -v --lib-only -s print-config - name: Validate print-tool-versions diff --git a/boot/ci-linux.template.yml b/boot/ci-linux.template.yml index ac20a0c9955..fb1faa7d96d 100644 --- a/boot/ci-linux.template.yml +++ b/boot/ci-linux.template.yml @@ -33,6 +33,11 @@ jobs: - name: Set PATH run: | echo "::add-path::$HOME/.cabal/bin" + - name: Install git + run: | + add-apt-repository -y ppa:git-core/ppa + apt-get update + apt-get install -y git - name: Install cabal-plan run: | mkdir -p $HOME/.cabal/bin @@ -56,12 +61,12 @@ jobs: - name: Update Hackage index run: cabal v2-update # https://github.com/actions/checkout/issues/170 - # - uses: actions/checkout@v2 - - name: Checkout - run: | - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . - git fetch origin $GITHUB_REF:temporary-ci-branch - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) + - uses: actions/checkout@v2 + # - name: Checkout + # - run: | + # - git clone --depth 1 https://github.com/$GITHUB_REPOSITORY.git . + # - git fetch origin $GITHUB_REF:temporary-ci-branch + # - git checkout $GITHUB_SHA || (git fetch && git checkout $GITHUB_SHA) {% for step in job.steps %} - name: Validate {{step}} run: sh validate.sh -j 2 -w ghc-{{job.version}} -v {{job.flags}} -s {{step}}