-
Notifications
You must be signed in to change notification settings - Fork 101
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
New argument OSflavour to insertPackage(). #142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Initial comments inline.
A ChangeLog entry would be good too. And maybe an illustration about how you use it, ie the default value used in YAML you mentioned in the PR?
R/insertPackage.R
Outdated
@@ -55,6 +55,7 @@ | |||
##' either \dQuote{gh-pages} indicating a branch of that name, or | |||
##' \dQuote{docs/} directory in the main branch. The default value can | |||
##' be overridden via the \dQuote{dratBranch} option. | |||
##' @param OSflavour an optional string naming the OSflavour, which is otherwise read as the second element of the 'Built' field of the \code{file}. For packages that do not need compilation on macOS for R >= 4.3 the 'Built' field is empty in the DESCRIPTION in a binary file (tgz), in which case it can be useful to set the \code{OSflavour} e.g. by the value of R.Version()$platform, so that \code{\link{insertPackages}} inserts the binary into the appropriate sub folder (under bin/maxosx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please wrap the line as usual at about the same width as the other lines? (My editor (Emacs) does that by itself in a markdown blob, others may too.)
R/insertPackage.R
Outdated
@@ -272,12 +274,13 @@ identifyPackageType <- function(file, pkginfo = getPackageInfo(file)) { | |||
##' | |||
##' @title Get information from a binary package | |||
##' @param file the fully qualified path of the package | |||
##' @param OSflavour an optional string naming the OSflavour, which is otherwise read as the second element of the 'Built' field of the \code{file}. For packages that do not need compilation on macOS for R >= 4.3 the 'Built' field is empty in the DESCRIPTION in a binary file (tgz), in which case it can be useful to set the \code{OSflavour} e.g. by the value of R.Version()$platform, so that \code{\link{insertPackages}} inserts the binary into the appropriate sub folder (under bin/maxosx). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
@@ -305,6 +308,11 @@ getPackageInfo <- function(file) { | |||
|
|||
fields <- strsplit(builtstring, "; ")[[1]] | |||
names(fields) <- c("Rversion", "OSflavour", "Date", "OS") | |||
|
|||
# Insert the OSflavour if specified by the user: | |||
if(length(OSflavour) && is.character(OSflavour)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we set the default to NULL
we should check for null. Else instead of NULL
maybe use character()
? Then your test for length and type is good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes you suggested (character() instead of NULL as default, documentation of OSflavour wrapped to 100 characters with suggested value R.Version()$platform, and an entry in the ChangeLog).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much -- it's long been merged :) And a casual dratInsert.r
(using a wrapper from littler
) worked fine for me too (and I generally have a vanilla setup with source tarballs only in my drat
-using repos).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and thanks for making those changes!
Hi,
I discovered a problem with macOS for R >= 4.3, where the 'Built' field is now empty in the DESCRIPTION in a binary file (tgz) for a package that does not need compilation. In
insertPackcage
the OSFlavour is read from the 'Built' field usinggetPackageInfo
which reads the 'Built' field, so for these packages OSFlavour will be empty.My suggestion is to add an argument
OSflavour
toinsertPackcage
andgetPackageInfo
which if given will set theOSFlavour
. I usedOSFlavour = R.Version()$platform
in my yaml files for all platforms (macOS, Windows, Ubuntu) and it seems to have worked as intended.It has been a while since I tried this but I never got around to create the pull request until the new version of drat (0.2.4) came out on CRAN and reminded me of it.