Skip to content

Conversation

@HyukjinKwon
Copy link
Member

What changes were proposed in this pull request?

Seems like in certain environment, it requires to set setwd as below:

> library(devtools); devtools::document(pkg="./pkg", roclets=c("rd"))
Loading required package: usethis
Error: Could not find package root, is your working directory inside a package?

see also https://stackoverflow.com/questions/52670051/how-to-troubleshoot-error-could-not-find-package-root and https://groups.google.com/forum/#!topic/rdevtools/79jjjdc_wjg

We can make up another story too. For example, if you set a specific directory in your ~/.Rprofile, then R documentation build will fail as below:

echo 'setwd("~")' > ~/.Rprofile
sh R/create-rd.sh
Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Error: Can't find './pkg'.
Execution halted

This PR proposes to set the setwd explicitly so it does not get affected on the global environment.

Why are the changes needed?

To make R dev env more independent.

Does this PR introduce any user-facing change?

No, dev only.

How was this patch tested?

Manually tested:

echo 'setwd("~")' > ~/.Rprofile
sh R/create-rd.sh

Before:

Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Error: Can't find './pkg'.
Execution halted

After:

Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Updating SparkR documentation
Loading SparkR
Creating a new generic function for ‘as.data.frame’ in package ‘SparkR’
Creating a new generic function for ‘colnames’ in package ‘SparkR’
Creating a new generic function for ‘colnames<-’ in package ‘SparkR’
Creating a new generic function for ‘cov’ in package ‘SparkR’
Creating a new generic function for ‘drop’ in package ‘SparkR’
Creating a new generic function for ‘na.omit’ in package ‘SparkR’
Creating a new generic function for ‘filter’ in package ‘SparkR’
Creating a new generic function for ‘intersect’ in package ‘SparkR’
...

@HyukjinKwon
Copy link
Member Author

cc @shivaram and @felixcheung

@dongjoon-hyun
Copy link
Member

Retest this please.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-31510[R][BUILD] Set setwd in R documentation build [SPARK-31510][R][BUILD] Set setwd in R documentation build Apr 21, 2020
@HyukjinKwon
Copy link
Member Author

retest this please

@HyukjinKwon
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Apr 22, 2020

Test build #121603 has finished for PR 28285 at commit a1a81f9.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Merged to master.

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Apr 22, 2020

Ur, it seems there is anomaly at merging from my side.

git fetch apache-github pull/28285/head:PR_TOOL_MERGE_PR_28285
fatal: couldn't find remote ref pull/28285/head

@dongjoon-hyun
Copy link
Member

Could you merge this, @HyukjinKwon ?

@HyukjinKwon
Copy link
Member Author

Sure, merged to master.

Thanks, @dongjoon-hyun!

@HyukjinKwon
Copy link
Member Author

Huh .. ? it's weird - I can't use my merge script either .. let me merge it by myself.

@HyukjinKwon
Copy link
Member Author

I manually merged. Thanks @dongjoon-hyun!

@dongjoon-hyun
Copy link
Member

Thank you! Ya. It was really weird.

@HyukjinKwon
Copy link
Member Author

I also merged this into branch-3.0.

HyukjinKwon added a commit that referenced this pull request Apr 24, 2020
Seems like in certain environment, it requires to set `setwd` as below:

```
> library(devtools); devtools::document(pkg="./pkg", roclets=c("rd"))
Loading required package: usethis
Error: Could not find package root, is your working directory inside a package?
```

see also https://stackoverflow.com/questions/52670051/how-to-troubleshoot-error-could-not-find-package-root and https://groups.google.com/forum/#!topic/rdevtools/79jjjdc_wjg

We can make up another story too. For example, if you set a specific directory in your `~/.Rprofile`, then R documentation build will fail as below:

```
echo 'setwd("~")' > ~/.Rprofile
sh R/create-rd.sh
```

```
Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Error: Can't find './pkg'.
Execution halted
```

This PR proposes to set the `setwd` explicitly so it does not get affected on the global environment.

To make R dev env more independent.

No, dev only.

Manually tested:

```bash
echo 'setwd("~")' > ~/.Rprofile
sh R/create-rd.sh
```

Before:

```
Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Error: Can't find './pkg'.
Execution halted
```

After:

```
Using R_SCRIPT_PATH = /usr/local/bin
Loading required package: usethis
Updating SparkR documentation
Loading SparkR
Creating a new generic function for ‘as.data.frame’ in package ‘SparkR’
Creating a new generic function for ‘colnames’ in package ‘SparkR’
Creating a new generic function for ‘colnames<-’ in package ‘SparkR’
Creating a new generic function for ‘cov’ in package ‘SparkR’
Creating a new generic function for ‘drop’ in package ‘SparkR’
Creating a new generic function for ‘na.omit’ in package ‘SparkR’
Creating a new generic function for ‘filter’ in package ‘SparkR’
Creating a new generic function for ‘intersect’ in package ‘SparkR’
...
```

Closes #28285
@HyukjinKwon HyukjinKwon deleted the SPARK-31510 branch December 7, 2020 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants