-
Notifications
You must be signed in to change notification settings - Fork 847
Description
I found a way to confuse stack and require a manual removal of the local package database, or something to that effect. I haven't worked out all the details, but basically what I've done is this:
- Initialize a new project and add
persistentandpersistent-templateas dependencies (usinglts-3.4, this brings inpersistent-2.2andpersistent-template-2.1.3.4:
-- snapshot db
/Users/mrosen/.stack/snapshots/x86_64-osx/lts-3.4/7.10.2/pkgdb
persistent-2.2 (persistent-2.2-7814fec4f4ee40ea6b1f627410f1c9eb)
persistent-template-2.1.3.4 (persistent-template-2.1.3.4-4508b858709b85b5c0149527551ed9fc)
- Decide that I want to modify
persistentlocally and build against it, so I git clone it and add/path/to/local/persistentto my stack.yaml'spackages - Rebuild, which causes
persistent-templateto rebuild and depend on this localpersistent.
-- local db
/Users/mrosen/junk/.stack-work/install/x86_64-osx/lts-3.4/7.10.2/pkgdb
persistent-2.2 (persistent-2.2-3dd9b8c4bcaf5265acba55fc4993f288)
persistent-template-2.1.3.4 (persistent-template-2.1.3.4-4508b858709b85b5c0149527551ed9fc)
- Decide that I want to go back to building against the snapshot's
persistent, so I delete the line from stack.yaml - Get this error:
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package persistent-template-2.1.3.4 requires persistent-2.2
package junk-0.1.0.0 requires persistent-2.2
junk-0.1.0.0: build
Preprocessing library junk-0.1.0.0...
<command line>: cannot satisfy -package-id persistent-template-2.1.3.4-4508b858709b85b5c0149527551ed9fc:
persistent-template-2.1.3.4-4508b858709b85b5c0149527551ed9fc is unusable due to missing or recursive dependencies:
persistent-2.2-3dd9b8c4bcaf5265acba55fc4993f288
(use -v for more information)
I think I'm getting this error because junk is unregistered before rebuilding, but my local persistent-template and persistent are not. Thus, junk goes to depend on the snapshot persistent-2.2-7814fec4f4ee40ea6b1f627410f1c9eb, while my local persistent-template still depends on the local persistent-2.2-3dd9b8c4bcaf5265acba55fc4993f288.
I haven't figured out how to get out of this situation without rm -rfing the local package db and rebuilding.
Deleting local packages from stack.yaml and expecting stack to work 100% correctly might be asking too much. I know stack doesn't attempt to be any sort of package manager, nor support any cleaning up of build artifacts. Still, I don't feel I did anything too out the ordinary with temporarily shadowing a snapshot package with a local one. If anything, a stack clean && stack build should have "just worked", but stack clean doesn't appear to do anything :)