Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6534 Remove deprecated package-indices option #6538

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Behaviour changes:
* The `haddock --haddock-for-hackage` command only seeks to create an archive of
the `<package_version>-docs` directory for build targets and if flags
excluding the building of project packages are not set.
* The predecessor of configuration option `package-index`, `package-indices`
(deprecated in Stack 2.9.3) has been removed as an alternative option.

Other enhancements:

Expand Down
2 changes: 1 addition & 1 deletion doc/install_and_upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ setup-info-locations:
urls:
latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json

package-indices:
package-index:
- download-prefix: http://mirrors.tuna.tsinghua.edu.cn/hackage/
~~~

Expand Down
3 changes: 1 addition & 2 deletions doc/maintainers/stack_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
In connection with considering Stack's support of the
[Haskell Error Index](https://errors.haskell.org/) initiative, this page seeks
to take stock of the errors that Stack itself can raise, by reference to the
`master` branch of the Stack repository. Last updated: 2024-03-02.
`master` branch of the Stack repository. Last updated: 2024-03-29.

* `Stack.main`: catches exceptions from action `commandLineHandler`.

Expand Down Expand Up @@ -419,7 +419,6 @@ to take stock of the errors that Stack itself can raise, by reference to the
~~~haskell
[S-6602] = ParseConfigFileException (Path Abs File) ParseException
[S-7462] | StackWorkEnvNotRelativeDir String
[S-3251] | MultiplePackageIndices [PackageIndexConfig]
[S-5470] | DuplicateLocalPackageNames [(PackageName, [PackageLocation])]
[S-6854] | BadMsysEnvironment MsysEnvironment Arch
[S-5006] | NoDefaultMsysEnvironmentBug
Expand Down
34 changes: 0 additions & 34 deletions doc/yaml_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -1426,8 +1426,6 @@ package-index:
ignore-expiry: true
~~~

Takes precedence over the `package-indices` key, which is deprecated.

Specify the package index. The index must use the
[Hackage Security](https://hackage.haskell.org/package/hackage-security) format.
This setting is most useful for providing a mirror of the official Hackage
Expand Down Expand Up @@ -1456,44 +1454,12 @@ the package index for it to be considered valid.
`ignore-expiry` specifies whether or not the expiration of timestamps should be
ignored.

### package-indices

[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)

Deprecated in favour of [`package-index`](#package-index), which takes
precedence if present.

Default:

~~~yaml
package-indices:
- download-prefix: https://hackage.haskell.org/
hackage-security:
keyids:
- 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d
- 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42
- 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3
- 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921
- fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0
key-threshold: 3
ignore-expiry: true
~~~

!!! info

Before Stack 2.1.3, the default for `ignore-expiry` was `false`. For more
information, see
[issue #4928](https://github.com/commercialhaskell/stack/issues/4928).

!!! info

Before Stack 2.1.1, Stack had a different approach to `package-indices`. For
more information, see
[issue #4137](https://github.com/commercialhaskell/stack/issues/4137).

Specify the package index. For further information, see the `package-index`
[documentation](#package-index).

### pvp-bounds

[:octicons-tag-24: 0.1.5.0](https://github.com/commercialhaskell/stack/releases/tag/v0.1.5.0)
Expand Down
14 changes: 3 additions & 11 deletions src/Stack/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ import Stack.Types.Config
)
import Stack.Types.Config.Exception
( ConfigException (..), ConfigPrettyException (..)
, ParseAbsolutePathException (..), packageIndicesWarning )
, ParseAbsolutePathException (..)
)
import Stack.Types.ConfigMonoid
( ConfigMonoid (..), parseConfigMonoid )
import Stack.Types.Casa ( CasaOptsMonoid (..) )
Expand Down Expand Up @@ -489,16 +490,7 @@ configFromConfigMonoid
& stylesUpdateL .~ stylesUpdate'
& useColorL .~ useColor''
go = configRunner'.globalOpts
pic <-
case getFirst configMonoid.packageIndex of
Nothing ->
case getFirst configMonoid.packageIndices of
Nothing -> pure defaultPackageIndexConfig
Just [pic] -> do
prettyWarn packageIndicesWarning
pure pic
Just x -> prettyThrowIO $ MultiplePackageIndices x
Just pic -> pure pic
pic = fromFirst defaultPackageIndexConfig configMonoid.packageIndex
mpantryRoot <- liftIO $ lookupEnv pantryRootEnvVar
pantryRoot <-
case mpantryRoot of
Expand Down
23 changes: 0 additions & 23 deletions src/Stack/Types/Config/Exception.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module Stack.Types.Config.Exception
( ConfigException (..)
, ConfigPrettyException (..)
, ParseAbsolutePathException (..)
, packageIndicesWarning
) where

import qualified Data.Text as T
Expand Down Expand Up @@ -159,7 +158,6 @@ instance Exception ConfigException where
data ConfigPrettyException
= ParseConfigFileException !(Path Abs File) !ParseException
| StackWorkEnvNotRelativeDir !String
| MultiplePackageIndices [PackageIndexConfig]
| DuplicateLocalPackageNames ![(PackageName, [PackageLocation])]
| BadMsysEnvironment !MsysEnvironment !Arch
| NoMsysEnvironmentBug
Expand Down Expand Up @@ -202,18 +200,6 @@ instance Pretty ConfigPrettyException where
\of the project or package. Stack encountered the value:"
, style Error (fromString x) <> "."
]
pretty (MultiplePackageIndices pics) =
"[S-3251]"
<> line
<> fillSep
[ flow "When using the"
, style Shell "package-indices"
, flow "key to override the default package index, you must \
\provide exactly one value, received:"
, bulletedList (map (string . show) pics)
]
<> blankLine
<> packageIndicesWarning
pretty (DuplicateLocalPackageNames pairs) =
"[S-5470]"
<> line
Expand Down Expand Up @@ -258,12 +244,3 @@ instance Exception ParseAbsolutePathException where
, " environment variable (expected absolute directory): "
, dir
]

packageIndicesWarning :: StyleDoc
packageIndicesWarning =
fillSep
[ "The"
, style Shell "package-indices"
, flow "key is deprecated in favour of"
, style Shell "package-index" <> "."
]
12 changes: 1 addition & 11 deletions src/Stack/Types/ConfigMonoid.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module Stack.Types.ConfigMonoid
import Data.Aeson.Types ( Object, Value )
import Data.Aeson.WarningParser
( WarningParser, WithJSONWarnings, (..:?), (..!=)
, jsonSubWarnings, jsonSubWarningsT, jsonSubWarningsTT
, withObjectWarnings
, jsonSubWarnings, jsonSubWarningsT, withObjectWarnings
)
import Casa.Client ( CasaRepoPrefix )
import Control.Monad.Writer ( tell )
Expand Down Expand Up @@ -79,8 +78,6 @@ data ConfigMonoid = ConfigMonoid
-- ^ See: 'configLatestSnapshot'
, packageIndex :: !(First PackageIndexConfig)
-- ^ See: 'withPantryConfig'
, packageIndices :: !(First [PackageIndexConfig])
-- ^ Deprecated in favour of package-index
, systemGHC :: !(First Bool)
-- ^ See: 'configSystemGHC'
, installGHC :: !FirstTrue
Expand Down Expand Up @@ -242,8 +239,6 @@ parseConfigMonoidObject rootDir obj = do

packageIndex <-
First <$> jsonSubWarningsT (obj ..:? configMonoidPackageIndexName)
packageIndices <-
First <$> jsonSubWarningsTT (obj ..:? configMonoidPackageIndicesName)
systemGHC <- First <$> obj ..:? configMonoidSystemGHCName
installGHC <- FirstTrue <$> obj ..:? configMonoidInstallGHCName
skipGHCCheck <- FirstFalse <$> obj ..:? configMonoidSkipGHCCheckName
Expand Down Expand Up @@ -356,7 +351,6 @@ parseConfigMonoidObject rootDir obj = do
, prefixTimestamps
, latestSnapshot
, packageIndex
, packageIndices
, systemGHC
, installGHC
, skipGHCCheck
Expand Down Expand Up @@ -445,10 +439,6 @@ configMonoidUrlsName = "urls"
configMonoidPackageIndexName :: Text
configMonoidPackageIndexName = "package-index"

-- Deprecated in favour of package-index
configMonoidPackageIndicesName :: Text
configMonoidPackageIndicesName = "package-indices"

configMonoidSystemGHCName :: Text
configMonoidSystemGHCName = "system-ghc"

Expand Down
15 changes: 0 additions & 15 deletions tests/integration/tests/3396-package-indices/Main.hs

This file was deleted.

Binary file not shown.
19 changes: 0 additions & 19 deletions tests/integration/tests/3396-package-indices/files/files.cabal

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions tests/integration/tests/3396-package-indices/files/src/Lib.hs

This file was deleted.

6 changes: 0 additions & 6 deletions tests/integration/tests/3396-package-indices/files/stack.yaml

This file was deleted.