From 5b6383be1ab0e160a1870f93f842debc2041ee3d Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Tue, 24 Nov 2015 10:10:41 +0100 Subject: [PATCH] Working around NuGt v3 protocol issues with unlisted packages - references #1254 --- RELEASE_NOTES.md | 3 +++ .../Paket.IntegrationTests/BasicResolverSpecs.fs | 8 +++++++- .../i001253-unlisted/before/paket.dependencies | 2 ++ src/Paket.Core/NuGetV2.fs | 12 ++++++++---- src/Paket.Core/NuGetV3.fs | 3 ++- src/Paket.Core/Nuget.fs | 2 +- src/Paket/Paket.fsproj | 2 +- 7 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 integrationtests/scenarios/i001253-unlisted/before/paket.dependencies diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c1f5cf4e4a..7984101611 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 2.27.12 - 24.11.2015 +* WORKAROUND: Working around NuGt v3 protocol issues with unlisted packages - https://github.com/fsprojects/Paket/issues/1254 + #### 2.27.11 - 24.11.2015 * BUGFIX: Specifying prereleases did not work with pessimistic version constraint - https://github.com/fsprojects/Paket/issues/1252 diff --git a/integrationtests/Paket.IntegrationTests/BasicResolverSpecs.fs b/integrationtests/Paket.IntegrationTests/BasicResolverSpecs.fs index fbbf7ef7d2..a63b1ef543 100644 --- a/integrationtests/Paket.IntegrationTests/BasicResolverSpecs.fs +++ b/integrationtests/Paket.IntegrationTests/BasicResolverSpecs.fs @@ -113,4 +113,10 @@ let ``#1247 should report lockfile in parse errror``() = let lockFile = update "i001247-lockfile-error" failwith "error was expected" with - | exn when exn.Message.Contains "paket.lock" -> () \ No newline at end of file + | exn when exn.Message.Contains "paket.lock" -> () + +[] +let ``#1254 should install unlisted transitive dependencies``() = + let lockFile = update "i001253-unlisted" + lockFile.Groups.[Constants.MainDependencyGroup].Resolution.[PackageName "WebActivator"].Version + |> shouldBeGreaterThan (SemVer.Parse "1.5.3") diff --git a/integrationtests/scenarios/i001253-unlisted/before/paket.dependencies b/integrationtests/scenarios/i001253-unlisted/before/paket.dependencies new file mode 100644 index 0000000000..5b439b9fb5 --- /dev/null +++ b/integrationtests/scenarios/i001253-unlisted/before/paket.dependencies @@ -0,0 +1,2 @@ +source https://nuget.org/api/v2 +nuget ServiceStack.Host.AspNet \ No newline at end of file diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index 905afd099d..f56e19f17b 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -613,12 +613,13 @@ let getVersionsCached key f (auth, nugetURL, package) = /// Allows to retrieve all version no. for a package from the given sources. let GetVersions root (sources, packageName:PackageName) = - let v = + let getVersions useV3 = sources |> Seq.map (function | Nuget source -> let auth = source.Authentication |> Option.map toBasicAuth - let v3Feeds = + let v3Feeds = + if not useV3 then [] else match NuGetV3.getSearchAPI(auth,source.Url) with | None -> [] | Some v3Url -> [ tryNuGetV3 (auth, v3Url, packageName) ] @@ -651,9 +652,12 @@ let GetVersions root (sources, packageName:PackageName) = |> Array.concat let versions = - match v with + match getVersions true with | versions when Array.isEmpty versions |> not -> versions - | _ -> failwithf "Could not find versions for package %O in any of the sources in %A." packageName (sources |> Seq.map (fun (s:PackageSource) -> s.ToString()) |> List.ofSeq) + | _ -> + match getVersions false with + | versions when Array.isEmpty versions |> not -> versions + | _ -> failwithf "Could not find versions for package %O in any of the sources in %A." packageName (sources |> Seq.map (fun (s:PackageSource) -> s.ToString()) |> List.ofSeq) versions |> Seq.toList diff --git a/src/Paket.Core/NuGetV3.fs b/src/Paket.Core/NuGetV3.fs index b913c21a4c..afc8b606bd 100644 --- a/src/Paket.Core/NuGetV3.fs +++ b/src/Paket.Core/NuGetV3.fs @@ -71,7 +71,8 @@ let extractVersions(response:string) = let internal findVersionsForPackage(v3Url, auth, packageName:Domain.PackageName, includingPrereleases, maxResults) = async { - let! response = safeGetFromUrl(auth,sprintf "%s?id=%O&take=%d%s" v3Url packageName (max maxResults 100000) (if includingPrereleases then "&prerelease=true" else ""), acceptXml) // Nuget is showing old versions first + let url = sprintf "%s?id=%O&take=%d%s" v3Url packageName (max maxResults 100000) (if includingPrereleases then "&prerelease=true" else "") + let! response = safeGetFromUrl(auth,url,acceptXml) // NuGet is showing old versions first match response with | Some text -> let versions = diff --git a/src/Paket.Core/Nuget.fs b/src/Paket.Core/Nuget.fs index 952e690816..052e858324 100644 --- a/src/Paket.Core/Nuget.fs +++ b/src/Paket.Core/Nuget.fs @@ -20,7 +20,7 @@ type NugetPackageCache = LicenseUrl : string CacheVersion: string } - static member CurrentCacheVersion = "2.1" + static member CurrentCacheVersion = "2.2" /// The NuGet cache folder. let CacheFolder = diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index fe2fb914d6..503a8fcb69 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -45,7 +45,7 @@ d:\code\paketkopie d:\code\paketbug d:\code\paketrepro - D:\code\Paket\integrationtests\scenarios\i001242-v3\temp\ + D:\code\Paket\integrationtests\scenarios\i001253-unlisted\temp\ pdbonly