0001 ---
0002 license: |
0003 Licensed to the Apache Software Foundation (ASF) under one or more
0004 contributor license agreements. See the NOTICE file distributed with
0005 this work for additional information regarding copyright ownership.
0006 The ASF licenses this file to You under the Apache License, Version 2.0
0007 (the "License"); you may not use this file except in compliance with
0008 the License. You may obtain a copy of the License at
0009
0010 http://www.apache.org/licenses/LICENSE-2.0
0011
0012 Unless required by applicable law or agreed to in writing, software
0013 distributed under the License is distributed on an "AS IS" BASIS,
0014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0015 See the License for the specific language governing permissions and
0016 limitations under the License.
0017 ---
0018
0019 # SparkR CRAN Release
0020
0021 To release SparkR as a package to CRAN, we would use the `devtools` package. Please work with the
0022 `dev@spark.apache.org` community and R package maintainer on this.
0023
0024 ### Release
0025
0026 First, check that the `Version:` field in the `pkg/DESCRIPTION` file is updated. Also, check for stale files not under source control.
0027
0028 Note that while `run-tests.sh` runs `check-cran.sh` (which runs `R CMD check`), it is doing so with `--no-manual --no-vignettes`, which skips a few vignettes or PDF checks - therefore it will be preferred to run `R CMD check` on the source package built manually before uploading a release. Also note that for CRAN checks for pdf vignettes to success, `qpdf` tool must be there (to install it, eg. `yum -q -y install qpdf`).
0029
0030 To upload a release, we would need to update the `cran-comments.md`. This should generally contain the results from running the `check-cran.sh` script along with comments on status of all `WARNING` (should not be any) or `NOTE`. As a part of `check-cran.sh` and the release process, the vignettes is build - make sure `SPARK_HOME` is set and Spark jars are accessible.
0031
0032 Once everything is in place, run in R under the `SPARK_HOME/R` directory:
0033
0034 ```R
0035 paths <- .libPaths(); .libPaths(c("lib", paths)); Sys.setenv(SPARK_HOME=tools::file_path_as_absolute("..")); devtools::release(); .libPaths(paths)
0036 ```
0037
0038 For more information please refer to http://r-pkgs.had.co.nz/release.html#release-check
0039
0040 ### Testing: build package manually
0041
0042 To build package manually such as to inspect the resulting `.tar.gz` file content, we would also use the `devtools` package.
0043
0044 Source package is what get released to CRAN. CRAN would then build platform-specific binary packages from the source package.
0045
0046 #### Build source package
0047
0048 To build source package locally without releasing to CRAN, run in R under the `SPARK_HOME/R` directory:
0049
0050 ```R
0051 paths <- .libPaths(); .libPaths(c("lib", paths)); Sys.setenv(SPARK_HOME=tools::file_path_as_absolute("..")); devtools::build("pkg"); .libPaths(paths)
0052 ```
0053
0054 (http://r-pkgs.had.co.nz/vignettes.html#vignette-workflow-2)
0055
0056 Similarly, the source package is also created by `check-cran.sh` with `R CMD build pkg`.
0057
0058 For example, this should be the content of the source package:
0059
0060 ```sh
0061 DESCRIPTION R inst tests
0062 NAMESPACE build man vignettes
0063
0064 inst/doc/
0065 sparkr-vignettes.html
0066 sparkr-vignettes.Rmd
0067 sparkr-vignettes.Rman
0068
0069 build/
0070 vignette.rds
0071
0072 man/
0073 *.Rd files...
0074
0075 vignettes/
0076 sparkr-vignettes.Rmd
0077 ```
0078
0079 #### Test source package
0080
0081 To install, run this:
0082
0083 ```sh
0084 R CMD INSTALL SparkR_2.1.0.tar.gz
0085 ```
0086
0087 With "2.1.0" replaced with the version of SparkR.
0088
0089 This command installs SparkR to the default libPaths. Once that is done, you should be able to start R and run:
0090
0091 ```R
0092 library(SparkR)
0093 vignette("sparkr-vignettes", package="SparkR")
0094 ```
0095
0096 #### Build binary package
0097
0098 To build binary package locally, run in R under the `SPARK_HOME/R` directory:
0099
0100 ```R
0101 paths <- .libPaths(); .libPaths(c("lib", paths)); Sys.setenv(SPARK_HOME=tools::file_path_as_absolute("..")); devtools::build("pkg", binary = TRUE); .libPaths(paths)
0102 ```
0103
0104 For example, this should be the content of the binary package:
0105
0106 ```sh
0107 DESCRIPTION Meta R html tests
0108 INDEX NAMESPACE help profile worker
0109 ```