Skip to content

Commit c5772d0

Browse files
committed
Unregister shadowing local packages commercialhaskell#992
1 parent c0525a2 commit c5772d0

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Bug fixes:
2222
* Build executables for local extra deps [#920](https://github.com/commercialhaskell/stack/issues/920)
2323
* copyFile can't handle directories [#942](https://github.com/commercialhaskell/stack/pull/942)
2424
* Support for spaces in Haddock interface files [fpco/minghc#85](https://github.com/fpco/minghc/issues/85)
25+
* Temporarily building against a "shadowing" local package? [#992](https://github.com/commercialhaskell/stack/issues/992)
2526

2627
## 0.1.4.1
2728

src/Stack/Build/ConstructPlan.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ constructPlan mbp0 baseConfigOpts0 locals extraToBuild0 locallyRegistered loadPa
161161
return $ takeSubset Plan
162162
{ planTasks = tasks
163163
, planFinals = M.fromList finals
164-
, planUnregisterLocal = mkUnregisterLocal tasks dirtyReason locallyRegistered
164+
, planUnregisterLocal = mkUnregisterLocal tasks dirtyReason locallyRegistered sourceMap
165165
, planInstallExes =
166166
if boptsInstallExes $ bcoBuildOpts baseConfigOpts0
167167
then installExes
@@ -193,13 +193,20 @@ constructPlan mbp0 baseConfigOpts0 locals extraToBuild0 locallyRegistered loadPa
193193
mkUnregisterLocal :: Map PackageName Task
194194
-> Map PackageName Text
195195
-> Map GhcPkgId PackageIdentifier
196+
-> SourceMap
196197
-> Map GhcPkgId (PackageIdentifier, Maybe Text)
197-
mkUnregisterLocal tasks dirtyReason locallyRegistered =
198+
mkUnregisterLocal tasks dirtyReason locallyRegistered sourceMap =
198199
Map.unions $ map toUnregisterMap $ Map.toList locallyRegistered
199200
where
200201
toUnregisterMap (gid, ident) =
201202
case M.lookup name tasks of
202-
Nothing -> Map.empty
203+
Nothing ->
204+
case M.lookup name sourceMap of
205+
Just (PSUpstream _ Snap _) -> Map.singleton gid
206+
( ident
207+
, Just "Switching to snapshot installed package"
208+
)
209+
_ -> Map.empty
203210
Just _ -> Map.singleton gid
204211
( ident
205212
, Map.lookup name dirtyReason

0 commit comments

Comments
 (0)