Typos in extra-deps aren't detected #1521

Closed
mgsloan opened this Issue Dec 16, 2015 · 1 comment

Projects

None yet

2 participants

@mgsloan
Collaborator
mgsloan commented Dec 16, 2015

Noticed this while helping L8D in #haskell

Repro:

  1. stack new issue1521
  2. cd issue1521
  3. Add hspec >= 2.2.1 to the test-suite build-depends
  4. Add the following to extra-deps:
- hspec-2.2.1 
- hspec-core-2.2.1 
- hspec-discover-2.2.1 
- hspec-epectations-0.7.2 

(Note the mis-spelled hspec-epectations)
5) stack test
6) Get this error:

While constructing the BuildPlan the following exceptions were encountered:

--  Failure when adding dependencies:    
      hspec-core: needed (==2.2.1), couldn't resolve its dependencies
      hspec-expectations: needed (==0.7.2.*), 0.7.1 found (latest applicable is 0.7.2)
    needed for package: hspec-2.2.1

--  Failure when adding dependencies:    
      hspec-expectations: needed (==0.7.2.*), 0.7.1 found (latest applicable is 0.7.2)
    needed for package: hspec-core-2.2.1

--  Failure when adding dependencies:    
      hspec: needed (>=2.2.1), couldn't resolve its dependencies
    needed for package: issue1521-0.1.0.0
@mgsloan mgsloan added the type: bug label Dec 16, 2015
@mgsloan mgsloan added this to the P1: Must milestone Dec 16, 2015
@borsboom borsboom modified the milestone: P2: Should, P1: Must Dec 21, 2015
@luigy luigy added a commit to luigy/stack that referenced this issue Feb 29, 2016
@luigy luigy detect missing extra-deps missing from indices
* it should now detect typos #1521
  (package suggestions will be added in another PR)
2a95c77
@luigy luigy added a commit to luigy/stack that referenced this issue Feb 29, 2016
@luigy luigy detect missing extra-deps from indices
* it should now detect typos #1521
  (package suggestions will be added in another PR)
8144ae6
@mgsloan mgsloan modified the milestone: P3: Optional, P2: Should Oct 24, 2016
@mgsloan
Collaborator
mgsloan commented Oct 24, 2016

In review of #1858 , this is actually quite tricky. The problem is that extra-deps might be fulfilled by packages globally installed. (e.g. docker container). Even then, we cannot be sure that it's missing in a way that should be a build failure, so it must just be a warning.

The solution here is to check if the extra-dep is already installed. If it isn't already installed, check if it is in the hackage index. If it isn't, then the warning is yielded. For this repro, it looks like this:

Warning: Some extra-deps are neither installed or in the index:
    * hspec-epectations0.7.2

Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for hspec-2.2.1:
    hspec-expectations-0.7.1 must match ==0.7.2.* (latest applicable is 0.7.2)
needed due to issue1521-0.1.0.0 -> hspec-2.2.1

In the dependencies for hspec-core-2.2.1:
    hspec-expectations-0.7.1 must match ==0.7.2.* (latest applicable is 0.7.2)
needed due to issue1521-0.1.0.0 -> hspec-core-2.2.1

Plan construction failed.
*** Exception: ExitFailure 1
@mgsloan mgsloan closed this Oct 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment