r-lib / pak

A fresh approach to package installation
https://pak.r-lib.org
671 stars 60 forks source link

pak::local_install_deps() fails to install git:: remote dependencies with a different project name #510

Closed klmr closed 1 year ago

klmr commented 1 year ago

I've got a local package with the following DESCRIPTION file (excerpt):

Imports: rtdep
Remotes: git::https://internal-gitlab.host/group/remotes-test-dependency.git

Note that the GitLab repository name of that package differs from the package name.

When trying to install the package dependencies via pak::pak() (or pak::local_install_deps()), I am getting the following error message:

✔ Loading metadata database ... done
Error:
! error in pak subprocess
Caused by error:
! Could not solve package dependencies:
* deps::/full-path-to/package: Can't install dependency rtdep
* rtdep: Can't find package called rtdep.

However, installing the same package dependencies via remotes::install_deps() works:

Skipping 1 packages not available: rtdep
Downloading git repo https://internal-gitlab.host/group/remotes-test-dependency.git
── R CMD build ─────────────────────────────────────────────────────────────────────
✔  checking for file ‘/tmp/RtmpVDxFNm/file35f4bb48f50b42/DESCRIPTION’ (436ms)
─  preparing ‘rtdep’:
✔  checking DESCRIPTION meta-information ...
…
* installing *source* package ‘rtdep’ ...
…
* DONE (rtdep)

Renaming the GitLab repo to https://internal-gitlab.host/group/rtdep.git fixes the issue, but is not unfortunately not generally possible for us.

gaborcsardi commented 1 year ago

You need to specify the package name, see https://pak.r-lib.org/reference/pak_package_sources.html#package-names

klmr commented 1 year ago

Oh, awesome! 🎉