Skip to content

Commit

Permalink
Groups with different sources should not resolve to wrong packages - f…
Browse files Browse the repository at this point in the history
…ixes #1711
  • Loading branch information
forki committed May 31, 2016
1 parent 74ab7cf commit 2c8c845
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 6 deletions.
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 2.66.6 - 31.05.2016
* BUGFIX: Groups with different sources should not resolve to wrong packages - https://github.com/fsprojects/Paket/issues/1711

#### 2.66.5 - 30.05.2016
* BUGFIX: Don't remove trailing zero if version is in package path - https://github.com/fsprojects/Paket/issues/1708

Expand Down
22 changes: 21 additions & 1 deletion integrationtests/Paket.IntegrationTests/UpdateGroupsSpecs.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,24 @@ let ``#1018 update group legacy``() =
lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "NUnit"].Version
|> shouldEqual (SemVer.Parse "2.6.1")
lockFile.Groups.[GroupName "Legacy"].Resolution.[PackageName "Newtonsoft.Json"].Version
|> shouldBeGreaterThan (SemVer.Parse "5.0.2")
|> shouldBeGreaterThan (SemVer.Parse "5.0.2")

[<Test>]
let ``#1711 update main group with correct source``() =
update "i001711-wrong-source" |> ignore
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001711-wrong-source","paket.lock"))
let p1 = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Test"]
p1.Version |> shouldEqual (SemVer.Parse "0.0.1")
p1.Source.Url |> shouldEqual "TestA"

[<Test>]
let ``#1711 update main group with correct source with multiple groups``() =
update "i001711-wrong-groupsource" |> ignore
let lockFile = LockFile.LoadFrom(Path.Combine(scenarioTempPath "i001711-wrong-groupsource","paket.lock"))
let p1 = lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "Test"]
p1.Version |> shouldEqual (SemVer.Parse "0.0.1")
p1.Source.Url |> shouldEqual "TestA"

let p2 = lockFile.Groups.[GroupName "Cumulus.1.0"].Resolution.[PackageName "Test"]
p2.Version |> shouldEqual (SemVer.Parse "0.0.1")
p2.Source.Url |> shouldEqual "TestB"
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source TestA
nuget Test

group Cumulus.1.0
source TestB
nuget Test
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source TestA
nuget Test
7 changes: 4 additions & 3 deletions src/Paket.Core/UpdateProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ open Chessie.ErrorHandling
open Paket.Logging

let selectiveUpdate force getSha1 getSortedVersionsF getPackageDetailsF (lockFile:LockFile) (dependenciesFile:DependenciesFile) updateMode semVerUpdateMode =
let allVersions = Dictionary<PackageName,(SemVerInfo * (PackageSources.PackageSource list)) list>()
let allVersions = Dictionary<PackageName*PackageSources.PackageSource list,(SemVerInfo * (PackageSources.PackageSource list)) list>()
let getSortedAndCachedVersionsF sources resolverStrategy groupName packageName : seq<SemVerInfo * PackageSources.PackageSource list> =
match allVersions.TryGetValue(packageName) with
let key = packageName,sources
match allVersions.TryGetValue key with
| false,_ ->
let versions =
verbosefn " - fetching versions for %O" packageName
getSortedVersionsF sources resolverStrategy groupName packageName

if Seq.isEmpty versions then
failwithf "Couldn't retrieve versions for %O." packageName
allVersions.Add(packageName,versions)
allVersions.Add(key,versions)
versions
| true,versions -> versions
|> List.toSeq
Expand Down
4 changes: 2 additions & 2 deletions src/Paket/Paket.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<StartWorkingDirectory>D:\code\PaketKopie</StartWorkingDirectory>
<StartArguments>update -f</StartArguments>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001117-aws\temp</StartWorkingDirectory>
<StartArguments>install</StartArguments>
<StartWorkingDirectory>D:\code\PaketWithXUnit</StartWorkingDirectory>
<StartArguments>update</StartArguments>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001711-wrong-groupsource\temp</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
Expand Down

0 comments on commit 2c8c845

Please sign in to comment.