From f203a2cd32195ddd35a8e88198e26c42f3ad6aa0 Mon Sep 17 00:00:00 2001 From: brandon s allbery kf8nh Date: Sat, 3 Aug 2024 15:42:31 -0400 Subject: [PATCH 1/5] clarify "configure" messages from Cabal (#9476) * clarify "configure" messages from Cabal * add changelog * Apply suggestions from code review Co-authored-by: Javier Sagredo --------- Co-authored-by: Javier Sagredo Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- Cabal/src/Distribution/Simple/Configure.hs | 10 ++--- Cabal/src/Distribution/Simple/Errors.hs | 49 +++++++++++----------- changelog.d/configure-messages | 13 ++++++ 3 files changed, 42 insertions(+), 30 deletions(-) create mode 100644 changelog.d/configure-messages diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 6c6610cb2be..6e98ee6c25f 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -208,20 +208,20 @@ data ConfigStateFileError dispConfigStateFileError :: ConfigStateFileError -> Doc dispConfigStateFileError ConfigStateFileNoHeader = text "Saved package config file header is missing." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileBadHeader = text "Saved package config file header is corrupt." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileNoParse = text "Saved package config file is corrupt." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileMissing{} = - text "Run the 'configure' command first." + text "Run the 'Setup configure' command first." dispConfigStateFileError (ConfigStateFileBadVersion oldCabal oldCompiler _) = text "Saved package config file is outdated:" $+$ badCabal $+$ badCompiler - $+$ text "Re-run the 'configure' command." + $+$ text "Re-run the 'Setup configure' command." where badCabal = text "• the Cabal version changed from" diff --git a/Cabal/src/Distribution/Simple/Errors.hs b/Cabal/src/Distribution/Simple/Errors.hs index e39f63823a8..c1cc75b5ad1 100644 --- a/Cabal/src/Distribution/Simple/Errors.hs +++ b/Cabal/src/Distribution/Simple/Errors.hs @@ -314,7 +314,7 @@ versionRequirement range exceptionMessage :: CabalException -> String exceptionMessage e = case e of NoBenchMarkProgram cmd -> "Could not find benchmark program \"" ++ cmd ++ "\". Did you build the package first?" - EnableBenchMark -> "No benchmarks enabled. Did you remember to configure with " ++ "\'--enable-benchmarks\'?" + EnableBenchMark -> "No benchmarks enabled. Did you remember to \'Setup configure\' with " ++ "\'--enable-benchmarks\'?" BenchMarkNameDisabled bmName -> "Package configured with benchmark " ++ bmName ++ " disabled." NoBenchMark bmName -> "no such benchmark: " ++ bmName NoLibraryFound -> "No executables and no library found. Nothing to do." @@ -331,8 +331,8 @@ exceptionMessage e = case e of ++ ".\n" ++ "If the module " ++ "is autogenerated it should be added to 'autogen-modules'." - RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support,registering multiple instances of packages." - SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support ,suppressing checks on files." + RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support registering multiple instances of packages." + SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support suppressing checks on files." NoSupportDirStylePackageDb -> "HcPkg.writeRegistrationFileDirectly: compiler does not support dir style package dbs" OnlySupportSpecificPackageDb -> "HcPkg.writeRegistrationFileDirectly: only supports SpecificPackageDB for now" FailedToParseOutputDescribe programId pkgId -> "failed to parse output of '" ++ programId ++ " describe " ++ prettyShow pkgId ++ "'" @@ -353,7 +353,7 @@ exceptionMessage e = case e of ++ " but " ++ "haddock is using GHC version " ++ prettyShow haddockGhcVersion - MustHaveSharedLibraries -> "Must have vanilla or shared libraries " ++ "enabled in order to run haddock" + MustHaveSharedLibraries -> "Must have vanilla or shared libraries enabled in order to run haddock" HaddockPackageFlags inf -> "internal error when calculating transitive " ++ "package dependencies.\nDebug info: " @@ -391,7 +391,7 @@ exceptionMessage e = case e of GlobalPackageDBLimitation -> "With current ghc versions the global package db is always used " ++ "and must be listed first. This ghc limitation may be lifted in " - ++ "future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977" + ++ "the future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977" GlobalPackageDBSpecifiedFirst -> "If the global package db is specified, it must be " ++ "specified first and cannot be specified multiple times" @@ -487,8 +487,7 @@ exceptionMessage e = case e of ++ "suite type " ++ prettyShow tt NoSupportForPreProcessingBenchmark tt -> - "No support for preprocessing benchmark " - ++ "type " + "No support for preprocessing benchmark type " ++ prettyShow tt CantFindSourceForPreProcessFile errorStr -> errorStr NoSupportPreProcessingTestExtras tt -> @@ -511,11 +510,11 @@ exceptionMessage e = case e of SanityCheckHookedBuildInfo exe1 -> "The buildinfo contains info for an executable called '" ++ prettyShow exe1 - ++ "' but the package does not have a " + ++ "' but the package does not have an " ++ "executable with that name." ConfigureScriptNotFound fp -> "configure script not found at " ++ fp ++ "." NoValidComponent -> "No valid component targets found" - ConfigureEitherSingleOrAll -> "Can only configure either single component or all of them" + ConfigureEitherSingleOrAll -> "Can only configure either a single component or all of them" ConfigCIDValidForPreComponent -> "--cid is only supported for per-component configure" SanityCheckForEnableComponents -> "--enable-tests/--enable-benchmarks are incompatible with" @@ -525,23 +524,23 @@ exceptionMessage e = case e of ++ " are incompatible with each other." UnsupportedLanguages pkgId compilerId langs -> "The package " - ++ prettyShow (pkgId) + ++ prettyShow pkgId ++ " requires the following languages which are not " ++ "supported by " - ++ prettyShow (compilerId) + ++ prettyShow compilerId ++ ": " ++ intercalate ", " langs UnsupportedLanguageExtension pkgId compilerId exts -> "The package " - ++ prettyShow (pkgId) + ++ prettyShow pkgId ++ " requires the following language extensions which are not " ++ "supported by " - ++ prettyShow (compilerId) + ++ prettyShow compilerId ++ ": " ++ intercalate ", " exts CantFindForeignLibraries unsupportedFLibs -> "Cannot build some foreign libraries: " - ++ intercalate "," unsupportedFLibs + ++ intercalate ", " unsupportedFLibs ExpectedAbsoluteDirectory fPath -> "expected an absolute directory name for --prefix: " ++ fPath FlagsNotSpecified diffFlags -> "'--exact-configuration' was given, " @@ -572,7 +571,7 @@ exceptionMessage e = case e of ++ "' refers to a library which is defined within the same " ++ "package. To use this feature the package must specify at " ++ "least 'cabal-version: >= 1.8'." - ReportFailedDependencies failed hackageUrl -> (intercalate "\n\n" (map reportFailedDependency failed)) + ReportFailedDependencies failed hackageUrl -> intercalate "\n\n" (map reportFailedDependency failed) where reportFailedDependency (DependencyNotExists pkgname) = "there is no version of " @@ -617,7 +616,7 @@ exceptionMessage e = case e of NoWorkingGcc -> unlines [ "No working gcc" - , "This package depends on foreign library but we cannot " + , "This package depends on a foreign library but we cannot " ++ "find a working C compiler. If you have it in a " ++ "non-standard location you can use the --with-gcc " ++ "flag to specify it." @@ -674,8 +673,8 @@ exceptionMessage e = case e of ++ "where it is." ++ "If the library file does exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." messagePlural = "This problem can usually be solved by installing the system " ++ "packages that provide these libraries (you may need the " @@ -685,18 +684,18 @@ exceptionMessage e = case e of ++ "where they are." ++ "If the library files do exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." headerCppMessage = "If the header file does exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." headerCcMessage = "The header file contains a compile error. " - ++ "You can re-run configure with the verbosity flag " + ++ "You can re-run 'Setup configure' with the verbosity flag " ++ "-v3 to see the error messages from the C compiler." - CheckPackageProblems errors -> (intercalate "\n\n" $ errors) + CheckPackageProblems errors -> intercalate "\n\n" errors LibDirDepsPrefixNotRelative l p -> "Library directory of a dependency: " ++ show l @@ -757,7 +756,7 @@ exceptionMessage e = case e of RegisMultiplePkgNotSupported -> "Registering multiple package instances is not yet supported for this compiler" RegisteringNotImplemented -> "Registering is not implemented for this compiler" NoTestSuitesEnabled -> - "No test suites enabled. Did you remember to configure with " + "No test suites enabled. Did you remember to 'Setup configure' with " ++ "\'--enable-tests\'?" TestNameDisabled tName -> "Package configured with test suite " diff --git a/changelog.d/configure-messages b/changelog.d/configure-messages new file mode 100644 index 00000000000..f0fab79e734 --- /dev/null +++ b/changelog.d/configure-messages @@ -0,0 +1,13 @@ +synopsis: clarify Cabal "configure" messages +packages: Cabal +prs: #9476 + +synopsis: { + + Cabal can issue a number of error messages referencing "Setup configure", + but it simply references "configure" which could mean any of three + things (Setup configure, the package's "configure" script, or "cabal + configure"). This has recently caught out even Cabal devs. Clarify these + messages. + +} From cee1f8a6fc5fd99ad38ae1a052a22a17eaa20304 Mon Sep 17 00:00:00 2001 From: brandon s allbery kf8nh Date: Tue, 23 Jul 2024 18:34:09 -0400 Subject: [PATCH 2/5] reorder Haddock markup for dynprof constructor Older ghcs don't like it being after the constructor. --- .../src/Distribution/Solver/Types/ConstraintSource.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs b/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs index 55b35212d3c..cb91bc742b4 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs @@ -41,9 +41,9 @@ data ConstraintSource = -- from Cabal >= 3.11 | ConstraintSourceMultiRepl - | ConstraintSourceProfiledDynamic -- | Constraint introduced by --enable-profiling-shared, which requires features -- from Cabal >= 3.13 + | ConstraintSourceProfiledDynamic -- | The source of the constraint is not specified. | ConstraintSourceUnknown From e0bbb978c65090b995d29bb876d1a00515f6bd36 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Sat, 3 Aug 2024 10:45:04 -0700 Subject: [PATCH 3/5] Add MultilineStrings extension --- Cabal-syntax/src/Language/Haskell/Extension.hs | 2 ++ .../tests/UnitTests/Distribution/Utils/Structured.hs | 8 ++++---- changelog.d/pr-10245 | 8 ++++++++ editors/vim/syntax/cabal.vim | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 changelog.d/pr-10245 diff --git a/Cabal-syntax/src/Language/Haskell/Extension.hs b/Cabal-syntax/src/Language/Haskell/Extension.hs index 22082d6d0b3..13796c80666 100644 --- a/Cabal-syntax/src/Language/Haskell/Extension.hs +++ b/Cabal-syntax/src/Language/Haskell/Extension.hs @@ -551,6 +551,8 @@ data KnownExtension | -- | Allow the use of built-in syntax for list, tuple and sum type constructors -- rather than being exclusive to data constructors. ListTuplePuns + | -- | Support multiline strings + MultilineStrings deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Typeable, Data) instance Binary KnownExtension diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 40770290073..d932ef59a33 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -31,15 +31,15 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion md5CheckGenericPackageDescription proxy = md5Check proxy #if MIN_VERSION_base(4,19,0) - 0x3da8883a286b8fbfd9f94790d57cc06e + 0x62ad178a75f041af29947c9b3d83e6ed #else - 0x245e544da05f50f9dd0339a96ac99860 + 0xba8f0baa8074fd238ad36a309399349e #endif md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy #if MIN_VERSION_base(4,19,0) - 0x7683c2daece12ba7982e80f860454f47 + 0xc68e9c0758c4bf2d72fe82b3d55cee34 #else - 0xe694b39b10bc861f47ea9c7b926a422a + 0xcf7e7bbcaec504d745fe086eec1786ff #endif diff --git a/changelog.d/pr-10245 b/changelog.d/pr-10245 new file mode 100644 index 00000000000..2ed3690720a --- /dev/null +++ b/changelog.d/pr-10245 @@ -0,0 +1,8 @@ +synopsis: Add MultilineStrings extension +packages: Cabal-syntax +prs: #10245 +description: { + +- adds support for the `MultilineStrings` language extension (GHC proposal #637) + +} diff --git a/editors/vim/syntax/cabal.vim b/editors/vim/syntax/cabal.vim index d3374dbd27f..db08e8e0d92 100644 --- a/editors/vim/syntax/cabal.vim +++ b/editors/vim/syntax/cabal.vim @@ -219,6 +219,7 @@ syn keyword cabalExtension contained \ MonoLocalBinds \ MonoPatBinds \ MonomorphismRestriction + \ MultilineStrings \ MultiParamTypeClasses \ MultiWayIf \ NPlusKPatterns From 5f766d2866769f4978d52f784cdacc1655547ac3 Mon Sep 17 00:00:00 2001 From: Artem Pelenitsyn Date: Sat, 3 Aug 2024 19:41:31 -0400 Subject: [PATCH 4/5] Update cabal-install-solver synopsis (fix #10183) (#10192) * Update cabal-install-solver synopsis (fix #10183) * fixup! remove trailing dot --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- cabal-install-solver/cabal-install-solver.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index 4bc75a32569..5340fae3f7f 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -1,9 +1,9 @@ cabal-version: 2.2 name: cabal-install-solver version: 3.13.0.0 -synopsis: The command-line interface for Cabal and Hackage. +synopsis: The solver component of cabal-install description: - The solver component used in cabal-install command-line program + The solver component used in the cabal-install command-line program. homepage: http://www.haskell.org/cabal/ bug-reports: https://github.com/haskell/cabal/issues From 3347001cc460256cb4ece0cf9613a0616412248f Mon Sep 17 00:00:00 2001 From: Kristen Kozak Date: Mon, 29 Jul 2024 22:51:45 -0700 Subject: [PATCH 5/5] Add simple QuickCheck test for solver exceptions The solver QuickCheck tests can already detect exceptions, but this test is simpler and easier to debug. --- .../Distribution/Solver/Modular/QuickCheck.hs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs index 1a2bc97224f..c891f60692b 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs @@ -52,7 +52,20 @@ import UnitTests.Distribution.Solver.Modular.QuickCheck.Utils tests :: [TestTree] tests = - [ -- This test checks that certain solver parameters do not affect the + [ testPropertyWithSeed "solver does not throw exceptions" $ + \test goalOrder reorderGoals indepGoals prefOldest -> + let r = + solve + (EnableBackjumping True) + (FineGrainedConflicts True) + reorderGoals + (CountConflicts True) + indepGoals + prefOldest + (getBlind <$> goalOrder) + test + in resultPlan r `seq` () + , -- This test checks that certain solver parameters do not affect the -- existence of a solution. It runs the solver twice, and only sets those -- parameters on the second run. The test also applies parameters that -- can affect the existence of a solution to both runs. @@ -516,6 +529,11 @@ instance Arbitrary IndependentGoals where shrink (IndependentGoals indep) = [IndependentGoals False | indep] +instance Arbitrary PreferOldest where + arbitrary = PreferOldest <$> arbitrary + + shrink (PreferOldest prefOldest) = [PreferOldest False | prefOldest] + instance Arbitrary Component where arbitrary = oneof