Skip to content

Commit a6dc15f

Browse files
authored
Merge pull request #6538 from commercialhaskell/fix6534
Fix #6534 Remove deprecated package-indices option
2 parents 967e86c + 1a2d8a9 commit a6dc15f

File tree

13 files changed

+8
-140
lines changed

13 files changed

+8
-140
lines changed

Diff for: ChangeLog.md

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Behaviour changes:
2121
* The `haddock --haddock-for-hackage` command only seeks to create an archive of
2222
the `<package_version>-docs` directory for build targets and if flags
2323
excluding the building of project packages are not set.
24+
* The predecessor of configuration option `package-index`, `package-indices`
25+
(deprecated in Stack 2.9.3) has been removed as an alternative option.
2426

2527
Other enhancements:
2628

Diff for: doc/install_and_upgrade.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ setup-info-locations:
575575
urls:
576576
latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json
577577

578-
package-indices:
578+
package-index:
579579
- download-prefix: http://mirrors.tuna.tsinghua.edu.cn/hackage/
580580
~~~
581581

Diff for: doc/maintainers/stack_errors.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
In connection with considering Stack's support of the
66
[Haskell Error Index](https://errors.haskell.org/) initiative, this page seeks
77
to take stock of the errors that Stack itself can raise, by reference to the
8-
`master` branch of the Stack repository. Last updated: 2024-03-02.
8+
`master` branch of the Stack repository. Last updated: 2024-03-29.
99

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

@@ -419,7 +419,6 @@ to take stock of the errors that Stack itself can raise, by reference to the
419419
~~~haskell
420420
[S-6602] = ParseConfigFileException (Path Abs File) ParseException
421421
[S-7462] | StackWorkEnvNotRelativeDir String
422-
[S-3251] | MultiplePackageIndices [PackageIndexConfig]
423422
[S-5470] | DuplicateLocalPackageNames [(PackageName, [PackageLocation])]
424423
[S-6854] | BadMsysEnvironment MsysEnvironment Arch
425424
[S-5006] | NoDefaultMsysEnvironmentBug

Diff for: doc/yaml_configuration.md

-34
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,6 @@ package-index:
14261426
ignore-expiry: true
14271427
~~~
14281428

1429-
Takes precedence over the `package-indices` key, which is deprecated.
1430-
14311429
Specify the package index. The index must use the
14321430
[Hackage Security](https://hackage.haskell.org/package/hackage-security) format.
14331431
This setting is most useful for providing a mirror of the official Hackage
@@ -1456,44 +1454,12 @@ the package index for it to be considered valid.
14561454
`ignore-expiry` specifies whether or not the expiration of timestamps should be
14571455
ignored.
14581456

1459-
### package-indices
1460-
1461-
[:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
1462-
1463-
Deprecated in favour of [`package-index`](#package-index), which takes
1464-
precedence if present.
1465-
1466-
Default:
1467-
1468-
~~~yaml
1469-
package-indices:
1470-
- download-prefix: https://hackage.haskell.org/
1471-
hackage-security:
1472-
keyids:
1473-
- 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d
1474-
- 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42
1475-
- 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3
1476-
- 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921
1477-
- fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0
1478-
key-threshold: 3
1479-
ignore-expiry: true
1480-
~~~
1481-
14821457
!!! info
14831458

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

1488-
!!! info
1489-
1490-
Before Stack 2.1.1, Stack had a different approach to `package-indices`. For
1491-
more information, see
1492-
[issue #4137](https://github.com/commercialhaskell/stack/issues/4137).
1493-
1494-
Specify the package index. For further information, see the `package-index`
1495-
[documentation](#package-index).
1496-
14971463
### pvp-bounds
14981464

14991465
[:octicons-tag-24: 0.1.5.0](https://github.com/commercialhaskell/stack/releases/tag/v0.1.5.0)

Diff for: src/Stack/Config.hs

+3-11
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ import Stack.Types.Config
118118
)
119119
import Stack.Types.Config.Exception
120120
( ConfigException (..), ConfigPrettyException (..)
121-
, ParseAbsolutePathException (..), packageIndicesWarning )
121+
, ParseAbsolutePathException (..)
122+
)
122123
import Stack.Types.ConfigMonoid
123124
( ConfigMonoid (..), parseConfigMonoid )
124125
import Stack.Types.Casa ( CasaOptsMonoid (..) )
@@ -489,16 +490,7 @@ configFromConfigMonoid
489490
& stylesUpdateL .~ stylesUpdate'
490491
& useColorL .~ useColor''
491492
go = configRunner'.globalOpts
492-
pic <-
493-
case getFirst configMonoid.packageIndex of
494-
Nothing ->
495-
case getFirst configMonoid.packageIndices of
496-
Nothing -> pure defaultPackageIndexConfig
497-
Just [pic] -> do
498-
prettyWarn packageIndicesWarning
499-
pure pic
500-
Just x -> prettyThrowIO $ MultiplePackageIndices x
501-
Just pic -> pure pic
493+
pic = fromFirst defaultPackageIndexConfig configMonoid.packageIndex
502494
mpantryRoot <- liftIO $ lookupEnv pantryRootEnvVar
503495
pantryRoot <-
504496
case mpantryRoot of

Diff for: src/Stack/Types/Config/Exception.hs

-23
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Stack.Types.Config.Exception
88
( ConfigException (..)
99
, ConfigPrettyException (..)
1010
, ParseAbsolutePathException (..)
11-
, packageIndicesWarning
1211
) where
1312

1413
import qualified Data.Text as T
@@ -159,7 +158,6 @@ instance Exception ConfigException where
159158
data ConfigPrettyException
160159
= ParseConfigFileException !(Path Abs File) !ParseException
161160
| StackWorkEnvNotRelativeDir !String
162-
| MultiplePackageIndices [PackageIndexConfig]
163161
| DuplicateLocalPackageNames ![(PackageName, [PackageLocation])]
164162
| BadMsysEnvironment !MsysEnvironment !Arch
165163
| NoMsysEnvironmentBug
@@ -202,18 +200,6 @@ instance Pretty ConfigPrettyException where
202200
\of the project or package. Stack encountered the value:"
203201
, style Error (fromString x) <> "."
204202
]
205-
pretty (MultiplePackageIndices pics) =
206-
"[S-3251]"
207-
<> line
208-
<> fillSep
209-
[ flow "When using the"
210-
, style Shell "package-indices"
211-
, flow "key to override the default package index, you must \
212-
\provide exactly one value, received:"
213-
, bulletedList (map (string . show) pics)
214-
]
215-
<> blankLine
216-
<> packageIndicesWarning
217203
pretty (DuplicateLocalPackageNames pairs) =
218204
"[S-5470]"
219205
<> line
@@ -258,12 +244,3 @@ instance Exception ParseAbsolutePathException where
258244
, " environment variable (expected absolute directory): "
259245
, dir
260246
]
261-
262-
packageIndicesWarning :: StyleDoc
263-
packageIndicesWarning =
264-
fillSep
265-
[ "The"
266-
, style Shell "package-indices"
267-
, flow "key is deprecated in favour of"
268-
, style Shell "package-index" <> "."
269-
]

Diff for: src/Stack/Types/ConfigMonoid.hs

+1-11
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ module Stack.Types.ConfigMonoid
1717
import Data.Aeson.Types ( Object, Value )
1818
import Data.Aeson.WarningParser
1919
( WarningParser, WithJSONWarnings, (..:?), (..!=)
20-
, jsonSubWarnings, jsonSubWarningsT, jsonSubWarningsTT
21-
, withObjectWarnings
20+
, jsonSubWarnings, jsonSubWarningsT, withObjectWarnings
2221
)
2322
import Casa.Client ( CasaRepoPrefix )
2423
import Control.Monad.Writer ( tell )
@@ -79,8 +78,6 @@ data ConfigMonoid = ConfigMonoid
7978
-- ^ See: 'configLatestSnapshot'
8079
, packageIndex :: !(First PackageIndexConfig)
8180
-- ^ See: 'withPantryConfig'
82-
, packageIndices :: !(First [PackageIndexConfig])
83-
-- ^ Deprecated in favour of package-index
8481
, systemGHC :: !(First Bool)
8582
-- ^ See: 'configSystemGHC'
8683
, installGHC :: !FirstTrue
@@ -242,8 +239,6 @@ parseConfigMonoidObject rootDir obj = do
242239

243240
packageIndex <-
244241
First <$> jsonSubWarningsT (obj ..:? configMonoidPackageIndexName)
245-
packageIndices <-
246-
First <$> jsonSubWarningsTT (obj ..:? configMonoidPackageIndicesName)
247242
systemGHC <- First <$> obj ..:? configMonoidSystemGHCName
248243
installGHC <- FirstTrue <$> obj ..:? configMonoidInstallGHCName
249244
skipGHCCheck <- FirstFalse <$> obj ..:? configMonoidSkipGHCCheckName
@@ -356,7 +351,6 @@ parseConfigMonoidObject rootDir obj = do
356351
, prefixTimestamps
357352
, latestSnapshot
358353
, packageIndex
359-
, packageIndices
360354
, systemGHC
361355
, installGHC
362356
, skipGHCCheck
@@ -445,10 +439,6 @@ configMonoidUrlsName = "urls"
445439
configMonoidPackageIndexName :: Text
446440
configMonoidPackageIndexName = "package-index"
447441

448-
-- Deprecated in favour of package-index
449-
configMonoidPackageIndicesName :: Text
450-
configMonoidPackageIndicesName = "package-indices"
451-
452442
configMonoidSystemGHCName :: Text
453443
configMonoidSystemGHCName = "system-ghc"
454444

Diff for: tests/integration/tests/3396-package-indices/Main.hs

-15
This file was deleted.
Binary file not shown.

Diff for: tests/integration/tests/3396-package-indices/files/files.cabal

-19
This file was deleted.

Diff for: tests/integration/tests/3396-package-indices/files/my-snapshot.yaml

-10
This file was deleted.

Diff for: tests/integration/tests/3396-package-indices/files/src/Lib.hs

-8
This file was deleted.

Diff for: tests/integration/tests/3396-package-indices/files/stack.yaml

-6
This file was deleted.

0 commit comments

Comments
 (0)