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

Create a 'removePackages' function to easily remove packages from the miniCRAN repo #81

Open
paulponcet opened this issue Dec 10, 2016 · 6 comments

Comments

@paulponcet
Copy link

No description provided.

@andrie
Copy link
Owner

andrie commented Dec 12, 2016

Please provide more information about the specific nature of your request.

For example:

  • What do you want to happen with dependencies and reverse dependencies of the removed package?
  • What is the use case for deleting a package, compared to simply recreating the miniCRAN repo?

The workaround is simple:

  • Delete the package
  • Rebuild the index file

Pull requests welcome.

@paulponcet
Copy link
Author

paulponcet commented Dec 14, 2016

A use case may happen for instance when one package inside a miniCRAN repo is accepted on CRAN.

Would you consider the following function as a good candidate for a pull request - up to dependencies or reverse dependencies management? (In the end it would better be called deletePackage rather than removePackage to avoid any detrimental confusion with remove.packages)

deletePackage <- function(pkgs = NULL, path = NULL, type = "source", Rversion = R.version) {
  a <- pkgAvail(repos=path, type = type, Rversion = Rversion)
  w <- which(a[,"Package"] %in% pkgs)
  ext <- switch(type, source = ".tar.gz", mac.binary = ".tgz", win.binary = ".zip")
  pkgs <- paste(a[w,"Package"], "_", a[w,"Version"], ext, sep = "")
  unlink(file.path(path, repoPrefix(type = type, Rversion = R.version), pkgs))
  updateRepoIndex(path, type = type, Rversion = Rversion)
  invisible(pkgs)
}

@achubaty
Copy link
Collaborator

achubaty commented Jan 9, 2017

@paulponcet the function you are proposing should be vectorized to handle multiple package types, the way addPackage does (using an lapply internally for type).

@tonytonov
Copy link

@achubaty Came across this issue looking for the same "remove package" functionality. Would you still be interested in adding that if I vectorize the code above and send a PR?

@achubaty
Copy link
Collaborator

@tonytonov Vectorizing the code is a good start but Andrie's points above still hold. For me, I would want unused dependencies to also be removed. PRs welcome!

@tonytonov
Copy link

@achubaty @andrie You have probably seen it, but is there any chance you could review the PR in the near future? I'm afraid soon I'll completely forget what I've coded there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants