Skip to content

Commit c33e4b0

Browse files
committed
[SPARK-16507][SPARKR] Add a CRAN checker, fix Rd aliases
## What changes were proposed in this pull request? Add a check-cran.sh script that runs `R CMD check` as CRAN. Also fixes a number of issues pointed out by the check. These include - Updating `DESCRIPTION` to be appropriate - Adding a .Rbuildignore to ignore lintr, src-native, html that are non-standard files / dirs - Adding aliases to all S4 methods in DataFrame, Column, GroupedData etc. This is required as stated in https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Documenting-S4-classes-and-methods - Other minor fixes ## How was this patch tested? SparkR unit tests, running the above mentioned script Author: Shivaram Venkataraman <[email protected]> Closes #14173 from shivaram/sparkr-cran-changes.
1 parent 4167304 commit c33e4b0

File tree

17 files changed

+676
-43
lines changed

17 files changed

+676
-43
lines changed

R/check-cran.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
set -o pipefail
21+
set -e
22+
23+
FWDIR="$(cd `dirname $0`; pwd)"
24+
pushd $FWDIR > /dev/null
25+
26+
if [ ! -z "$R_HOME" ]
27+
then
28+
R_SCRIPT_PATH="$R_HOME/bin"
29+
else
30+
# if system wide R_HOME is not found, then exit
31+
if [ ! `command -v R` ]; then
32+
echo "Cannot find 'R_HOME'. Please specify 'R_HOME' or make sure R is properly installed."
33+
exit 1
34+
fi
35+
R_SCRIPT_PATH="$(dirname $(which R))"
36+
fi
37+
echo "USING R_HOME = $R_HOME"
38+
39+
# Build the latest docs
40+
$FWDIR/create-docs.sh
41+
42+
# Build a zip file containing the source package
43+
"$R_SCRIPT_PATH/"R CMD build $FWDIR/pkg
44+
45+
# Run check as-cran.
46+
# TODO(shivaram): Remove the skip tests once we figure out the install mechanism
47+
48+
VERSION=`grep Version $FWDIR/pkg/DESCRIPTION | awk '{print $NF}'`
49+
50+
"$R_SCRIPT_PATH/"R CMD check --as-cran --no-tests SparkR_"$VERSION".tar.gz
51+
52+
popd > /dev/null

R/pkg/.Rbuildignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$
3+
^\.lintr$
4+
^src-native$
5+
^html$

R/pkg/DESCRIPTION

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
Package: SparkR
22
Type: Package
3-
Title: R frontend for Spark
3+
Title: R Frontend for Apache Spark
44
Version: 2.0.0
5-
Date: 2013-09-09
5+
Date: 2016-07-07
66
Author: The Apache Software Foundation
77
Maintainer: Shivaram Venkataraman <[email protected]>
8-
Imports:
9-
methods
108
Depends:
119
R (>= 3.0),
1210
methods,
1311
Suggests:
1412
testthat,
1513
e1071,
1614
survival
17-
Description: R frontend for Spark
15+
Description: The SparkR package provides an R frontend for Apache Spark.
1816
License: Apache License (== 2.0)
1917
Collate:
2018
'schema.R'

R/pkg/NAMESPACE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,3 +343,12 @@ export("partitionBy",
343343

344344
export("windowPartitionBy",
345345
"windowOrderBy")
346+
347+
S3method(print, jobj)
348+
S3method(print, structField)
349+
S3method(print, structType)
350+
S3method(print, summary.GeneralizedLinearRegressionModel)
351+
S3method(structField, character)
352+
S3method(structField, jobj)
353+
S3method(structType, jobj)
354+
S3method(structType, structField)

0 commit comments

Comments
 (0)