Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use NuGet package cache #479

Closed
ferventcoder opened this issue Nov 16, 2015 · 7 comments

Comments

@ferventcoder
Copy link
Member

commented Nov 16, 2015

chocolatey-archive/chocolatey#714

From @Stift:

I have recently observed that chocolatey uses the same cache as nuget does (c:\users\user1\appdata\local\nuget\cache). Which sounds first like it should not be a problem, they both save files there from different feeds. As there are some packages with the same name, like nunit that exist on the chocolatey and on the nuget feed, this leads to some unforeseen behaviour. Depending who comes first, the second one thinks that the package was already downloaded and uses that one. The behaviour afterwards is desastrous and really took me some to figure this out. Therefore I strongly recommend to use some different path for caching the downloaded package files as the feed is also context-wise completely different.

@ferventcoder ferventcoder added this to the 0.9.10 milestone Nov 16, 2015
@ferventcoder

This comment has been minimized.

Copy link
Member Author

commented Nov 16, 2015

We shut it off completely at one point, but must have missed it during the rewrite when we moved to NuGet.Core.

@ferventcoder

This comment has been minimized.

Copy link
Member Author

commented Nov 25, 2015

Actually it's a bug in NuGet - for some reason it is using the cache repository with the aggregate even though it should not. We don't go down the path that would allow for the cache repository.

What we can do is clean up after the installer/upgrader when it does install packages into the cache.

@ferventcoder

This comment has been minimized.

Copy link
Member Author

commented Nov 25, 2015

Something to the effect of:

var cachePackage = _fileSystem.combine_paths(Environment.GetEnvironmentVariable("LocalAppData"), "NuGet", "Cache", "{0}.{1}.nupkg".format_with(packageId, version.to_string()));
if (_fileSystem.file_exists(cachePackage)) _fileSystem.delete_file(cachePackage);
@ferventcoder

This comment has been minimized.

Copy link
Member Author

commented Jan 29, 2016

This is now fixed and will go out in 0.9.10. There is a prerelease going out today that will also include this fix.

ferventcoder added a commit to ferventcoder/choco that referenced this issue Jan 29, 2016
Chocolatey doesn't use the NuGet cache at all, but NuGet always caches
the package in the NuGet cache (and there is not a way to shut it off
with NuGet calls unfortunately). This can cause issues when later using
NuGet and trying to install a package from NuGet.org that is different,
but carries the same name. The cached file will be served to the user
causing hard to detect issues. Therefore we need to clean up after
NuGet as there is no way to tell it NOT to cache the nupkg during
install/upgrade.
ferventcoder added a commit that referenced this issue Jan 30, 2016
Chocolatey doesn't use the NuGet cache at all, but NuGet always caches
the package in the NuGet cache (and there is not a way to shut it off
with NuGet calls unfortunately). This can cause issues when later using
NuGet and trying to install a package from NuGet.org that is different,
but carries the same name. The cached file will be served to the user
causing hard to detect issues. Therefore we need to clean up after
NuGet as there is no way to tell it NOT to cache the nupkg during
install/upgrade.
ferventcoder added a commit that referenced this issue Jan 30, 2016
* ticket/stable/pro-hooks: (25 commits)
  (GH-584) Build virus check configuration
  (GH-584) Make empty Get-VirusCheckValid call
  (GH-583) Mark command methods virtual
  (specs) Try twice to delete .chocolatey directory
  (docs) update CHANGELOG / nuspec
  (GH-535) Tags before summary in nuspec template
  (GH-479) Remove NuGet cache of package
  (GH-584) Reinstall should use available package
  (GH-590) Explicit Cache - No chocolatey subdirectory
  (GH-584) Set Env Variable for PowerShell Host
  (maint) formatting
  (GH-590) Uninstall Cleanup Cache / Delete on Force
  (GH-585) Force should allow downgrade
  (GH-584) Hook for loading licensed posh extensions
  (GH-584) License name - Redact @Domain of email
  (GH-584) Load licensed version
  (GH-584) Simple injector load component registries
  (GH-584) Get version info for other assemblies
  (GH-584) Assembly adapter enhancements
  (GH-583) unseal commands
  ...
ferventcoder added a commit that referenced this issue Jan 30, 2016
* stable: (26 commits)
  (GH-584) Build virus check configuration
  (GH-584) Make empty Get-VirusCheckValid call
  (GH-583) Mark command methods virtual
  (specs) Try twice to delete .chocolatey directory
  (docs) update CHANGELOG / nuspec
  (GH-535) Tags before summary in nuspec template
  (GH-479) Remove NuGet cache of package
  (GH-584) Reinstall should use available package
  (GH-590) Explicit Cache - No chocolatey subdirectory
  (GH-584) Set Env Variable for PowerShell Host
  (maint) formatting
  (GH-590) Uninstall Cleanup Cache / Delete on Force
  (GH-585) Force should allow downgrade
  (GH-584) Hook for loading licensed posh extensions
  (GH-584) License name - Redact @Domain of email
  (GH-584) Load licensed version
  (GH-584) Simple injector load component registries
  (GH-584) Get version info for other assemblies
  (GH-584) Assembly adapter enhancements
  (GH-583) unseal commands
  ...
@CollinChaffin

This comment has been minimized.

Copy link

commented Mar 16, 2019

@ferventcoder Rob have to ask as old as this issue is, that as of latest version 0.10.13, every chocolatey install's package gets stuffed into AppData\Local\NuGet\Cache, and never ever cleaned up. On multiple systems and those directories are all multiple Gigabytes in size they do not appear to have EVERY choco package ever installed, but many and certainly do have the last ones installed with 0.10.13. Is this a regression issue or ?

@bcurran3

This comment was marked as off-topic.

Copy link

commented Mar 16, 2019

@ferventcoder

This comment has been minimized.

Copy link
Member Author

commented Mar 17, 2019

@CollinChaffin Let's file a new issue. Chocolatey cleans up the main package that is installed there, however it may not clean up dependencies. I'm not sure I see what you are seeing, so it may be a regression on certain systems. We may go edit nuget-chocolatey not to even store into a local cache (it is annoying).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.