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

New argument OSflavour to insertPackage(). #142

Merged
merged 3 commits into from
Oct 28, 2023

Conversation

arnejohannesholmin
Copy link
Contributor

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 using getPackageInfo which reads the 'Built' field, so for these packages OSFlavour will be empty.

My suggestion is to add an argument OSflavour to insertPackcage and getPackageInfo which if given will set the OSFlavour. I used OSFlavour = 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.

Copy link
Owner

@eddelbuettel eddelbuettel left a 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?

@@ -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).
Copy link
Owner

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.)

@@ -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).
Copy link
Owner

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)) {
Copy link
Owner

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.

Copy link
Contributor Author

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).

Copy link
Owner

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).

@eddelbuettel eddelbuettel changed the title New argument OSflavour to insertPackcage(). New argument OSflavour to insertPackage(). Oct 28, 2023
Copy link
Owner

@eddelbuettel eddelbuettel left a 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!

@eddelbuettel eddelbuettel merged commit b116356 into eddelbuettel:master Oct 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants