haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 697 forks source link

Cabal should suggest updating more prominently when it gets an unknown package. #2262

Open bitemyapp opened 9 years ago

bitemyapp commented 9 years ago
cumae:bloodhound callen$ cabal sandbox init
Config file path source is default config file.
Config file /Users/callen/.cabal/config not found.
Writing default configuration to /Users/callen/.cabal/config
Writing a default package environment file to
/Users/callen/work/bloodhound/cabal.sandbox.config
Creating a new sandbox at /Users/callen/work/bloodhound/.cabal-sandbox

cumae:bloodhound callen$ cabal install --enable-tests
Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal
update' to download it.
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: bloodhound-0.4.0.2 (user goal)
rejecting: bloodhound-0.4.0.2:!test (global constraint requires opposite flag
selection)
trying: bloodhound-0.4.0.2:*test
next goal: unordered-containers (dependency of bloodhound-0.4.0.2:*test)
fail (unknown package: unordered-containers)
Dependency tree exhaustively searched.

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

cumae:bloodhound callen$ cabal update
Downloading the latest package list from hackage.haskell.org
cumae:bloodhound callen$ cabal install --enable-tests
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/callen/work/bloodhound/.cabal-sandbox
Downloading HUnit-1.2.5.2...
Downloading ansi-terminal-0.6.2.1...
Configuring ansi-terminal-0.6.2.1...
Downloading base64-bytestring-1.0.0.1...
Configuring HUnit-1.2.5.2...
Downloading cereal-0.4.1.0...
bitemyapp commented 9 years ago

If y'all are fine with a whitespace offset for Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it., and assuming I can find it, I'll PR this.

bitemyapp commented 9 years ago

@mwotton raised a good point that if there's no index, you should probably just stop installing entirely as a mistake has been made by the user.

The "I have no dependencies and haven't bothered to update even once" use-case seems unlikely.

bitemyapp commented 9 years ago

Looks like this stuff lives in cabal-install/Distribution/Client/IndexUtils.hs - I'll try to see if I can find an example of how errors are raised.