r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
646 stars 57 forks source link

Built packages are not cached #475

Closed lionel- closed 1 year ago

lionel- commented 1 year ago

The cache stored in the proposal is not passed to pkgdepends::install_package_plan().

I can fix this with this change:

modified   R/package.R
@@ -119,10 +119,12 @@ pkg_install_do_plan <- function(proposal, lib) {
   # sysreqs
   proposal$install_sysreqs()

+  cache <- proposal$.__enclos_env__$private$plan$.__enclos_env__$private$cache$package
+
   # Get the installation plan and hand it over to pkgdepends
   plan <- proposal$get_install_plan()
   inst <- pkgdepends::install_package_plan(plan = plan, lib = lib,
-                                           num_workers = num_workers)
+                                           num_workers = num_workers, cache = cache)

   attr(inst, "total_time") <- Sys.time() - start
   class(inst) <- c("pkg_install_result", class(inst))

But I'm not sure what interfaces would be required for a proper solution.