Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fsprojects/Paket into fix_fast_re…
Browse files Browse the repository at this point in the history
…store
  • Loading branch information
matthid committed Jul 2, 2019
2 parents fabcf81 + 6c1bb17 commit 241b159
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 39 deletions.
7 changes: 2 additions & 5 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#### 5.212.1 - 2019-07-01
* REVERT: If Paket didn't download a package, then it will no longer try to extract it - https://github.com/fsprojects/Paket/pull/3605

#### 5.212.0 - 2019-07-01
* PERFORMANCE: If Paket didn't download a package, then it will no longer try to extract it - https://github.com/fsprojects/Paket/pull/3605
#### 5.213.0 - 2019-07-02
* PERFORMANCE: If Paket didn't download a package, then it will no longer try to extract it - https://github.com/fsprojects/Paket/pull/3607

#### 5.211.0 - 2019-06-24
* BUGFIX: Paket 5.207.4 broke the FAKE release process and creates empty packages - https://github.com/fsprojects/Paket/issues/3599
Expand Down
12 changes: 6 additions & 6 deletions src/Paket.Bootstrapper/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
[assembly: AssemblyTitleAttribute("Paket.Bootstrapper")]
[assembly: AssemblyProductAttribute("Paket")]
[assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")]
[assembly: AssemblyVersionAttribute("5.212.1")]
[assembly: AssemblyFileVersionAttribute("5.212.1")]
[assembly: AssemblyInformationalVersionAttribute("5.212.1")]
[assembly: AssemblyVersionAttribute("5.213.0")]
[assembly: AssemblyFileVersionAttribute("5.213.0")]
[assembly: AssemblyInformationalVersionAttribute("5.213.0")]
namespace System {
internal static class AssemblyVersionInformation {
internal const System.String AssemblyTitle = "Paket.Bootstrapper";
internal const System.String AssemblyProduct = "Paket";
internal const System.String AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories.";
internal const System.String AssemblyVersion = "5.212.1";
internal const System.String AssemblyFileVersion = "5.212.1";
internal const System.String AssemblyInformationalVersion = "5.212.1";
internal const System.String AssemblyVersion = "5.213.0";
internal const System.String AssemblyFileVersion = "5.213.0";
internal const System.String AssemblyInformationalVersion = "5.213.0";
}
}
12 changes: 6 additions & 6 deletions src/Paket.Core/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Paket")>]
[<assembly: AssemblyCompanyAttribute("Paket team")>]
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
[<assembly: AssemblyVersionAttribute("5.212.1")>]
[<assembly: AssemblyFileVersionAttribute("5.212.1")>]
[<assembly: AssemblyInformationalVersionAttribute("5.212.1")>]
[<assembly: AssemblyVersionAttribute("5.213.0")>]
[<assembly: AssemblyFileVersionAttribute("5.213.0")>]
[<assembly: AssemblyInformationalVersionAttribute("5.213.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "Paket.Core"
let [<Literal>] AssemblyProduct = "Paket"
let [<Literal>] AssemblyCompany = "Paket team"
let [<Literal>] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories."
let [<Literal>] AssemblyVersion = "5.212.1"
let [<Literal>] AssemblyFileVersion = "5.212.1"
let [<Literal>] AssemblyInformationalVersion = "5.212.1"
let [<Literal>] AssemblyVersion = "5.213.0"
let [<Literal>] AssemblyFileVersion = "5.213.0"
let [<Literal>] AssemblyInformationalVersion = "5.213.0"
30 changes: 22 additions & 8 deletions src/Paket.Core/Dependencies/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -849,8 +849,9 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr
if not force && targetFile.Exists && targetFile.Length > 0L then
if verbose then
verbosefn "%O %O already downloaded." packageName version
return false
elif getFromFallbackFolder () || (not force && getFromCache caches) then
()
return true
else
match source with
| LocalNuGet(path,_) ->
Expand All @@ -861,9 +862,11 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr
use _ = Profile.startCategory Profile.Category.FileIO
ensureDir targetFileName
File.Copy(nupkg.FullName,targetFileName,true)
return true
| _ ->
// discover the link on the fly
let downloadUrl = ref ""
let mutable didDownload = false
try
let sw = System.Diagnostics.Stopwatch.StartNew()
let groupString = if groupName = Constants.MainDependencyGroup then "" else sprintf " (%O)" groupName
Expand Down Expand Up @@ -974,6 +977,7 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr

if not (File.Exists targetFileName) then
try File.Move(tmpFile, targetFileName)
didDownload <- true
with | :? System.IO.IOException as e ->
traceWarnfn "Error while moving temp file as '%s' already exists (maybe some other instance downloaded it as well): %O" targetFileName e
()
Expand All @@ -993,10 +997,12 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr
try
if downloadLicense && not (String.IsNullOrWhiteSpace nugetPackage.LicenseUrl) then
do! DownloadLicense(root,force,packageName,version,nugetPackage.LicenseUrl,licenseFileName)
return didDownload
with
| exn ->
if verbose then
traceWarnfn "Could not download license for %O %O from %s.%s %s" packageName version nugetPackage.LicenseUrl Environment.NewLine exn.Message
return didDownload
with
| :? System.Net.WebException as exn when
attempt < 5 &&
Expand All @@ -1005,15 +1011,15 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr
| Some(Credentials(_)) -> true
| _ -> false)
-> traceWarnfn "Could not download %O %O.%s %s.%sRetry." packageName version Environment.NewLine exn.Message Environment.NewLine
do! download false (attempt + 1)
return! download false (attempt + 1)
| exn when String.IsNullOrWhiteSpace !downloadUrl ->
raise (Exception(sprintf "Could not download %O %O." packageName version, exn))
| exn -> raise (Exception(sprintf "Could not download %O %O from %s." packageName version !downloadUrl, exn)) }
return raise (Exception(sprintf "Could not download %O %O." packageName version, exn))
| exn -> return raise (Exception(sprintf "Could not download %O %O from %s." packageName version !downloadUrl, exn)) }

