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

deletePackage: technical discussion #124

Open
tonytonov opened this issue Jul 10, 2019 · 0 comments
Open

deletePackage: technical discussion #124

tonytonov opened this issue Jul 10, 2019 · 0 comments

Comments

@tonytonov
Copy link

tonytonov commented Jul 10, 2019

When deleting, I’m doing my best to be sure we don’t delete anything that’s being used by other packages. To do that, I use two calls to tools::package_dependencies here:
https://github.com/tonytonov/miniCRAN/blob/1e5f0bc6914540715913037c98a1f9ed4bd3957c/R/deletePackages.R#L25 – what to delete;
https://github.com/tonytonov/miniCRAN/blob/1e5f0bc6914540715913037c98a1f9ed4bd3957c/R/deletePackages.R#L35 – what to not delete.
The first call is governed by caller’s arguments and forms a preliminary list for deletion. The second always checks for non-breaking conditions and keeps packages that are used by any other package that is not in the preliminary list.

This is all a bit difficult to imagine, so I created a test suite based on a small dependency tree:
https://github.com/tonytonov/miniCRAN/blob/1e5f0bc6914540715913037c98a1f9ed4bd3957c/tests/testthat/test-8-deletePackage.R#L30-L38
The tree is not that big (and I could have missed some cases), but now all tests result in a consistent (non-broken) dependency state.

So, questions:

  1. For the second tools::package_dependencies call, we surely need direct (non-reverse) dependencies. Non-recursive also seems enough. The question is what to use for which. Right now it’s c("Depends", "Imports", "LinkingTo", "Suggests") at all times. Is it too strict? Is it too permissive? Should it be controllable by user?
  2. If we ask to delete a single package that’s being used, what do we do? Right now, I do nothing (Test#2). Should we delete anyway? (That’s bad, the repo state is broken.) Should we message about that? (“Tried to delete pkg_name, but won’t do”). Add user interaction?
  3. What should be the overall default behavior when treating dependencies? Remove dependencies at all (deps = TRUE)? If so, what about reverse and recursive? I see two useful scenarios: remove pkgs and unused dependencies (reverse = FALSE, see Test#5), or remove pkgs and all packages that depend on them (reverse = TRUE, see Test#6).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant