Skip to content

Commit

Permalink
Successive Cabal Package Errors (#9162)
Browse files Browse the repository at this point in the history
* Cabal Package Exceptions

* Accepting new format of output with error codes

* Reverting the changes to new error output

* Rebasing branch Subsequent Cabal Package errors

* Added setup-explicit-fail.out

* Delete setup-explicit-fail.out

* Accepting new output with error codes

* Changed to "GetProgramInvocationException" and "SanityCheckForEnableComponents"

* Going back to former die' call in `getProgramInvocationOutout`  function to check on the failing CI test

* Accepted new error output, included cabalexception in handler

* Error code rectification

* Added a handler condition for VerboseException CabalException in `annotaeFailure` function

* Leaving "GetProgramInvocationException" unmodified

* Incorporated review comments

* Updated "nor" in AutoGenModule test case

* Updated "AutogenExposeOther" test case which was dependent on this "nor" change
  • Loading branch information
SuganyaAK authored Aug 17, 2023
1 parent e77f139 commit f465da4
Show file tree
Hide file tree
Showing 24 changed files with 389 additions and 263 deletions.
2 changes: 1 addition & 1 deletion Cabal/src/Distribution/PackageDescription/Check.hs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ ppExplanation SignaturesCabal2 =
"To use the 'signatures' field the package needs to specify "
++ "at least 'cabal-version: 2.0'."
ppExplanation AutogenNotExposed =
"An 'autogen-module' is neither on 'exposed-modules' or 'other-modules'."
"An 'autogen-module' is neither on 'exposed-modules' nor 'other-modules'."
ppExplanation AutogenIncludesNotIncluded =
"An include in 'autogen-includes' is neither in 'includes' or "
++ "'install-includes'."
Expand Down
13 changes: 4 additions & 9 deletions Cabal/src/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import Distribution.Pretty
import Distribution.Simple.Bench
import Distribution.Simple.BuildPaths
import Distribution.Simple.ConfigureScript
import Distribution.Simple.Errors
import Distribution.Simple.Haddock
import Distribution.Simple.Install
import Distribution.Simple.LocalBuildInfo
Expand Down Expand Up @@ -601,16 +602,10 @@ sanityCheckHookedBuildInfo
verbosity
(PackageDescription{library = Nothing})
(Just _, _) =
die' verbosity $
"The buildinfo contains info for a library, "
++ "but the package does not have a library."
dieWithException verbosity $ NoLibraryForPackage
sanityCheckHookedBuildInfo verbosity pkg_descr (_, hookExes)
| exe1 : _ <- nonExistant =
die' verbosity $
"The buildinfo contains info for an executable called '"
++ prettyShow exe1
++ "' but the package does not have a "
++ "executable with that name."
dieWithException verbosity $ SanityCheckHookedBuildInfo exe1
where
pkgExeNames = nub (map exeName (executables pkg_descr))
hookExeNames = nub (map fst hookExes)
Expand Down Expand Up @@ -777,7 +772,7 @@ autoconfUserHooks =
verbosity
flags
lbi
else die' verbosity "configure script not found."
else dieWithException verbosity ConfigureScriptNotFound

pbi <- getHookedBuildInfo verbosity (buildDir lbi)
sanityCheckHookedBuildInfo verbosity pkg_descr pbi
Expand Down
4 changes: 1 addition & 3 deletions Cabal/src/Distribution/Simple/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,7 @@ checkSemaphoreSupport
:: Verbosity -> Compiler -> BuildFlags -> IO ()
checkSemaphoreSupport verbosity comp flags = do
unless (jsemSupported comp || (isNothing (flagToMaybe (buildUseSemaphore flags)))) $
die' verbosity $
"Your compiler does not support the -jsem flag. "
++ "To use this feature you must use GHC 9.8 or later."
dieWithException verbosity CheckSemaphoreSupport

-- | Write available build information for 'LocalBuildInfo' to disk.
--
Expand Down
Loading

0 comments on commit f465da4

Please sign in to comment.