rstudio / rstudio/packrat

Bug found in repos_upload()

Open
#264 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
409
Forks
89
PR merge metrics
No merged PRs in 30d

Description

Hi,

I've resolved my issue in Issue 257. When calling repos_upload('myLib','local_cran'), packrat puts the value of 'local_cran' in my repos to the Repository field of the DESCRIPTION file of myLib. For instance, if my repos is like:

CRAN CRANextra
"https://cran.rstudio.com/" "http://www.stats.ox.ac.uk/pub/RWin"
local_cran
"file:///D:/local_cran"

Then the DESCRIPTION file in the myLib in the local_cran is something like:
...
Repository: file:///D:/local_cran
...

The related code is

repo <- if (isNameOfRepo) repos[[to]] else to

in line 113 of cranlike-repositories.R

However, in the function inferPackageRecord (line 299 of pkg.R):
else if (!is.null(df$Repository) && df$Repository %in% names(repos))
{
# It's a package from a custom CRAN-like repo!
...

It only checks if the value of Repository is in the names of repos, so what it actually wants is Repository: local_cran

Now I have to manually change my DESCRIPTION file to go through the snapshot(). Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cranlike-repositories.R at line 113, where repos_upload() selects the Repository value, and compare it with inferPackageRecord in pkg.R at line 299. Reproduce the local_cran case and verify that the generated DESCRIPTION retains the repository name so snapshot() can recognize the package without manual editing.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.