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

Add cabal-hash revision info when displaying recommended packages when failing to construct buildplan #4068

Merged

Conversation

tdietert
Copy link
Contributor

@tdietert tdietert commented Jun 6, 2018

This PR addresses the following issue #3925

TODO:

  • Add changes to ChangeLog.md
  • Test the output of failed build plan package recommendations

Tested by removing the rio extra-dependency in the stack.yaml file and then trying to build the package with the newly generated stack executable.

. . .

  * Recommended action: try adding the following to your extra-deps in /home/thomas/github/stack/stack.yaml:

rio-0.1.2.0@sha256:cb2a65cee1c0450815002ca890633215e4544b5c1c9f7091a950142c6efe8f3f

@@ -22,7 +22,9 @@ import Stack.Prelude hiding (Display (..))
import Control.Monad.RWS.Strict hiding ((<>))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a note to the ChangeLog about the change and which issue it resolves?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the changelog 👍

@@ -135,7 +137,7 @@ data Ctx = Ctx
, ctxEnvConfig :: !EnvConfig
, callStack :: ![PackageName]
, extraToBuild :: !(Set PackageName)
, getVersions :: !(PackageName -> IO (Set Version))
, getVersions :: !(PackageName -> IO (HashMap Version (NE.NonEmpty CabalHash)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding our discussion: can you replace the NonEmpty CabalHash with either [CabalHash] or Maybe CabalHash and remove the usage of partial functions below? Alternatively, you could modify the original [CabalHash] to be a NonEmpty CabalHash.

@tdietert
Copy link
Contributor Author

tdietert commented Jun 7, 2018

Unfortunately, any modification to the [CabalHash] type that represents one or two cabal hashes (the latter encoding both the hash of the cabal file with and without carriage returns) returns the error:

/home/thomas/github/stack/src/Stack/PackageIndex.hs:416:21: error:
    • Exception when trying to run compile-time code:
        For Stack.Types.PackageIndex.PackageCache GHC.Tuple.()

Since I don't really have the time to dig into the template-haskell code right now, I will remove the use of the partial function Data.List.NonEmpty.fromList and instead use Data.List.NonEmpty.nonEmpty to capture the notion that the version may not have a properly parsed tarball file neither/nor correctly parshes/hashes the cabal revisions.

@tdietert
Copy link
Contributor Author

tdietert commented Jun 7, 2018

This PR should be ready to go barring no other requested changes 🎉

case latestApplicableVersion range vs of
Nothing -> pure Nothing
Just lappVer -> do
let mlappRev = join (HashMap.lookup lappVer vsAndRevs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice join!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants