pkgr icon indicating copy to clipboard operation
pkgr copied to clipboard

Ability to Specify a Repository for One Specific Package

Open billdenney opened this issue 4 years ago • 4 comments

I just wanted to install a specific version of a package (as suggested in #85) because the current version on CRAN has an issue that I didn't have with a prior version. One thought that may be a simpler path to this is to have the option to specify a repository for one package, only.

Something like:

Customizations:
  Packags:
    - pillar:
      Repos: https://example.com/older/version

billdenney avatar Sep 25 '20 21:09 billdenney

Hey Bill,

Lets break this out - first, this is a reasonable idea and something i will noodle on the syntax of - but to get the behavior you want you can get this today by just sticking a repo at the end of the repos then customizing just the single package to point to it.

Repos:
   - CRAN: some/path
   - CRAN_old: some/other/path

Customizations:
  Packages:
  - pillar:
      Repo: CRAN_old

dpastoor avatar Sep 25 '20 22:09 dpastoor

An extension of this syntax could be if the Repo isn't a name in the key/values of repos and is an http endpoint or file path then point to it (if you really want to truly enforce only that package coming from the repo).

So play out this scenario, what if your custom package needs a dependency not present in the other default repo, but at the custom URL, what would you expect the behavior to be - error, install the dep, etc?>\

dpastoor avatar Sep 25 '20 22:09 dpastoor

Thanks for the quick reply!

I didn't know about the "Repo" option for a package. Thanks for pointing me there. (And, sorry if I missed that in the documentation.)

I would expect the custom Repo only to apply to the given package. If there is a dependency that doesn't have a specific Repo option, I would expect that dependency to be handled as though it were a normal package. I would not expect to look for the other dependencies at the Repo specified for the one package by default. (Looking for dependencies in the specified repo would cause all sorts of issues for packages that are dependencies for more than one other package.)

billdenney avatar Sep 25 '20 23:09 billdenney

As I thought about this more overnight, I'm pretty sure that the Repo option attached to a specific package covers my request.

So, I think that changes this issue to a documentation request. I looked, and I think that this use of the "Repo" option for the package is indicated here:

"Unless otherwise configured, pkgr will use Repos in the order listed when searching for packages installation files for an individual package." (https://github.com/metrumresearchgroup/pkgr/wiki/user_manual#the-following-items-can-be-set-only-in-the-configuration-file)

As I looked at it with new eyes, I didn't see how "otherwise configured" was done. Perhaps change that sentence to "pkgr will use Repos in the order listed when searching for packages installation files for an individual package, unless the Repo option for a package indicates the specific repository to use for installation (see below)." And then further down, replace "Repository to install a package from" under the "Package-specific customizations" with "Repository to install a package from (overriding default order)" or better yet "Repository to install a package from (this is the only repository that will be searched, overriding default Repos search)".

billdenney avatar Sep 26 '20 14:09 billdenney