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

Multiple remotes in DESCRIPTION #20

Closed
jimhester opened this issue Mar 2, 2017 · 0 comments
Closed

Multiple remotes in DESCRIPTION #20

jimhester opened this issue Mar 2, 2017 · 0 comments
Labels
feature a feature request or enhancement load

Comments

@jimhester
Copy link
Member

Issue by muschellij2
Tuesday Sep 13, 2016 at 16:07 GMT
Originally opened as r-lib/devtools#1342


In utils.R, for read_dcf, the code is:

read_dcf <- function(path) {
  fields <- colnames(read.dcf(path))
  as.list(read.dcf(path, keep.white = fields)[1, ])
}

I wanted to know what the expected behavior would/should be for a DESCRIPTION with duplicated fields (for example Remotes): silent, warning, or error? If all = TRUE on read.dcf, this may allow for this case to be parsed with all remotes (even conflicting), but it may be a bad case and needs an error

Parsing DESCRIPTION with default read.dcf

url = "https://raw.githubusercontent.com/muschellij2/freesurfer/7f336cddadfa1000f128db3341893f96af9eaf51/DESCRIPTION"
destfile = file.path(tempdir(), "DESCRIPTION")
download.file(url, destfile = destfile)
dcf = read.dcf(destfile)
colnames(dcf)
##  [1] "Package"            "Type"               "Title"             
##  [4] "Version"            "Author"             "Maintainer"        
##  [7] "Description"        "Imports"            "Depends"           
## [10] "License"            "Suggests"           "VignetteBuilder"   
## [13] "Remotes"            "BugReports"         "SystemRequirements"
## [16] "RoxygenNote"

Only "last" Remotes section held

dcf[, "Remotes"]
##               Remotes 
## "neuroconductor/fslr"

Parsing DESCRIPTION with default read.dcf(all = TRUE)

dcf_all = read.dcf(destfile, all = TRUE)
colnames(dcf_all)
##  [1] "Package"            "Type"               "Title"             
##  [4] "Version"            "Author"             "Maintainer"        
##  [7] "Description"        "Imports"            "Depends"           
## [10] "License"            "Suggests"           "VignetteBuilder"   
## [13] "Remotes"            "BugReports"         "SystemRequirements"
## [16] "RoxygenNote"

All Remotes section held, but in a list now

dcf_all[, "Remotes"]
## [[1]]
## [1] "muschellij2/fslr,muschellij2/oro.nifti"
## [2] "neuroconductor/fslr"

Behavior from devtools

No error/warning was generated (as none was generated in read.dcf), but the "last" entry of the field (in this case "Remotes") was output:

dcf_dev = devtools:::read_dcf(destfile)
dcf_dev$Remotes
## [1] "Remotes: neuroconductor/fslr"
@jimhester jimhester added feature a feature request or enhancement load labels Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement load
Projects
None yet
Development

No branches or pull requests

1 participant