From c5a0ce09f491e2d95f6eeb0e3f535fe638eda012 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Thu, 9 Apr 2015 17:27:03 +0200 Subject: [PATCH] Try to fix dates in Nuget packages - relates to #761 --- RELEASE_NOTES.md | 3 +++ src/Paket.Core/NuGetV2.fs | 12 ++++++++++++ src/Paket/Paket.fsproj | 6 ++---- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4ad26eb961..5d425f8beb 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,6 @@ +#### 0.39.3 - 10.04.2015 +* Try to fix dates in Nuget packages - https://github.com/fsprojects/Paket/issues/761 + #### 0.39.2 - 09.04.2015 * Allow . in target file names for pack - https://github.com/fsprojects/Paket/issues/756 diff --git a/src/Paket.Core/NuGetV2.fs b/src/Paket.Core/NuGetV2.fs index fcb1298017..497303e328 100644 --- a/src/Paket.Core/NuGetV2.fs +++ b/src/Paket.Core/NuGetV2.fs @@ -332,6 +332,16 @@ let inline isExtracted fileName = di.EnumerateFileSystemInfos() |> Seq.exists (fun f -> f.FullName <> fi.FullName) +let fixDatesInArchive fileName = + use archive = ZipFile.Open(fileName,ZipArchiveMode.Update) + for e in archive.Entries do + try + let d = e.LastWriteTime + () + with + | xn -> e.LastWriteTime <- DateTimeOffset.Now + + /// Extracts the given package to the ./packages folder let ExtractPackage(fileName:string, targetFolder, name, version:SemVerInfo) = async { @@ -339,6 +349,8 @@ let ExtractPackage(fileName:string, targetFolder, name, version:SemVerInfo) = verbosefn "%s %A already extracted" name version else Directory.CreateDirectory(targetFolder) |> ignore + + fixDatesInArchive fileName ZipFile.ExtractToDirectory(fileName, targetFolder) // cleanup folder structure diff --git a/src/Paket/Paket.fsproj b/src/Paket/Paket.fsproj index 25f1a1dac0..6c40a8ada5 100644 --- a/src/Paket/Paket.fsproj +++ b/src/Paket/Paket.fsproj @@ -32,12 +32,10 @@ paket.exe D:\code\Pakettest D:\code\Paketkopie - pack output ./temp version 0.37.0 releaseNotes "Fallback -to NuGet.exe if the bootstrapper fails to download from GitHub - https://github.com/fsprojects/Paket/pull/733 -COSMETICS: Display the file name if Paket crashes on some invalid file - https://github.com/fsprojects/Paket/pull/730" + update Project paket.exe - D:\code\Paket + D:\code\Pakettest pdbonly