miniCRAN icon indicating copy to clipboard operation
miniCRAN copied to clipboard

Don't redownload packages that are already on the repo

Open ColinFay opened this issue 2 years ago • 2 comments

hey there,

When adding a package to a repo (or building it from a vector), it would be better if the function skipped the existing package. For example, adding {rlang} then {tidyr} will download {rlang} or {purrr} twice. It's not an issue there with two packages, but when building large repo, it takes unnecessary time :) — some packages like stringi are 7.2mb for example.

> addPackage(
+   pkgs = "rlang",
+   mini_path
+ )
Created new folder: ./miniCRAN/src/contrib
trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/rlang_1.0.2.tar.gz'
Content type 'application/octet-stream' length 724829 bytes (707 KB)
==================================================
downloaded 707 KB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/jsonlite_1.8.0.tar.gz'
Content type 'application/octet-stream' length 1051625 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/R6_2.5.1.tar.gz'
Content type 'application/octet-stream' length 63422 bytes (61 KB)
==================================================
downloaded 61 KB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/stringi_1.7.6.tar.gz'
Content type 'application/octet-stream' length 7600716 bytes (7.2 MB)
==================================================
downloaded 7.2 MB


[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/purrr_0.3.4.tar.gz'
Content type 'application/octet-stream' length 375062 bytes (366 KB)
==================================================
downloaded 366 KB

[...] # REMOVED
> addPackage(
+   pkgs = "tidyr",
+   mini_path
+ )
trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/tidyr_1.2.0.tar.gz'
Content type 'application/octet-stream' length 744570 bytes (727 KB)
==================================================
downloaded 727 KB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/purrr_0.3.4.tar.gz'
Content type 'application/octet-stream' length 375062 bytes (366 KB)
==================================================
downloaded 366 KB

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/rlang_1.0.2.tar.gz'
Content type 'application/octet-stream' length 724829 bytes (707 KB)
==================================================
downloaded 707 KB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/R6_2.5.1.tar.gz'
Content type 'application/octet-stream' length 63422 bytes (61 KB)
==================================================
downloaded 61 KB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/jsonlite_1.8.0.tar.gz'
Content type 'application/octet-stream' length 1051625 bytes (1.0 MB)
==================================================
downloaded 1.0 MB

[...] # REMOVED

trying URL 'https://cran.microsoft.com/snapshot/2022-04-01/src/contrib/stringi_1.7.6.tar.gz'
Content type 'application/octet-stream' length 7600716 bytes (7.2 MB)
==================================================
downloaded 7.2 MB

[...] # REMOVED

ColinFay avatar May 16 '22 08:05 ColinFay