Skip to content

Commit

Permalink
Working around NuGt v3 protocol issues with unlisted packages - refer…
Browse files Browse the repository at this point in the history
…ences #1254
  • Loading branch information
forki committed Nov 24, 2015
1 parent 4165f31 commit 5b6383b
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 8 deletions.
3 changes: 3 additions & 0 deletions 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

Expand Down
Expand Up @@ -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" -> ()
| exn when exn.Message.Contains "paket.lock" -> ()

[<Test>]
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")
@@ -0,0 +1,2 @@
source https://nuget.org/api/v2
nuget ServiceStack.Host.AspNet
12 changes: 8 additions & 4 deletions src/Paket.Core/NuGetV2.fs
Expand Up @@ -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) ]
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Paket.Core/NuGetV3.fs
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion src/Paket.Core/Nuget.fs
Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion src/Paket/Paket.fsproj
Expand Up @@ -45,7 +45,7 @@
<StartWorkingDirectory>d:\code\paketkopie</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketbug</StartWorkingDirectory>
<StartWorkingDirectory>d:\code\paketrepro</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001242-v3\temp\</StartWorkingDirectory>
<StartWorkingDirectory>D:\code\Paket\integrationtests\scenarios\i001253-unlisted\temp\</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
Expand Down

0 comments on commit 5b6383b

Please sign in to comment.