pantry 0.9.3.1 → 0.9.3.2
raw patch · 7 files changed
+730/−385 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Pantry: class HasPantryConfig env
+ Pantry: class () => HasPantryConfig env
- Pantry: data Archive
+ Pantry: data () => Archive
- Pantry: data ArchiveLocation
+ Pantry: data () => ArchiveLocation
- Pantry: data BlobKey
+ Pantry: data () => BlobKey
- Pantry: data CabalFileInfo
+ Pantry: data () => CabalFileInfo
- Pantry: data FlagName
+ Pantry: data () => FlagName
- Pantry: data FuzzyResults
+ Pantry: data () => FuzzyResults
- Pantry: data HackageSecurityConfig
+ Pantry: data () => HackageSecurityConfig
- Pantry: data HpackExecutable
+ Pantry: data () => HpackExecutable
- Pantry: data Mismatch a
+ Pantry: data () => Mismatch a
- Pantry: data Package
+ Pantry: data () => Package
- Pantry: data PackageIdentifier
+ Pantry: data () => PackageIdentifier
- Pantry: data PackageIdentifierRevision
+ Pantry: data () => PackageIdentifierRevision
- Pantry: data PackageIndexConfig
+ Pantry: data () => PackageIndexConfig
- Pantry: data PackageLocation
+ Pantry: data () => PackageLocation
- Pantry: data PackageLocationImmutable
+ Pantry: data () => PackageLocationImmutable
- Pantry: data PackageMetadata
+ Pantry: data () => PackageMetadata
- Pantry: data PackageName
+ Pantry: data () => PackageName
- Pantry: data PantryConfig
+ Pantry: data () => PantryConfig
- Pantry: data PantryException
+ Pantry: data () => PantryException
- Pantry: data PrintWarnings
+ Pantry: data () => PrintWarnings
- Pantry: data RawArchive
+ Pantry: data () => RawArchive
- Pantry: data RawPackageLocation
+ Pantry: data () => RawPackageLocation
- Pantry: data RawPackageLocationImmutable
+ Pantry: data () => RawPackageLocationImmutable
- Pantry: data RawPackageMetadata
+ Pantry: data () => RawPackageMetadata
- Pantry: data RawSnapshot
+ Pantry: data () => RawSnapshot
- Pantry: data RawSnapshotLayer
+ Pantry: data () => RawSnapshotLayer
- Pantry: data RawSnapshotLocation
+ Pantry: data () => RawSnapshotLocation
- Pantry: data RawSnapshotPackage
+ Pantry: data () => RawSnapshotPackage
- Pantry: data Repo
+ Pantry: data () => Repo
- Pantry: data RepoType
+ Pantry: data () => RepoType
- Pantry: data ResolvedPath t
+ Pantry: data () => ResolvedPath t
- Pantry: data SHA256
+ Pantry: data () => SHA256
- Pantry: data SafeFilePath
+ Pantry: data () => SafeFilePath
- Pantry: data SimpleRepo
+ Pantry: data () => SimpleRepo
- Pantry: data SnapName
+ Pantry: data () => SnapName
- Pantry: data Snapshot
+ Pantry: data () => Snapshot
- Pantry: data SnapshotLayer
+ Pantry: data () => SnapshotLayer
- Pantry: data SnapshotLocation
+ Pantry: data () => SnapshotLocation
- Pantry: data SnapshotPackage
+ Pantry: data () => SnapshotPackage
- Pantry: data Unresolved a
+ Pantry: data () => Unresolved a
- Pantry: data Version
+ Pantry: data () => Version
- Pantry: data WantedCompiler
+ Pantry: data () => WantedCompiler
- Pantry: newtype CabalString a
+ Pantry: newtype () => CabalString a
- Pantry: newtype FileSize
+ Pantry: newtype () => FileSize
- Pantry: newtype RelFilePath
+ Pantry: newtype () => RelFilePath
- Pantry: newtype Revision
+ Pantry: newtype () => Revision
- Pantry: newtype SnapshotCacheHash
+ Pantry: newtype () => SnapshotCacheHash
- Pantry: newtype TreeKey
+ Pantry: newtype () => TreeKey
- Pantry.Internal.Stackage: data PantryConfig
+ Pantry.Internal.Stackage: data () => PantryConfig
- Pantry.Internal.Stackage: data SafeFilePath
+ Pantry.Internal.Stackage: data () => SafeFilePath
- Pantry.Internal.Stackage: data Storage
+ Pantry.Internal.Stackage: data () => Storage
- Pantry.Internal.Stackage: data family Key record
+ Pantry.Internal.Stackage: data family EntityField record :: Type -> Type
- Pantry.Internal.Stackage: newtype ModuleNameP
+ Pantry.Internal.Stackage: newtype () => ModuleNameP
- Pantry.Internal.Stackage: newtype PackageNameP
+ Pantry.Internal.Stackage: newtype () => PackageNameP
- Pantry.Internal.Stackage: newtype VersionP
+ Pantry.Internal.Stackage: newtype () => VersionP
- Pantry.SQLite: data Storage
+ Pantry.SQLite: data () => Storage
Files
- CONTRIBUTING.md +298/−0
- ChangeLog.md +6/−0
- int/Pantry/Types.hs +8/−8
- pantry.cabal +354/−353
- src/Pantry.hs +25/−1
- src/Pantry/Repo.hs +24/−8
- test/Pantry/TypesSpec.hs +15/−15
+ CONTRIBUTING.md view
@@ -0,0 +1,298 @@+# Contributors Guide + +Thank you for considering contributing to the maintenance or development of +pantry! We hope that the following information will encourage and assist you. We +start with some advice about pantry's governance. + +## pantry's governance + +People involved in maintaining or developing pantry with rights to make commits +to the repository can be classified into two groups: 'committers' and +'maintainers'. + +### pantry's committers + +We encourages a wide range of people to be granted rights to make commits to the +repository. + +People are encouraged to take initiative to make non-controversial changes, such +as documentation improvements, bug fixes, performance improvements, and feature enhancements. + +Maintainers should be included in discussions of controversial changes and +tricky code changes. + +Our general approach is **"it's easier to ask forgiveness than permission"**. If +there is ever a bad change, it can always be rolled back. + +### pantry's maintainers + +pantry's maintainers are long-term contributors to the project. Michael Snoyman +(@snoyberg) was the founder of pantry, and its initial maintainer - and he has +added others. Michael's current interests and priorities mean that he is no +longer actively involved in adding new features to pantry. + +Maintainers are recognized for their contributions including: + +* Direct code contribution +* Review of pull requests +* Interactions on the GitHub issue tracker + +The maintainer team make certain decisions when that is necessary, specifically: + +* How to proceed, if there is disagreement on how to do so on a specific topic +* Whether to add or remove (see further below) a maintainer + +Generally, maintainers are only removed due to non-participation or actions +unhealthy to the project. Removal due to non-participation is not a punishment, +simply a recognition that maintainership is for active participants only. + +We hope that removal due to unhealthy actions will never be necessary, but would +include protection for cases of: + +* Disruptive behavior in public channels related to pantry +* Impairing the codebase through bad commits/merges + +Like committers, maintainers are broadly encouraged to make autonomous +decisions. Each maintainer is empowered to make a unilateral decision. However, +maintainers should favor getting consensus first if: + +* They are uncertain what is the best course of action +* They anticipate that other maintainers or users of pantry will disagree on the + decision + +## Bug Reports + +Please [open an issue](https://github.com/commercialhaskell/pantry/issues/new) +and use the provided template to include all necessary details. + +The more detailed your report, the faster it can be resolved and will ensure it +is resolved in the right way. Once your bug has been resolved, the responsible +person will tag the issue as _Needs confirmation_ and assign the issue back to +you. Once you have tested and confirmed that the issue is resolved, close the +issue. If you are not a member of the project, you will be asked for +confirmation and we will close it. + +## Error messages + +To support the Haskell Foundation's +[Haskell Error Index](https://errors.haskell.org/) initiative, all pantry +error messages generated by pantry itself should have a unique initial line: + +~~~text +Error: [S-nnn] +~~~ + +where `nnn` is a three-digit number in the range 100 to 999. + +If you create a new pantry error, select a number using a random number +generator (see, for example, [RANDOM.ORG](https://www.random.org/)) and check +that number is not already in use in pantry's code. If it is, pick another until +the number is unique. + +All exceptions generated by pantry itself are implemented using data +constructors of closed sum types. Typically, there is one such type for each +module that exports functions that throw exceptions. + +## Code + +If you would like to contribute code to fix a bug, add a new feature, or +otherwise improve pantry, pull requests are most welcome. It's a good idea to +[submit an issue](https://github.com/commercialhaskell/pantry/issues/new) to +discuss the change before plowing into writing code. + +Please include a +[ChangeLog](https://github.com/commercialhaskell/pantry/blob/master/ChangeLog.md) +entry with your pull request. + +## Code Quality + +The pantry project uses [yamllint](https://github.com/adrienverge/yamllint) as a +YAML file quality tool and [HLint](https://github.com/ndmitchell/hlint) as a +code quality tool. + +### Linting of YAML files + +The yamllint configuration extends the tools default and is set out in +`.yamllint.yaml`. In particular, indentation is set at 2 spaces and `- ` in +sequences is treated as part of the indentation. + +### Linting of Haskell source code + +The HLint configurations is set out in `.hlint.yaml`. + +pantry contributors need not follow dogmatically the suggested HLint hints but +are encouraged to debate their usefulness. If you find a HLint hint is not +useful and detracts from readability of code, consider marking it in the +[configuration file](https://github.com/commercialhaskell/pantry/blob/master/.hlint.yaml) +to be ignored. Please refer to the +[HLint manual](https://github.com/ndmitchell/hlint#readme) +for configuration syntax. + +We are optimizing for code clarity, not code concision or what HLint thinks. + +You can install HLint with Stack. You might want to install it in the global +project in case you run into dependency conflicts. HLint can report hints in +your favourite text editor. Refer to the HLint repository for more details. + +To install, command: + +~~~text +stack install hlint +~~~ + +## Code Style + +A single code style is not applied consistently to pantry's code and pantry is +not Procrustean about matters of style. Rules of thumb, however, are: + +* keep pull requests that simply reformat code separate from those that make + other changes to code; and +* when making changes to code other than reformatting, follow the existing style + of the function(s) or module(s) in question. + +That said, the following may help: + +* pantry's code generally avoids the use of C preprocessor (CPP) directives. + Windows and non-Windows code is separated in separate source code directories + and distinguished in pantry's Cabal file. Multi-line strings are generally + formatted on the assumption that GHC's `CPP` language pragma is not being + used. +* Language pragmas usually start with `NoImplictPrelude`, where applicable, and + then all others are listed alphabetically. The closing `#-}` are aligned, for + purely aesthetic reasons. +* pantry is compiled with GHC's `-Wall` enabled, which includes `-Wtabs` (no + tabs in source code). Most modules are based on two spaces (with one space for + a `where`) for indentation but older and larger modules are still based on + four spaces. +* pantry's code and documentation tends to be based on lines of no more than 80 + characters or, if longer, no longer than necessary. +* pantry uses export lists. +* pantry's imports are listed alphabetically. The module names are left aligned, + with space left for `qualified` where it is absent. +* pantry's code is sufficiently stable that explict import lists can sensibly be + used. Not all modules have comprehensive explicit import lists. +* Short explicit import lists follow the module name. Longer lists start on the + line below the module name. Spaces are used to separate listed items from + their enclosing parentheses. +* In function type signatures, the `::` is kept on the same line as the + function's name. This format is Haskell syntax highlighter-friendly. +* If `where` is used, the declarations follow on a separate line. + +## Continuous integration (CI) + +We use [GitHub Actions](https://docs.github.com/en/actions) to do CI on pantry. +The configuration of the workflows is in the YAML files in `.github/workflows`. +The current active workflows are: + +### Linting - `lint.yml` + +This workflow will run if: + +* there is a pull request +* commits are pushed to this branch: `master` + +The workflow has one job (`style`). It runs on `ubuntu` only and applies +yamllint and Hlint. + +### Stan tool - `stan.yml` + +[Stan](https://hackage.haskell.org/package/stan) is a Haskell static analysis +tool. As of `stan-0.1.0.1`, it supports GHC >= 9.6.3. The tool is configured by +the contents of the `.stan.toml` file. + +This workflow will run if: + +* there is a pull request +* requested + +## Haskell Language Server + +You may be using [Visual Studio Code](https://code.visualstudio.com/) (VS Code) +with its +[Haskell extension](https://marketplace.visualstudio.com/items?itemName=haskell.haskell), +which is powered by the +[Haskell Language Server](https://github.com/haskell/haskell-language-server) +(HLS). + +pantry can be built with Stack (which is recommended) or with Cabal (the tool). + +=== "Stack" + + If you use Stack to build Stack, command `stack ghci` in the root directory + of the pantry project should work as expected, if you have first commanded + `stack build` once. + + `ghc` should be on the PATH if you run VS Code itself in the Stack + environment: + ~~~text + stack exec -- code . + ~~~ + + The following [cradle (`hie.yaml`)](https://github.com/haskell/hie-bios) + should suffice to configure Haskell Language Server (HLS) explicitly for + each of the buildable components in pantry's Cabal file: + ~~~yaml + cradle: + stack: + - path: "./src" + component: "pantry:lib" + - path: "./int" + component: "pantry:lib" + - path: "./app" + component: "pantry:exe:test-pretty-exceptions" + - path: "./test" + component: "pantry:test:spec" + ~~~ + +=== "Cabal (the tool)" + + If you use Cabal (the tool) to build Stack, command `cabal repl` in the root + directory of the Stack project should work as expected, if you have GHC and + (on Windows) MSYS2 on the PATH. + + `ghc` and (on Windows) MSYS2 should be on the PATH if you run commands + (including `cabal`) in the Stack environment: + ~~~text + stack exec --no-ghc-package-path -- cabal repl + ~~~ + + or + ~~~text + stack exec --no-ghc-package-path -- code . + ~~~ + + Use of GHC's environment variable `GHC_PACKAGE_PATH` is not compatible with + Cabal (the tool). That is why the `--no-ghc-package-path` flag must be + specified with `stack exec` when relying on Cabal (the tool). + + The following [cradle (`hie.yaml`)](https://github.com/haskell/hie-bios) + should suffice to configure Haskell Language Server (HLS) explicitly for + each of the buildable components in pantry's Cabal file: + ~~~yaml + cradle: + cabal: + - path: "./src" + component: "lib:pantry" + - path: "./int" + component: "lib:pantry" + - path: "./app" + component: "exe:test-pretty-exceptions" + - path: "./test" + component: "test:spec" + ~~~ + +A cradle is not committed to pantry's repository because it imposes a choice of +build tool. + +## Slack channel + +If you're making deep changes and real-time communication with the pantry team +would be helpful, we have a `#stack-collaborators` Slack channel in the +Haskell Foundation workspace. To join the workspace, follow this +[link](https://haskell-foundation.slack.com/join/shared_invite/zt-z45o9x38-8L55P27r12YO0YeEufcO2w#/shared-invite/email). + +## Matrix room + +There is also a +[Stack and Stackage room](https://matrix.to/#/#haskell-stack:matrix.org) +at address `#haskell-stack:matrix.org` on [Matrix](https://matrix.org/).
ChangeLog.md view
@@ -1,5 +1,11 @@ # Changelog for pantry +## v0.9.3.2 + +* Support `ansi-terminal-1.0.2`. +* Bug fix: On Windows, `loadPackageRaw` supports repositories with submodules, + as intended. + ## v0.9.3.1 * Depend on `aeson-warning-parser-0.1.1`.
int/Pantry/Types.hs view
@@ -1225,7 +1225,7 @@ <> displayShow (toFilePath dir) display (InvalidOverrideCompiler x y) = "Error: [S-287]\n" - <> "Specified compiler for a resolver (" + <> "Specified compiler for a snapshot (" <> display x <> "), but also specified an override compiler (" <> display y @@ -1605,7 +1605,7 @@ "[S-287]" <> line <> fillSep - [ flow "Specified compiler for a resolver" + [ flow "Specified compiler for a snapshot" , parens (style Shell (fromString . T.unpack $ textDisplay x)) , flow "but also specified an override compiler" , parens (style Shell (fromString . T.unpack $ textDisplay y)) <> "." @@ -3225,17 +3225,17 @@ instance FromJSON (WithJSONWarnings (Unresolved RawSnapshotLayer)) where parseJSON = withObjectWarnings "Snapshot" $ \o -> do _ :: Maybe Text <- o ..:? "name" -- avoid warnings for old snapshot format - mcompiler <- o ..:? "compiler" - mresolver <- jsonSubWarningsT $ o ...:? ["snapshot", "resolver"] + mCompiler <- o ..:? "compiler" + mSnapshot <- jsonSubWarningsT $ o ...:? ["snapshot", "resolver"] unresolvedSnapshotParent <- - case (mcompiler, mresolver) of - (Nothing, Nothing) -> fail "Snapshot must have either resolver or compiler" + case (mCompiler, mSnapshot) of + (Nothing, Nothing) -> fail "Snapshot must have either a compiler or a snapshot" (Just compiler, Nothing) -> pure $ pure (RSLCompiler compiler, Nothing) (_, Just (Unresolved usl)) -> pure $ Unresolved $ \mdir -> do sl <- usl mdir - case (sl, mcompiler) of + case (sl, mCompiler) of (RSLCompiler c1, Just c2) -> throwIO $ InvalidOverrideCompiler c1 c2 - _ -> pure (sl, mcompiler) + _ -> pure (sl, mCompiler) unresolvedLocs <- jsonSubWarningsT (o ..:? "packages" ..!= []) rslDropPackages <- Set.map unCabalString <$> (o ..:? "drop-packages" ..!= Set.empty)
pantry.cabal view
@@ -1,354 +1,355 @@ cabal-version: 2.0 - --- This file has been generated from package.yaml by hpack version 0.36.0. --- --- see: https://github.com/sol/hpack - -name: pantry -version: 0.9.3.1 -synopsis: Content addressable Haskell package management -description: Please see the README on GitHub at <https://github.com/commercialhaskell/pantry#readme> -category: Development -homepage: https://github.com/commercialhaskell/pantry#readme -bug-reports: https://github.com/commercialhaskell/pantry/issues -author: Michael Snoyman -maintainer: michael@snoyman.com -copyright: 2018-2022 FP Complete -license: BSD3 -license-file: LICENSE -build-type: Simple -extra-source-files: - README.md - ChangeLog.md - attic/hpack-0.1.2.3.tar.gz - attic/package-0.1.2.3.tar.gz - attic/symlink-to-dir.tar.gz - -source-repository head - type: git - location: https://github.com/commercialhaskell/pantry - -flag test-pretty-exceptions - description: Build an executable to test pretty exceptions - manual: False - default: False - -library - exposed-modules: - Pantry - Pantry.SQLite - Pantry.Internal.Stackage - other-modules: - Hackage.Security.Client.Repository.HttpLib.HttpClient - Pantry.Archive - Pantry.HTTP - Pantry.Hackage - Pantry.Repo - Pantry.Storage - Pantry.Casa - Pantry.Tree - reexported-modules: - Pantry.SHA256 - hs-source-dirs: - src/ - ghc-options: -fwrite-ide-info -hiedir=.hie -Wall - build-depends: - Cabal >=3 && <3.11 - , aeson - , aeson-warning-parser >=0.1.1 - , ansi-terminal - , base >=4.10 && <5 - , bytestring - , casa-client >=0.0.2 - , casa-types - , companion - , conduit - , conduit-extra - , containers - , crypton - , crypton-conduit - , digest - , filelock - , generic-deriving - , hackage-security - , hpack >=0.35.3 - , http-client - , http-client-tls >=0.3.6.2 - , http-conduit - , http-download >=0.2.1.0 - , http-types - , internal - , memory - , mtl - , network-uri - , path - , path-io - , persistent - , persistent-sqlite >=2.9.3 - , persistent-template - , primitive - , resourcet - , rio - , rio-orphans - , rio-prettyprint >=0.1.7.0 - , static-bytes - , tar-conduit >=0.4.0 - , text - , text-metrics - , time - , transformers - , unix-compat - , unliftio - , unordered-containers - , vector - , yaml - , zip-archive - default-language: Haskell2010 - if impl(ghc >= 9.4.5) && os(windows) - build-depends: - network >=3.1.2.9 - if os(windows) - other-modules: - System.IsWindows - hs-source-dirs: - src/windows/ - else - other-modules: - System.IsWindows - hs-source-dirs: - src/unix/ - -library internal - exposed-modules: - Pantry.HPack - Pantry.Internal - Pantry.SHA256 - Pantry.Types - other-modules: - Paths_pantry - autogen-modules: - Paths_pantry - hs-source-dirs: - int/ - ghc-options: -fwrite-ide-info -hiedir=.hie -Wall - build-depends: - Cabal >=3 && <3.11 - , aeson - , aeson-warning-parser >=0.1.1 - , ansi-terminal - , base >=4.10 && <5 - , bytestring - , casa-client >=0.0.2 - , casa-types - , companion - , conduit - , conduit-extra - , containers - , crypton - , crypton-conduit - , digest - , filelock - , generic-deriving - , hackage-security - , hpack >=0.35.3 - , http-client - , http-client-tls >=0.3.6.2 - , http-conduit - , http-download >=0.2.1.0 - , http-types - , memory - , mtl - , network-uri - , path - , path-io - , persistent - , persistent-sqlite >=2.9.3 - , persistent-template - , primitive - , resourcet - , rio - , rio-orphans - , rio-prettyprint >=0.1.7.0 - , static-bytes - , tar-conduit >=0.4.0 - , text - , text-metrics - , time - , transformers - , unix-compat - , unliftio - , unordered-containers - , vector - , yaml - , zip-archive - default-language: Haskell2010 - if impl(ghc >= 9.4.5) && os(windows) - build-depends: - network >=3.1.2.9 - -executable test-pretty-exceptions - main-is: Main.hs - other-modules: - Paths_pantry - autogen-modules: - Paths_pantry - hs-source-dirs: - app/test-pretty-exceptions - ghc-options: -fwrite-ide-info -hiedir=.hie -Wall - build-depends: - Cabal >=3 && <3.11 - , aeson - , aeson-warning-parser >=0.1.1 - , ansi-terminal - , base >=4.10 && <5 - , bytestring - , casa-client >=0.0.2 - , casa-types - , companion - , conduit - , conduit-extra - , containers - , crypton - , crypton-conduit - , digest - , filelock - , generic-deriving - , hackage-security - , hpack >=0.35.3 - , http-client - , http-client-tls >=0.3.6.2 - , http-conduit - , http-download >=0.2.1.0 - , http-types - , memory - , mtl - , network-uri - , optparse-applicative - , pantry - , path - , path-io - , persistent - , persistent-sqlite >=2.9.3 - , persistent-template - , primitive - , resourcet - , rio - , rio-orphans - , rio-prettyprint >=0.1.7.0 - , static-bytes - , tar-conduit >=0.4.0 - , text - , text-metrics - , time - , transformers - , unix-compat - , unliftio - , unordered-containers - , vector - , yaml - , zip-archive - default-language: Haskell2010 - if impl(ghc >= 9.4.5) && os(windows) - build-depends: - network >=3.1.2.9 - if !flag(test-pretty-exceptions) - buildable: False - if os(windows) - other-modules: - PathAbsExamples - System.Terminal - hs-source-dirs: - app/test-pretty-exceptions/windows/ - build-depends: - Win32 - , process - else - other-modules: - PathAbsExamples - System.Terminal - hs-source-dirs: - app/test-pretty-exceptions/unix/ - -test-suite spec - type: exitcode-stdio-1.0 - main-is: Spec.hs - other-modules: - Pantry.ArchiveSpec - Pantry.BuildPlanSpec - Pantry.CabalSpec - Pantry.CasaSpec - Pantry.FileSpec - Pantry.GlobalHintsSpec - Pantry.HackageSpec - Pantry.InternalSpec - Pantry.TreeSpec - Pantry.TypesSpec - Paths_pantry - autogen-modules: - Paths_pantry - hs-source-dirs: - test - ghc-options: -fwrite-ide-info -hiedir=.hie -Wall - build-tool-depends: - hspec-discover:hspec-discover - build-depends: - Cabal >=3 && <3.11 - , QuickCheck - , aeson - , aeson-warning-parser >=0.1.1 - , ansi-terminal - , base >=4.10 && <5 - , bytestring - , casa-client >=0.0.2 - , casa-types - , companion - , conduit - , conduit-extra - , containers - , crypton - , crypton-conduit - , digest - , exceptions - , filelock - , generic-deriving - , hackage-security - , hedgehog - , hpack >=0.35.3 - , hspec - , http-client - , http-client-tls >=0.3.6.2 - , http-conduit - , http-download >=0.2.1.0 - , http-types - , internal - , memory - , mtl - , network-uri - , pantry - , path - , path-io - , persistent - , persistent-sqlite >=2.9.3 - , persistent-template - , primitive - , raw-strings-qq - , resourcet - , rio - , rio-orphans - , rio-prettyprint >=0.1.7.0 - , static-bytes - , tar-conduit >=0.4.0 - , text - , text-metrics - , time - , transformers - , unix-compat - , unliftio - , unordered-containers - , vector - , yaml - , zip-archive - default-language: Haskell2010 - if impl(ghc >= 9.4.5) && os(windows) - build-depends: - network >=3.1.2.9 ++-- This file has been generated from package.yaml by hpack version 0.36.0.+--+-- see: https://github.com/sol/hpack++name: pantry+version: 0.9.3.2+synopsis: Content addressable Haskell package management+description: Please see the README on GitHub at <https://github.com/commercialhaskell/pantry#readme>+category: Development+homepage: https://github.com/commercialhaskell/pantry#readme+bug-reports: https://github.com/commercialhaskell/pantry/issues+author: Michael Snoyman+maintainer: michael@snoyman.com+copyright: 2018-2022 FP Complete+license: BSD3+license-file: LICENSE+build-type: Simple+extra-source-files:+ CONTRIBUTING.md+ README.md+ ChangeLog.md+ attic/hpack-0.1.2.3.tar.gz+ attic/package-0.1.2.3.tar.gz+ attic/symlink-to-dir.tar.gz++source-repository head+ type: git+ location: https://github.com/commercialhaskell/pantry++flag test-pretty-exceptions+ description: Build an executable to test pretty exceptions+ manual: False+ default: False++library+ exposed-modules:+ Pantry+ Pantry.SQLite+ Pantry.Internal.Stackage+ other-modules:+ Hackage.Security.Client.Repository.HttpLib.HttpClient+ Pantry.Archive+ Pantry.HTTP+ Pantry.Hackage+ Pantry.Repo+ Pantry.Storage+ Pantry.Casa+ Pantry.Tree+ reexported-modules:+ Pantry.SHA256+ hs-source-dirs:+ src/+ ghc-options: -fwrite-ide-info -hiedir=.hie -Wall+ build-depends:+ Cabal >=3 && <3.11+ , aeson+ , aeson-warning-parser >=0.1.1+ , ansi-terminal+ , base >=4.13 && <5+ , bytestring+ , casa-client >=0.0.2+ , casa-types+ , companion+ , conduit+ , conduit-extra+ , containers+ , crypton+ , crypton-conduit+ , digest+ , filelock+ , generic-deriving+ , hackage-security+ , hpack >=0.35.3+ , http-client+ , http-client-tls >=0.3.6.2+ , http-conduit+ , http-download >=0.2.1.0+ , http-types+ , internal+ , memory+ , mtl+ , network-uri+ , path+ , path-io+ , persistent+ , persistent-sqlite >=2.9.3+ , persistent-template+ , primitive+ , resourcet+ , rio+ , rio-orphans+ , rio-prettyprint >=0.1.7.0+ , static-bytes+ , tar-conduit >=0.4.1+ , text+ , text-metrics+ , time+ , transformers+ , unix-compat+ , unliftio+ , unordered-containers+ , vector+ , yaml+ , zip-archive+ default-language: Haskell2010+ if impl(ghc >= 9.4.5) && os(windows)+ build-depends:+ network >=3.1.2.9+ if os(windows)+ other-modules:+ System.IsWindows+ hs-source-dirs:+ src/windows/+ else+ other-modules:+ System.IsWindows+ hs-source-dirs:+ src/unix/++library internal+ exposed-modules:+ Pantry.HPack+ Pantry.Internal+ Pantry.SHA256+ Pantry.Types+ other-modules:+ Paths_pantry+ autogen-modules:+ Paths_pantry+ hs-source-dirs:+ int/+ ghc-options: -fwrite-ide-info -hiedir=.hie -Wall+ build-depends:+ Cabal >=3 && <3.11+ , aeson+ , aeson-warning-parser >=0.1.1+ , ansi-terminal+ , base >=4.13 && <5+ , bytestring+ , casa-client >=0.0.2+ , casa-types+ , companion+ , conduit+ , conduit-extra+ , containers+ , crypton+ , crypton-conduit+ , digest+ , filelock+ , generic-deriving+ , hackage-security+ , hpack >=0.35.3+ , http-client+ , http-client-tls >=0.3.6.2+ , http-conduit+ , http-download >=0.2.1.0+ , http-types+ , memory+ , mtl+ , network-uri+ , path+ , path-io+ , persistent+ , persistent-sqlite >=2.9.3+ , persistent-template+ , primitive+ , resourcet+ , rio+ , rio-orphans+ , rio-prettyprint >=0.1.7.0+ , static-bytes+ , tar-conduit >=0.4.1+ , text+ , text-metrics+ , time+ , transformers+ , unix-compat+ , unliftio+ , unordered-containers+ , vector+ , yaml+ , zip-archive+ default-language: Haskell2010+ if impl(ghc >= 9.4.5) && os(windows)+ build-depends:+ network >=3.1.2.9++executable test-pretty-exceptions+ main-is: Main.hs+ other-modules:+ Paths_pantry+ autogen-modules:+ Paths_pantry+ hs-source-dirs:+ app/test-pretty-exceptions+ ghc-options: -fwrite-ide-info -hiedir=.hie -Wall+ build-depends:+ Cabal >=3 && <3.11+ , aeson+ , aeson-warning-parser >=0.1.1+ , ansi-terminal+ , base >=4.13 && <5+ , bytestring+ , casa-client >=0.0.2+ , casa-types+ , companion+ , conduit+ , conduit-extra+ , containers+ , crypton+ , crypton-conduit+ , digest+ , filelock+ , generic-deriving+ , hackage-security+ , hpack >=0.35.3+ , http-client+ , http-client-tls >=0.3.6.2+ , http-conduit+ , http-download >=0.2.1.0+ , http-types+ , memory+ , mtl+ , network-uri+ , optparse-applicative+ , pantry+ , path+ , path-io+ , persistent+ , persistent-sqlite >=2.9.3+ , persistent-template+ , primitive+ , resourcet+ , rio+ , rio-orphans+ , rio-prettyprint >=0.1.7.0+ , static-bytes+ , tar-conduit >=0.4.1+ , text+ , text-metrics+ , time+ , transformers+ , unix-compat+ , unliftio+ , unordered-containers+ , vector+ , yaml+ , zip-archive+ default-language: Haskell2010+ if impl(ghc >= 9.4.5) && os(windows)+ build-depends:+ network >=3.1.2.9+ if !flag(test-pretty-exceptions)+ buildable: False+ if os(windows)+ other-modules:+ PathAbsExamples+ System.Terminal+ hs-source-dirs:+ app/test-pretty-exceptions/windows/+ build-depends:+ Win32+ , process+ else+ other-modules:+ PathAbsExamples+ System.Terminal+ hs-source-dirs:+ app/test-pretty-exceptions/unix/++test-suite spec+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ other-modules:+ Pantry.ArchiveSpec+ Pantry.BuildPlanSpec+ Pantry.CabalSpec+ Pantry.CasaSpec+ Pantry.FileSpec+ Pantry.GlobalHintsSpec+ Pantry.HackageSpec+ Pantry.InternalSpec+ Pantry.TreeSpec+ Pantry.TypesSpec+ Paths_pantry+ autogen-modules:+ Paths_pantry+ hs-source-dirs:+ test+ ghc-options: -fwrite-ide-info -hiedir=.hie -Wall+ build-tool-depends:+ hspec-discover:hspec-discover+ build-depends:+ Cabal >=3 && <3.11+ , QuickCheck+ , aeson+ , aeson-warning-parser >=0.1.1+ , ansi-terminal+ , base >=4.13 && <5+ , bytestring+ , casa-client >=0.0.2+ , casa-types+ , companion+ , conduit+ , conduit-extra+ , containers+ , crypton+ , crypton-conduit+ , digest+ , exceptions+ , filelock+ , generic-deriving+ , hackage-security+ , hedgehog+ , hpack >=0.35.3+ , hspec+ , http-client+ , http-client-tls >=0.3.6.2+ , http-conduit+ , http-download >=0.2.1.0+ , http-types+ , internal+ , memory+ , mtl+ , network-uri+ , pantry+ , path+ , path-io+ , persistent+ , persistent-sqlite >=2.9.3+ , persistent-template+ , primitive+ , raw-strings-qq+ , resourcet+ , rio+ , rio-orphans+ , rio-prettyprint >=0.1.7.0+ , static-bytes+ , tar-conduit >=0.4.1+ , text+ , text-metrics+ , time+ , transformers+ , unix-compat+ , unliftio+ , unordered-containers+ , vector+ , yaml+ , zip-archive+ default-language: Haskell2010+ if impl(ghc >= 9.4.5) && os(windows)+ build-depends:+ network >=3.1.2.9
src/Pantry.hs view
@@ -1833,7 +1833,31 @@ -- using 'withPantryConfig' or 'withPantryConfig'' directly. Uses basically sane -- settings, like sharing a pantry directory with Stack. -- --- You can use 'runPantryApp' to use this. +-- You can use 'runPantryApp' to use this. A simple example is: +-- +-- > {-# LANGUAGE OverloadedStrings #-} +-- > +-- > module Main (main) where +-- > +-- > -- From package Cabal-syntax +-- > import Distribution.Types.Version ( mkVersion ) +-- > -- From package pantry +-- > import Pantry +-- > ( CabalFileInfo (..), PackageIdentifierRevision (..), PantryApp +-- > , RawPackageLocationImmutable (..), loadPackageRaw, runPantryApp +-- > ) +-- > -- From package rio +-- > import RIO ( RIO, liftIO ) +-- > +-- > main :: IO () +-- > main = runPantryApp myPantryApp +-- > +-- > myPantryApp :: RIO PantryApp () +-- > myPantryApp = loadPackageRaw baseLocation >>= liftIO . print +-- > where +-- > baseVersion = mkVersion [4, 19, 0, 0] +-- > basePkgId = PackageIdentifierRevision "base" baseVersion CFILatest +-- > baseLocation = RPLIHackage basePkgId Nothing -- -- @since 0.1.0.0 data PantryApp = PantryApp
src/Pantry/Repo.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} @@ -43,7 +44,11 @@ , withWorkingDir ) import qualified RIO.Text as T +#if MIN_VERSION_ansi_terminal(1, 0, 2) +import System.Console.ANSI ( hNowSupportsANSI ) +#else import System.Console.ANSI ( hSupportsANSIWithoutEmulation ) +#endif import System.IsWindows ( osIsWindows ) data TarType = Gnu | Bsd @@ -238,13 +243,19 @@ then " --force-local " else mempty case tarType of - Gnu -> runGitCommand - [ "submodule" - , "foreach" - , "--recursive" - , "git -c core.autocrlf=false archive --prefix=$displaypath/ -o bar.tar HEAD; " - <> "tar" <> forceLocal <> " -Af " <> tarball <> " bar.tar" - ] + Gnu -> do + -- Single quotation marks are required around tarball because otherwise, + -- in the foreach environment, the \ character in absolute paths on + -- Windows will be interpreted as escaping the following character. + let foreachCommand = + "git -c core.autocrlf=false archive --prefix=$displaypath/ -o bar.tar HEAD; " + <> "tar" <> forceLocal <> " -Af '" <> tarball <> "' bar.tar" + runGitCommand + [ "submodule" + , "foreach" + , "--recursive" + , foreachCommand + ] Bsd -> runGitCommand [ "submodule" , "foreach" @@ -311,7 +322,12 @@ -- that command clears, but does not then restore, the -- ENABLE_VIRTUAL_TERMINAL_PROCESSING flag for native terminals. The -- following hack re-enables the lost ANSI-capability. - when osIsWindows $ void $ liftIO $ hSupportsANSIWithoutEmulation stdout + when osIsWindows $ void $ liftIO $ +#if MIN_VERSION_ansi_terminal(1, 0, 2) + hNowSupportsANSI stdout +#else + hSupportsANSIWithoutEmulation stdout +#endif logInfo $ "Cloning " <> display sRepoCommit <> " from " <> display sRepoUrl runCommand ["clone", repoUrl, dir] fixANSIForWindows
test/Pantry/TypesSpec.hs view
@@ -24,7 +24,7 @@ ( Tree (..), TreeEntry (..), parseTree, renderTree ) import RIO import qualified RIO.Text as T -import RIO.Time ( Day (..) ) +import RIO.Time ( Day (..), fromGregorian ) import Test.Hspec import Text.RawString.QQ @@ -108,20 +108,20 @@ it "parses snapshot using 'resolver'" $ do RawSnapshotLayer{..} <- parseSl $ "name: 'test'\n" ++ - "resolver: lts-2.10\n" - rslParent `shouldBe` RSLSynonym (LTS 2 10) + "resolver: lts-22.9\n" + rslParent `shouldBe` RSLSynonym (LTS 22 9) it "parses snapshot using 'snapshot'" $ do RawSnapshotLayer{..} <- parseSl $ "name: 'test'\n" ++ - "snapshot: lts-2.10\n" - rslParent `shouldBe` RSLSynonym (LTS 2 10) + "snapshot: lts-22.9\n" + rslParent `shouldBe` RSLSynonym (LTS 22 9) it "throws if both 'resolver' and 'snapshot' are present" $ do let go = parseSl $ "name: 'test'\n" ++ - "resolver: lts-2.10\n" ++ - "snapshot: lts-2.10\n" + "resolver: lts-22.9\n" ++ + "snapshot: lts-22.9\n" go `shouldThrow` anyException it "throws if both 'snapshot' and 'compiler' are not present" $ do @@ -131,8 +131,8 @@ it "works if no 'snapshot' specified" $ do RawSnapshotLayer{..} <- parseSl $ "name: 'test'\n" ++ - "compiler: ghc-8.0.1\n" - rslParent `shouldBe` RSLCompiler (WCGhc (mkVersion [8, 0, 1])) + "compiler: ghc-9.6.4\n" + rslParent `shouldBe` RSLCompiler (WCGhc (mkVersion [9, 6, 4])) hh "rendering the name of an LTS to JSON" $ property $ do (major, minor) <- forAll $ (,) @@ -211,14 +211,14 @@ txt `shouldBe` txt'' sameUrl _ _ _ = liftIO $ error "Snapshot synonym did not complete as expected" - it "default location for nightly-2020-01-01" $ do - let sn = Nightly $ ModifiedJulianDay 58849 + it "default location for nightly-2024-02-04" $ do + let sn = Nightly $ fromGregorian 2024 2 4 loc <- runPantryAppClean $ completeSnapshotLocation $ RSLSynonym sn sameUrl loc (defaultSnapshotLocation sn) - "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2020/1/1.yaml" + "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/nightly/2024/2/4.yaml" - it "default location for lts-15.1" $ do - let sn = LTS 15 1 + it "default location for lts-22.9" $ do + let sn = LTS 22 9 loc <- runPantryAppClean $ completeSnapshotLocation $ RSLSynonym sn sameUrl loc (defaultSnapshotLocation sn) - "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/15/1.yaml" + "https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/9.yaml"