From c053ff178842e17adc6d4ec7f3b4a8281d43e364 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Mon, 9 Jan 2023 13:13:10 -0500 Subject: [PATCH 1/6] deprecate exported NEWS related functions --- R/getPackageNEWS.R | 17 ++++++++++++++++- R/repository.R | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/R/getPackageNEWS.R b/R/getPackageNEWS.R index a714b57..480b516 100644 --- a/R/getPackageNEWS.R +++ b/R/getPackageNEWS.R @@ -15,7 +15,14 @@ getPackageNEWS <- function(prevRepos="3.6", currRepos="3.7", repo=c("bioc", "data/experiment", "workflows"), srcdir=NULL){ - + .Deprecated( + "getPackagesNEWS", "ReleaseLaunch", + c( + "'getPackageNEWS' is deprecated.\n", + "Use 'ReleaseLaunch::getPackagesNEWS' instead.\n", + "See help(\"getPackagesNEWS\", package = \"ReleaseLaunch\")" + ) + ) repo <- match.arg(repo) URL_BASE <- "http://master.bioconductor.org/packages/" VIEWS <- "%s%s/%s/VIEWS" @@ -166,6 +173,14 @@ getNEWSFromFile <- function (dir, destfile, format = NULL, reader = NULL, printNEWS <- function(dbs, destfile, overwrite=FALSE, width=68, output=c("md", "text"), relativeLink=FALSE, ...) { + .Deprecated( + "printNEWS", "ReleaseLaunch", + c( + "'printNEWS' is deprecated.\n", + "Use 'ReleaseLaunch::printNEWS' instead.\n", + "See help(\"printNEWS\", package = \"ReleaseLaunch\")" + ) + ) output <- match.arg(output) dbs <- lapply(dbs, function(db) { db[["Text"]] <- sapply(db[["Text"]], function(elt) { diff --git a/R/repository.R b/R/repository.R index eb3b041..e3e5457 100644 --- a/R/repository.R +++ b/R/repository.R @@ -309,6 +309,14 @@ extractReadmes <- function(reposRoot, srcContrib, destDir) { } extractNEWS <- function(reposRoot, srcContrib, destDir) { + .Deprecated( + "extractNEWS", "ReleaseLaunch", + c( + "'extractNEWS' is deprecated.\n", + "Use 'ReleaseLaunch::extractNEWS' instead.\n", + "See help(\"extractNEWS\", package = \"ReleaseLaunch\")" + ) + ) if (missing(destDir)) destDir <- file.path(reposRoot, "news") From 105d2021c17bd15274db743b9c95a3f1211b2162 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Fri, 10 Feb 2023 17:02:41 -0500 Subject: [PATCH 2/6] remove old doc files and move info to biocViews-deprecated --- R/getPackageNEWS.R | 4 +- ...PackageNEWS.Rd => biocViews-deprecated.Rd} | 49 ++++++++++++------- man/extractNEWS.Rd | 17 ------- 3 files changed, 34 insertions(+), 36 deletions(-) rename man/{getPackageNEWS.Rd => biocViews-deprecated.Rd} (63%) delete mode 100644 man/extractNEWS.Rd diff --git a/R/getPackageNEWS.R b/R/getPackageNEWS.R index 480b516..9a9a302 100644 --- a/R/getPackageNEWS.R +++ b/R/getPackageNEWS.R @@ -9,7 +9,7 @@ ## collate package NEWS files using starting version number in ## prevRepos, and membership in currRepos as references. Package ## source tree rooted at srcDir, possibiblly as tarred files - +utils::globalVariables("Version") # repo: bioc data/experiment workflows getPackageNEWS <- function(prevRepos="3.6", currRepos="3.7", @@ -20,7 +20,7 @@ getPackageNEWS <- function(prevRepos="3.6", c( "'getPackageNEWS' is deprecated.\n", "Use 'ReleaseLaunch::getPackagesNEWS' instead.\n", - "See help(\"getPackagesNEWS\", package = \"ReleaseLaunch\")" + "See help(\"biocViews-deprecated\")" ) ) repo <- match.arg(repo) diff --git a/man/getPackageNEWS.Rd b/man/biocViews-deprecated.Rd similarity index 63% rename from man/getPackageNEWS.Rd rename to man/biocViews-deprecated.Rd index b1f7a82..7fd7505 100644 --- a/man/getPackageNEWS.Rd +++ b/man/biocViews-deprecated.Rd @@ -1,24 +1,30 @@ -\name{getPackageNEWS} +\name{biocViews-deprecated} + \alias{getPackageNEWS} \alias{printNEWS} -\title{ - Retrieve and print package NEWS -} -\description{ +\alias{extractNEWS} +\alias{biocViews-deprecated} - These functions visit two Bioconductor releases, identifying - packages that are present in the \sQuote{current} repository and have - NEWS since the base version of the same package in the - \sQuote{previous} release. All NEWS is reported for packages only - in the current repository. +\title{Deprecated NEWS functions in biocViews} + +\description{ + Functions working with a package's NEWS file have been moved out of the + package. These include \code{getPackageNEWS}, \code{printNEWS}, and + \code{extractNEWS}. Please see the \code{ReleaseLaunch} package. } + \usage{ -getPackageNEWS(prevRepos="3.6", - currRepos="3.7", - repo=c("bioc", "data/experiment", "workflows"), - srcdir = NULL) -printNEWS(dbs, destfile, overwrite = FALSE, width = 68, - output=c("md", "text"), relativeLink=FALSE, ...) +getPackageNEWS( + prevRepos="3.6", + currRepos="3.7", + repo=c("bioc", "data/experiment", "workflows"), + srcdir = NULL +) +printNEWS( + dbs, destfile, overwrite = FALSE, width = 68, output=c("md", "text"), + relativeLink=FALSE, ... +) +extractNEWS(reposRoot, srcContrib, destDir) } \arguments{ @@ -53,8 +59,14 @@ printNEWS(dbs, destfile, overwrite = FALSE, width = 68, 'https//bioconductor.org'. default: FALSE is full url.} \item{...}{additional arguments, unused.} - + + \item{reposRoot}{Top level path for CRAN-style repos} + + \item{srcContrib}{Location of source packages} + + \item{destDir}{where to extract} } + \value{ A list of \code{news_db} files, as returned by \code{utils::news}, for each package for which relevant NEWS is available. @@ -63,4 +75,7 @@ printNEWS(dbs, destfile, overwrite = FALSE, width = 68, Martin Morgan \url{mtmorgan@fhcrc.org} and Lori Shepherd } +\seealso{\url{https://github.com/Bioconductor/ReleaseLaunch}} + \keyword{manip}% __ONLY ONE__ keyword per line +\keyword{utilities} diff --git a/man/extractNEWS.Rd b/man/extractNEWS.Rd deleted file mode 100644 index d14d320..0000000 --- a/man/extractNEWS.Rd +++ /dev/null @@ -1,17 +0,0 @@ -\name{extractNEWS} -\alias{extractNEWS} -\title{Extract NEWS files from source package tarballs} -\description{ - Extracts NEWS files from source tarballs of packages. -} -\usage{ -extractNEWS(reposRoot, srcContrib, destDir) -} -%- maybe also 'usage' for other objects documented here. -\arguments{ - \item{reposRoot}{Top level path for CRAN-style repos} - \item{srcContrib}{Location of source packages} - \item{destDir}{where to extract} -} - -\keyword{utilities} From bb466f5307014b77ae6ad0affc345e7ba5fd40b8 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Fri, 10 Feb 2023 17:05:29 -0500 Subject: [PATCH 3/6] include NEWS file entry --- NEWS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NEWS b/NEWS index b3aa02d..cfc5dc2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +CHANGES IN VERSION 1.68.0 +------------------------- + +NEW FEATURES + + o getPackageNEWS, printNEWS, and extractNEWS are all deprecated from + biocViews. See help('biocViews-deprecated') for more details. + CHANGES IN VERSION 1.67.0 ------------------------- From bd690ff9c585a14fbd95e4bc1d73df1ea1f69fd3 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Fri, 10 Feb 2023 17:08:10 -0500 Subject: [PATCH 4/6] fix help() call in .Deprecated message --- R/getPackageNEWS.R | 2 +- R/repository.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/getPackageNEWS.R b/R/getPackageNEWS.R index 9a9a302..0d7ee7a 100644 --- a/R/getPackageNEWS.R +++ b/R/getPackageNEWS.R @@ -178,7 +178,7 @@ printNEWS <- function(dbs, destfile, overwrite=FALSE, width=68, c( "'printNEWS' is deprecated.\n", "Use 'ReleaseLaunch::printNEWS' instead.\n", - "See help(\"printNEWS\", package = \"ReleaseLaunch\")" + "See help(\"biocViews-deprecated\")" ) ) output <- match.arg(output) diff --git a/R/repository.R b/R/repository.R index e3e5457..dbbeb63 100644 --- a/R/repository.R +++ b/R/repository.R @@ -314,7 +314,7 @@ extractNEWS <- function(reposRoot, srcContrib, destDir) { c( "'extractNEWS' is deprecated.\n", "Use 'ReleaseLaunch::extractNEWS' instead.\n", - "See help(\"extractNEWS\", package = \"ReleaseLaunch\")" + "See help(\"biocViews-deprecated\")" ) ) From cb37f519a2528f9d3d3d7c0242b3776ebfa0f929 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Fri, 17 Feb 2023 14:12:51 -0500 Subject: [PATCH 5/6] un deprecate extractNEWS and restore man page --- NEWS | 4 ++-- R/repository.R | 8 -------- man/biocViews-deprecated.Rd | 13 ++----------- man/extractNEWS.Rd | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 man/extractNEWS.Rd diff --git a/NEWS b/NEWS index cfc5dc2..9201f65 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,8 @@ CHANGES IN VERSION 1.68.0 NEW FEATURES - o getPackageNEWS, printNEWS, and extractNEWS are all deprecated from - biocViews. See help('biocViews-deprecated') for more details. + o getPackageNEWS and printNEWS are deprecated from biocViews. + See help('biocViews-deprecated') for more details. CHANGES IN VERSION 1.67.0 ------------------------- diff --git a/R/repository.R b/R/repository.R index dbbeb63..eb3b041 100644 --- a/R/repository.R +++ b/R/repository.R @@ -309,14 +309,6 @@ extractReadmes <- function(reposRoot, srcContrib, destDir) { } extractNEWS <- function(reposRoot, srcContrib, destDir) { - .Deprecated( - "extractNEWS", "ReleaseLaunch", - c( - "'extractNEWS' is deprecated.\n", - "Use 'ReleaseLaunch::extractNEWS' instead.\n", - "See help(\"biocViews-deprecated\")" - ) - ) if (missing(destDir)) destDir <- file.path(reposRoot, "news") diff --git a/man/biocViews-deprecated.Rd b/man/biocViews-deprecated.Rd index 7fd7505..ef54ed9 100644 --- a/man/biocViews-deprecated.Rd +++ b/man/biocViews-deprecated.Rd @@ -2,15 +2,14 @@ \alias{getPackageNEWS} \alias{printNEWS} -\alias{extractNEWS} \alias{biocViews-deprecated} \title{Deprecated NEWS functions in biocViews} \description{ Functions working with a package's NEWS file have been moved out of the - package. These include \code{getPackageNEWS}, \code{printNEWS}, and - \code{extractNEWS}. Please see the \code{ReleaseLaunch} package. + package. These include \code{getPackageNEWS}, and \code{printNEWS}. + Please see the \code{ReleaseLaunch} package. } \usage{ @@ -24,7 +23,6 @@ printNEWS( dbs, destfile, overwrite = FALSE, width = 68, output=c("md", "text"), relativeLink=FALSE, ... ) -extractNEWS(reposRoot, srcContrib, destDir) } \arguments{ @@ -59,12 +57,6 @@ extractNEWS(reposRoot, srcContrib, destDir) 'https//bioconductor.org'. default: FALSE is full url.} \item{...}{additional arguments, unused.} - - \item{reposRoot}{Top level path for CRAN-style repos} - - \item{srcContrib}{Location of source packages} - - \item{destDir}{where to extract} } \value{ @@ -78,4 +70,3 @@ extractNEWS(reposRoot, srcContrib, destDir) \seealso{\url{https://github.com/Bioconductor/ReleaseLaunch}} \keyword{manip}% __ONLY ONE__ keyword per line -\keyword{utilities} diff --git a/man/extractNEWS.Rd b/man/extractNEWS.Rd new file mode 100644 index 0000000..d14d320 --- /dev/null +++ b/man/extractNEWS.Rd @@ -0,0 +1,17 @@ +\name{extractNEWS} +\alias{extractNEWS} +\title{Extract NEWS files from source package tarballs} +\description{ + Extracts NEWS files from source tarballs of packages. +} +\usage{ +extractNEWS(reposRoot, srcContrib, destDir) +} +%- maybe also 'usage' for other objects documented here. +\arguments{ + \item{reposRoot}{Top level path for CRAN-style repos} + \item{srcContrib}{Location of source packages} + \item{destDir}{where to extract} +} + +\keyword{utilities} From b48511e5c7ecad83c79ad4be58f8c8287d34f2c5 Mon Sep 17 00:00:00 2001 From: LiNk-NY Date: Fri, 17 Feb 2023 14:15:55 -0500 Subject: [PATCH 6/6] move getNEWSFromFile to R/repository.R --- R/getPackageNEWS.R | 90 ---------------------------------------------- R/repository.R | 88 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+), 90 deletions(-) diff --git a/R/getPackageNEWS.R b/R/getPackageNEWS.R index 0d7ee7a..0649d8a 100644 --- a/R/getPackageNEWS.R +++ b/R/getPackageNEWS.R @@ -80,96 +80,6 @@ getPackageNEWS <- function(prevRepos="3.6", } - -## based on tools:::.build_news_db() -getNEWSFromFile <- function (dir, destfile, format = NULL, reader = NULL, - output=c("md", "text")) -{ - mdIfy <- function(txt) - { - lines <- strsplit(txt, "\n") - segs <- lines[[1]] - segs <- sub("^ o +", "- ", segs) - segs <- sub("^\t", " ", segs) - return(paste(segs, collapse="\n")) - } - - newsRdFile <- file.path(dir, "NEWS.Rd") ## should never be found - newsRdFile2 <- file.path(dir, "inst", "NEWS.Rd") - - if (!file_test("-f", newsRdFile) && !file_test("-f", newsRdFile2)) { - - - newsMdFile <- file.path(dir, "NEWS.md") - newsMdFile2 <- file.path(dir, "inst", "NEWS.md") - - if (!file_test("-f", newsMdFile) && !file_test("-f", newsMdFile2)) { - - - nfile <- file.path(dir, "NEWS") - nfile2 <- file.path(dir, "inst", "NEWS") - - - if (!file_test("-f", nfile) && !file_test("-f", nfile2)) - return(invisible()) - - nfile <- ifelse(file_test("-f", nfile), nfile, nfile2) - - if (!is.null(format)) - .NotYetUsed("format", FALSE) - if (!is.null(reader)) - .NotYetUsed("reader", FALSE) - - file <- file(destfile, "w+") - on.exit(close(file)) - news <- paste(readLines(nfile), collapse="\n") - if ("md" == output) - news = mdIfy(news) - cat(news, file=file) - return(invisible()) - } - - newsMdFile <- ifelse(file_test("-f", newsMdFile), newsMdFile, - newsMdFile2) - file <- file(destfile, "w+") - on.exit(close(file)) - db <- tools:::.build_news_db_from_package_NEWS_md(newsMdFile) - news <- NULL - try(news <- capture.output(print(db))) - if (is.null(news)) - { - message(sprintf("Error building news database for %s/%s", - dir, destfile)) - return(invisible()) - } - news <- paste(news, collapse="\n") - if ("md" == output) - news <- mdIfy(news) - cat(news, file=file) - return(invisible()) - } - - newsRdFile <- ifelse(file_test("-f", newsRdFile), newsRdFile, newsRdFile2) - - file <- file(destfile, "w+") - on.exit(close(file)) - db <- tools:::.build_news_db_from_package_NEWS_Rd(newsRdFile) - news <- NULL - try(news <- capture.output(print(db))) - if (is.null(news)) - { - message(sprintf("Error building news database for %s/%s", - dir, destfile)) - return(invisible()) - } - news <- paste(news, collapse="\n") - if ("md" == output) - news <- mdIfy(news) - cat(news, file=file) - return(invisible()) -} - - printNEWS <- function(dbs, destfile, overwrite=FALSE, width=68, output=c("md", "text"), relativeLink=FALSE, ...) { diff --git a/R/repository.R b/R/repository.R index eb3b041..b591da8 100644 --- a/R/repository.R +++ b/R/repository.R @@ -308,6 +308,94 @@ extractReadmes <- function(reposRoot, srcContrib, destDir) { extractTopLevelFiles(reposRoot, srcContrib, destDir, "README") } +## based on tools:::.build_news_db() +getNEWSFromFile <- function (dir, destfile, format = NULL, reader = NULL, + output=c("md", "text")) +{ + mdIfy <- function(txt) + { + lines <- strsplit(txt, "\n") + segs <- lines[[1]] + segs <- sub("^ o +", "- ", segs) + segs <- sub("^\t", " ", segs) + return(paste(segs, collapse="\n")) + } + + newsRdFile <- file.path(dir, "NEWS.Rd") ## should never be found + newsRdFile2 <- file.path(dir, "inst", "NEWS.Rd") + + if (!file_test("-f", newsRdFile) && !file_test("-f", newsRdFile2)) { + + + newsMdFile <- file.path(dir, "NEWS.md") + newsMdFile2 <- file.path(dir, "inst", "NEWS.md") + + if (!file_test("-f", newsMdFile) && !file_test("-f", newsMdFile2)) { + + + nfile <- file.path(dir, "NEWS") + nfile2 <- file.path(dir, "inst", "NEWS") + + + if (!file_test("-f", nfile) && !file_test("-f", nfile2)) + return(invisible()) + + nfile <- ifelse(file_test("-f", nfile), nfile, nfile2) + + if (!is.null(format)) + .NotYetUsed("format", FALSE) + if (!is.null(reader)) + .NotYetUsed("reader", FALSE) + + file <- file(destfile, "w+") + on.exit(close(file)) + news <- paste(readLines(nfile), collapse="\n") + if ("md" == output) + news = mdIfy(news) + cat(news, file=file) + return(invisible()) + } + + newsMdFile <- ifelse(file_test("-f", newsMdFile), newsMdFile, + newsMdFile2) + file <- file(destfile, "w+") + on.exit(close(file)) + db <- tools:::.build_news_db_from_package_NEWS_md(newsMdFile) + news <- NULL + try(news <- capture.output(print(db))) + if (is.null(news)) + { + message(sprintf("Error building news database for %s/%s", + dir, destfile)) + return(invisible()) + } + news <- paste(news, collapse="\n") + if ("md" == output) + news <- mdIfy(news) + cat(news, file=file) + return(invisible()) + } + + newsRdFile <- ifelse(file_test("-f", newsRdFile), newsRdFile, newsRdFile2) + + file <- file(destfile, "w+") + on.exit(close(file)) + db <- tools:::.build_news_db_from_package_NEWS_Rd(newsRdFile) + news <- NULL + try(news <- capture.output(print(db))) + if (is.null(news)) + { + message(sprintf("Error building news database for %s/%s", + dir, destfile)) + return(invisible()) + } + news <- paste(news, collapse="\n") + if ("md" == output) + news <- mdIfy(news) + cat(news, file=file) + return(invisible()) +} + extractNEWS <- function(reposRoot, srcContrib, destDir) { if (missing(destDir))