rstudio / packrat

Packrat is a dependency management system for R
http://rstudio.github.io/packrat/
399 stars 89 forks source link

Fix issue adjusting `DESCRIPTION` files for SCM-backed packages in subdirectories of remote repos #703

Closed toph-allen closed 1 year ago

toph-allen commented 1 year ago

Intent

Fix an issue where Packrat would fail to restore packages from subdirectories of repositories.

Approach

There were a few complex nested calls to as.data.frame(), c(), and list() spread across getSourceForPkgRecord() that I attempted to simplify in an earlier update. I simplified them incorrectly, causing subdir properties to be dropped.

Because we don't have end-to-end tests set up, and this transformation was part of a long function, no tests caught the issue. I moved the transformations into their own function and added unit tests.

Stepping back, this problem stems from the overall complexity of Packrat's workflows. This solution does not directly address the complexity. It adds a bit of indirection to make the outer-level workflow clearer, but it doesn't reduce the overall complexity of the data flows in the restore process.

QA Notes

End-to-end validation should involve restoring a Packrat environment that contains a package in a subdirectory. I have already tested that myself, and I'll walk through it with the package's maintainers before this merges.

toph-allen commented 1 year ago

Rerunning validation against this new commit.