Skip to content

fix for #2755 - #2770

Merged
matthid merged 1 commit into
fsprojects:masterfrom
lexarchik:i2755
Sep 17, 2017
Merged

fix for #2755#2770
matthid merged 1 commit into
fsprojects:masterfrom
lexarchik:i2755

Conversation

@lexarchik

Copy link
Copy Markdown
Contributor

try to fix #2755

  • add cleaning target folder (packages/groupname/packagename) on "force" restore
    this solve two problems: overriding .nupkg on force restore and deal with .nupkg naming problem (normalized name from ~/.nuget vs "as is" from overrided source)
  • add overriding .nupkg file in ~/.nuget when using LocalNuGet source

let parent = Path.GetDirectoryName targetFileName
if not (Directory.Exists parent) then Directory.CreateDirectory parent |> ignore
File.Copy(nupkg.FullName,targetFileName)
File.Copy(nupkg.FullName,targetFileName,true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we leave the last parameter to false when no path is resolved (ie 'storage: none')?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure i understand how storage: none should work.
If we set File.Copy(..., overwrite) parameter to false Paket will just fail if file already exists and normally copy it otherwise.
In branch where source is not LocalNuGet we overwrite file with File.Create without any conditions. (NuGet.fs:757).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing we need to watch out for is that we never write into the cache (~/.nuget) when a local override is specified, this is more than invalid and leads to hard do diagnose errors in combination with NuGet. So we just need to ensure that this cannot ever happen. This mistake is easily introduced now, because storage: none means we use ~/.nuget instead of the packages directory.

This is what I'm a bit worried about.

I think this cannot happen, because we "throw" on the caller side of this function if force and storage: none are given the same time. storage: none basically is given when configResolved.Path is None. I suggest we check and throw in this function as well when we want to fix the bug like this.

I hope this makes sense. Thanks for taking care of this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, thanks, i now understand the problem.

I can change commit - add check in download function, but such check already in 50 lines above - NuGet.fs:629 and download can't be called if this check fails.

We already have a test that assert that "local" package will not be copied to cache - "#1633 paket.local local source override"

So, maybe there is no need for additional check?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes sorry

@matthid
matthid merged commit 2ee54f5 into fsprojects:master Sep 17, 2017
@lexarchik
lexarchik deleted the i2755 branch September 18, 2017 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore with local override fails when run multiple times

2 participants