async {
configResolved.Path |> Option.iter SymlinkUtils.delete

do! download true 0
let! didDownload = download true 0

match isLocalOverride, configResolved with
| true, ResolvedPackagesFolder.NoPackagesFolder -> return failwithf "paket.local in combination with storage:none is not supported (use storage: symlink instead)"
Expand All @@ -1025,16 +1031,24 @@ let private downloadAndExtractPackage(alternativeProjectRoot, root, isLocalOverr
folder |> Utils.DirectoryInfo |> Utils.deleteDir
ensureDir folder

let! extractedUserFolder = ExtractPackageToUserFolder(targetFile.FullName, packageName, version, kind)

let! extractedUserFolder = async {
if not didDownload then
return GetPackageUserFolderDir (packageName, version, kind)
else return! ExtractPackageToUserFolder(targetFile.FullName, packageName, version, kind)
}

SymlinkUtils.makeDirectoryLink folder extractedUserFolder

let packageFilePath = Path.Combine(extractedUserFolder, NuGetCache.GetPackageFileName packageName version)
return packageFilePath, folder
| false, otherConfig ->
otherConfig.Path |> Option.iter SymlinkUtils.delete

let! extractedUserFolder = ExtractPackageToUserFolder(targetFile.FullName, packageName, version, kind)
let! extractedUserFolder = async {
if not didDownload then
return GetPackageUserFolderDir (packageName, version, kind)
else return! ExtractPackageToUserFolder(targetFile.FullName, packageName, version, kind)
}

let! files = NuGetCache.CopyFromCache(otherConfig, targetFile.FullName, licenseFileName, packageName, version, force, detailed)

Expand Down
24 changes: 16 additions & 8 deletions src/Paket.Core/Dependencies/NuGetCache.fs
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,26 @@ let TryGetFallbackNupkg (packageName:PackageName) (version:SemVerInfo) =
if fallbackFile.Exists && fallbackFile.Length > 0L then Some fallbackFile.FullName else None
| None -> None

let GetPackageUserFolderDir (packageName:PackageName, version:SemVerInfo, kind:PackageResolver.ResolvedPackageKind) =
let dir =
match kind with
| PackageResolver.ResolvedPackageKind.DotnetCliTool ->
GetTargetUserToolsFolder packageName version
| PackageResolver.ResolvedPackageKind.Package ->
GetTargetUserFolder packageName version

let targetFolder = DirectoryInfo(dir)
targetFolder.FullName

/// Extracts the given package to the user folder
let rec ExtractPackageToUserFolder(fileName:string, packageName:PackageName, version:SemVerInfo, kind:PackageResolver.ResolvedPackageKind) =
async {
let! dir =
async {
match kind with
| PackageResolver.ResolvedPackageKind.DotnetCliTool ->
let! _ = ExtractPackageToUserFolder(fileName, packageName, version, PackageResolver.ResolvedPackageKind.Package)
return GetTargetUserToolsFolder packageName version
| PackageResolver.ResolvedPackageKind.Package ->
return GetTargetUserFolder packageName version }
let dir = GetPackageUserFolderDir (packageName, version, kind)

if kind = PackageResolver.ResolvedPackageKind.DotnetCliTool then
let! _ = ExtractPackageToUserFolder(fileName, packageName, version, PackageResolver.ResolvedPackageKind.Package)
()

let targetFolder = DirectoryInfo(dir)

use _ = Profile.startCategory Profile.Category.FileIO
Expand Down
12 changes: 6 additions & 6 deletions src/Paket/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ open System.Reflection
[<assembly: AssemblyProductAttribute("Paket")>]
[<assembly: AssemblyCompanyAttribute("Paket team")>]
[<assembly: AssemblyDescriptionAttribute("A dependency manager for .NET with support for NuGet packages and git repositories.")>]
[<assembly: AssemblyVersionAttribute("5.212.1")>]
[<assembly: AssemblyFileVersionAttribute("5.212.1")>]
[<assembly: AssemblyInformationalVersionAttribute("5.212.1")>]
[<assembly: AssemblyVersionAttribute("5.213.0")>]
[<assembly: AssemblyFileVersionAttribute("5.213.0")>]
[<assembly: AssemblyInformationalVersionAttribute("5.213.0")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] AssemblyTitle = "Paket"
let [<Literal>] AssemblyProduct = "Paket"
let [<Literal>] AssemblyCompany = "Paket team"
let [<Literal>] AssemblyDescription = "A dependency manager for .NET with support for NuGet packages and git repositories."
let [<Literal>] AssemblyVersion = "5.212.1"
let [<Literal>] AssemblyFileVersion = "5.212.1"
let [<Literal>] AssemblyInformationalVersion = "5.212.1"
let [<Literal>] AssemblyVersion = "5.213.0"
let [<Literal>] AssemblyFileVersion = "5.213.0"
let [<Literal>] AssemblyInformationalVersion = "5.213.0"

0 comments on commit 241b159

Please sign in to comment.