0

We have an organisational GitLab server where we store some internal packages. For packageA stored on GitLab to depend on another package (packageB) stored on GitLab we have the equivalent lines in packageA's DESCRIPTION file:

Imports:
    packageB
Remotes: url::https://gitlab.orgname.uk/packages/packageB/-/archive/master/packageB-master.zip

We want to install the uninstalled dependencies, but not install the the dependencies that are already installed (or ask us before installing them at least).

We install the package from GitLab using remotes::install_git(). This seems to install packageB even when already we have the latest version installed. Is there a way around this?

Seb
  • 13
  • 3
  • 1
    What are you using to install? `install.packages`, `devtools`,`remotes`,something else? – NelsonGon Dec 18 '19 at 16:59
  • 1
    None of the above. In the package file structure, the DESCRIPTION file describes each package's dependencies, so when the package is installed all of the appropriate dependencies are also installed (usually if they aren't already installed). Because our package has dependencies that aren't on CRAN, we are using the `Remotes:` argument to define where to install the packages from, but it installs them even if they are already installed – Seb Dec 19 '19 at 10:36
  • 1
    Just realised I might have misunderstood your question. We are installing packageA with remotes::install_git(). We want a method that will install the uninstalled dependencies but not reinstall the installed dependencies (I'll update the question) – Seb Dec 19 '19 at 12:03

1 Answers1

0

Usually that would look something like this:

remotes::install_gitlab("packages/packageB", dependencies = FALSE)

From the help file (?remotes::install_gitlab):

dependencies:

Which dependencies do you want to check? Can be a character vector (selecting from "Depends", "Imports", "LinkingTo", "Suggests", or "Enhances"), or a logical vector.

TRUE is shorthand for "Depends", "Imports", "LinkingTo" and "Suggests". NA is shorthand for "Depends", "Imports" and "LinkingTo" and is the default. FALSE is shorthand for no dependencies (i.e. just check this package, not its dependencies).

What you show above hints that you might use remotes::install_url() instead. But the dependencies argument is the same here.

JBGruber
  • 11,727
  • 1
  • 23
  • 45
  • Thanks. Do you know how to control the dependencies argument in the DESCRIPTION file of a package? – Seb Dec 19 '19 at 10:32
  • Are you looking for something like this: http://r-pkgs.had.co.nz/description.html – JBGruber Dec 19 '19 at 15:45
  • Yes, so we have written the DESCRIPTION file, but the dependent package isn't on CRAN, it is on our GitLab server. You can use the `Remotes` field in the DESCRIPTION file to tell R where that dependency is stored, so it installs it when installing the package. The link you sent is great, but it doesn't cover the Remotes field – Seb Dec 19 '19 at 16:10