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

restore packages from nuget if X_VCPKG_NUGET_ID_PREFIX set #192

Merged
merged 2 commits into from
Oct 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/vcpkg/binarycaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -798,14 +798,26 @@ namespace
Util::erase_remove_if(attempts, [&](const NuGetPrefetchAttempt& nuget_ref) -> bool {
// note that we would like the nupkg downloaded to buildtrees, but nuget.exe downloads it to the
// output directory
auto nupkg_path = paths.package_dir(nuget_ref.spec) / nuget_ref.reference.id + ".nupkg";
auto nupkg_path = paths.packages / nuget_ref.reference.id / nuget_ref.reference.id + ".nupkg";
if (fs.exists(nupkg_path, IgnoreErrors{}))
{
fs.remove(nupkg_path, VCPKG_LINE_INFO);
Checks::check_exit(VCPKG_LINE_INFO,
!fs.exists(nupkg_path, IgnoreErrors{}),
"Unable to remove nupkg after restoring: %s",
nupkg_path);
if (!get_nuget_prefix().empty())
{
auto path_from = paths.packages / nuget_ref.reference.id;
auto path_to = paths.packages / nuget_ref.spec.dir();
std::error_code ec;
fs.rename(path_from, path_to, ec);
Checks::check_exit(VCPKG_LINE_INFO,
!ec,
"Unable to rename package %s after restoring: %s",
path_from,
ec.message());
}
cache_status[nuget_ref.result_index]->mark_restored();
return true;
}
Expand Down