From 6923342cf409d0581f59c1a1971f926faa19df7e Mon Sep 17 00:00:00 2001 From: avinab-neogy Date: Thu, 28 Aug 2025 01:20:28 +0530 Subject: [PATCH 1/5] updated localscript to install git r --- scripts/localscript.sh | 63 ++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/scripts/localscript.sh b/scripts/localscript.sh index 083bf016..52848e7b 100644 --- a/scripts/localscript.sh +++ b/scripts/localscript.sh @@ -2,39 +2,42 @@ # This script is run after the workspace is created - local_script(){ - -# Workspace root is $PWD at the start -WORK_DIR=$PWD -VSCODE_DIR="$WORK_DIR/.vscode" -DEVCONTAINER_JSON="$WORK_DIR/.devcontainer/devcontainer.json" - -# Create patch directory in workspace root ($PWD at start) -PATCHDIR="$WORK_DIR/patches" -mkdir -p $PATCHDIR -mkdir -p $VSCODE_DIR - -# Copy the which_r and set_build_r function definitions to .bashrc -cat $WORK_DIR/scripts/which_r.sh >> ~/.bashrc -cat $WORK_DIR/scripts/set_build_r.sh >> ~/.bashrc - -# Copy over the welcome message script to be run when bash terminal starts -cat $WORK_DIR/scripts/welcome_msg.sh >> ~/.bashrc - -#bash ~/.bashrc - -# Remove git directory if it exists -#rm -rf .git - -# copying vscode extension settings from devcontainer json to vscode settings json using jq -if [ -f "$DEVCONTAINER_JSON" ]; then + # Workspace root is $PWD at the start + WORK_DIR=$PWD + VSCODE_DIR="$WORK_DIR/.vscode" + DEVCONTAINER_JSON="$WORK_DIR/.devcontainer/devcontainer.json" + + # Create patch directory in workspace root ($PWD at start) + PATCHDIR="$WORK_DIR/patches" + mkdir -p "$PATCHDIR" + mkdir -p "$VSCODE_DIR" + + # Copy the which_r and set_build_r function definitions to .bashrc + cat "$WORK_DIR/scripts/which_r.sh" >> ~/.bashrc + cat "$WORK_DIR/scripts/set_build_r.sh" >> ~/.bashrc + + # Copy over the welcome message script to be run when bash terminal starts + cat "$WORK_DIR/scripts/welcome_msg.sh" >> ~/.bashrc + + # Install git-r tool to /usr/local/bin (already on PATH) + echo "Installing git-r tool..." + curl -L -o /tmp/git-r \ + https://raw.githubusercontent.com/HenrikBengtsson/git-r/master/bin/git-r + + if [ $? -eq 0 ]; then + chmod +x /tmp/git-r + sudo mv /tmp/git-r /usr/local/bin/git-r + echo "git-r installed successfully to /usr/local/bin/git-r" + else + echo "Failed to download git-r" + fi + + # Copy VS Code settings from devcontainer.json to .vscode/settings.json + if [ -f "$DEVCONTAINER_JSON" ]; then jq '.customizations.vscode.settings' "$DEVCONTAINER_JSON" > "$VSCODE_DIR/settings.json" -fi - - + fi } - # Run the main function local_script From f2c520df47be00fd31128ca70005bf982861ed8e Mon Sep 17 00:00:00 2001 From: avinab-neogy Date: Thu, 28 Aug 2025 01:53:17 +0530 Subject: [PATCH 2/5] added documentation for the git r workflow --- docs/tutorials/git_r_workflow.md | 109 +++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 110 insertions(+) create mode 100644 docs/tutorials/git_r_workflow.md diff --git a/docs/tutorials/git_r_workflow.md b/docs/tutorials/git_r_workflow.md new file mode 100644 index 00000000..1fbd1e04 --- /dev/null +++ b/docs/tutorials/git_r_workflow.md @@ -0,0 +1,109 @@ +# Alternate git-r workflow for R Development + +This guide briefly covers using **git-r** inside the +r-dev-env container to develop, build, and push changes +to R source. + + +#### 1. Update Your Local Source + +- Open a terminal in the container. +- Clone the R SVN mirror repository if you haven’t already: + + ``` + git clone https://github.com/r-devel/r-svn.git /workspaces/r-dev-env/r-source + ``` + +- Navigate to your cloned R SVN mirror repository: + + ``` + cd /workspaces/r-dev-env/r-source + ``` + +- Fetch the latest commits: + + ``` + git fetch origin + ``` + +- Synchronize the internal SVN metadata used by R’s build system: + + ``` + git r svn-revision + ``` + + +#### 2. Build R from Source + +- Use `git-r` commands to configure, build, and install R: + + ``` + git r configure --enable-R-shlib --enable-memory-profiling --without-recommended-packages + git r build + git r install + ``` + +- To include recommended packages: + + ``` + git r pull-recommended + git r build-recommended + ``` + + +#### 3. Make Your Code Changes + +- Make edits or additions within the source tree (`src/`, `R/`, etc.). + For example: + + ``` + echo "// Fix for bug 12345" >> src/main/arithmetic.c + ``` + +- Commit your changes locally to track them with Git: + + ``` + git add src/main/arithmetic.c + git commit -m "Fix arithmetic bug (12345)" + ``` + + +#### 4. Push Your Changes to Your Fork of r-svn + +- Add your personal fork as a remote (replace YOUR-USERNAME): + + ``` + git remote add myfork https://github.com/YOUR-USERNAME/r-svn.git + ``` + +- Create a feature branch based on `devel`: + + ``` + git checkout -b feature/12345-arithmetic-fix + ``` + +- Push your branch to your fork: + + ``` + git push myfork feature/12345-arithmetic-fix + ``` + +- Create a pull request on GitHub to propose your changes to the +official repository: + + ``` + https://github.com/YOUR-USERNAME/r-svn/pull/new/feature/12345-arithmetic-fix + ``` + + +#### 5. Submit Your Patch to R’s Bugzilla + +- Use `git-r` to generate an SVN-compatible patch file for Bugzilla submission: + + ``` + git r svn-diff > ../patches/12345-arithmetic-fix.diff + ``` + +- Upload this patch file to [R’s Bugzilla](https://bugs.r-project.org/) under + the corresponding bug report. + diff --git a/mkdocs.yml b/mkdocs.yml index 019d5051..8b7dd92f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -24,6 +24,7 @@ nav: - 'Creating a Patch File' : 'tutorials/patch_update.md' - 'Multiple R Versions' : 'tutorials/multi_r_compilation.md' - 'SVN Help' : 'tutorials/svn_help.md' + - 'Alternate Workflow using git-r' : 'tutorials/git_r_workflow.md' - 'Contributor Guide' : - 'contributor_guide/contributing_to_docs.md' - 'contributor_guide/contributing_to_codebase.md' From 732b6ff5e1bb4a7d2933029fd8f84b92596436fc Mon Sep 17 00:00:00 2001 From: avinab-neogy Date: Thu, 28 Aug 2025 02:01:20 +0530 Subject: [PATCH 3/5] fixed linter issues --- docs/tutorials/git_r_workflow.md | 43 +++++++++++++------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/docs/tutorials/git_r_workflow.md b/docs/tutorials/git_r_workflow.md index 1fbd1e04..a84fe873 100644 --- a/docs/tutorials/git_r_workflow.md +++ b/docs/tutorials/git_r_workflow.md @@ -1,43 +1,39 @@ -# Alternate git-r workflow for R Development - -This guide briefly covers using **git-r** inside the +This guide briefly covers using **git-r** inside the r-dev-env container to develop, build, and push changes to R source. - #### 1. Update Your Local Source - Open a terminal in the container. - Clone the R SVN mirror repository if you haven’t already: - ``` + ```bash git clone https://github.com/r-devel/r-svn.git /workspaces/r-dev-env/r-source ``` - Navigate to your cloned R SVN mirror repository: - ``` + ```bash cd /workspaces/r-dev-env/r-source ``` - Fetch the latest commits: - ``` + ```bash git fetch origin ``` - Synchronize the internal SVN metadata used by R’s build system: - ``` + ```bash git r svn-revision ``` - #### 2. Build R from Source - Use `git-r` commands to configure, build, and install R: - ``` + ```bash git r configure --enable-R-shlib --enable-memory-profiling --without-recommended-packages git r build git r install @@ -45,65 +41,62 @@ to R source. - To include recommended packages: - ``` + ```bash git r pull-recommended git r build-recommended ``` - #### 3. Make Your Code Changes - Make edits or additions within the source tree (`src/`, `R/`, etc.). For example: - ``` + ```bash echo "// Fix for bug 12345" >> src/main/arithmetic.c ``` - Commit your changes locally to track them with Git: - ``` + ```bash git add src/main/arithmetic.c git commit -m "Fix arithmetic bug (12345)" ``` - #### 4. Push Your Changes to Your Fork of r-svn - Add your personal fork as a remote (replace YOUR-USERNAME): - ``` + ```bash git remote add myfork https://github.com/YOUR-USERNAME/r-svn.git ``` -- Create a feature branch based on `devel`: +- Create a feature branch based on `main`, the branch name used here is for reference: - ``` + ```bash git checkout -b feature/12345-arithmetic-fix ``` - Push your branch to your fork: - ``` + ```bash git push myfork feature/12345-arithmetic-fix ``` -- Create a pull request on GitHub to propose your changes to the -official repository: +- Create a pull request on GitHub to propose your changes to the +official repository. You can initiate the PR by visiting the URL +below (replace YOUR-USERNAME and branch name accordingly): - ``` + ```bash https://github.com/YOUR-USERNAME/r-svn/pull/new/feature/12345-arithmetic-fix ``` - #### 5. Submit Your Patch to R’s Bugzilla - Use `git-r` to generate an SVN-compatible patch file for Bugzilla submission: - ``` + ```bash git r svn-diff > ../patches/12345-arithmetic-fix.diff ``` - Upload this patch file to [R’s Bugzilla](https://bugs.r-project.org/) under the corresponding bug report. - From 1f9079d56be8d6b65c8b906ab9283dbd9e307614 Mon Sep 17 00:00:00 2001 From: avinab-neogy Date: Sat, 30 Aug 2025 12:23:39 +0530 Subject: [PATCH 4/5] removed the documentation moving it to a separate pr --- docs/tutorials/git_r_workflow.md | 102 ------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 docs/tutorials/git_r_workflow.md diff --git a/docs/tutorials/git_r_workflow.md b/docs/tutorials/git_r_workflow.md deleted file mode 100644 index a84fe873..00000000 --- a/docs/tutorials/git_r_workflow.md +++ /dev/null @@ -1,102 +0,0 @@ -This guide briefly covers using **git-r** inside the -r-dev-env container to develop, build, and push changes -to R source. - -#### 1. Update Your Local Source - -- Open a terminal in the container. -- Clone the R SVN mirror repository if you haven’t already: - - ```bash - git clone https://github.com/r-devel/r-svn.git /workspaces/r-dev-env/r-source - ``` - -- Navigate to your cloned R SVN mirror repository: - - ```bash - cd /workspaces/r-dev-env/r-source - ``` - -- Fetch the latest commits: - - ```bash - git fetch origin - ``` - -- Synchronize the internal SVN metadata used by R’s build system: - - ```bash - git r svn-revision - ``` - -#### 2. Build R from Source - -- Use `git-r` commands to configure, build, and install R: - - ```bash - git r configure --enable-R-shlib --enable-memory-profiling --without-recommended-packages - git r build - git r install - ``` - -- To include recommended packages: - - ```bash - git r pull-recommended - git r build-recommended - ``` - -#### 3. Make Your Code Changes - -- Make edits or additions within the source tree (`src/`, `R/`, etc.). - For example: - - ```bash - echo "// Fix for bug 12345" >> src/main/arithmetic.c - ``` - -- Commit your changes locally to track them with Git: - - ```bash - git add src/main/arithmetic.c - git commit -m "Fix arithmetic bug (12345)" - ``` - -#### 4. Push Your Changes to Your Fork of r-svn - -- Add your personal fork as a remote (replace YOUR-USERNAME): - - ```bash - git remote add myfork https://github.com/YOUR-USERNAME/r-svn.git - ``` - -- Create a feature branch based on `main`, the branch name used here is for reference: - - ```bash - git checkout -b feature/12345-arithmetic-fix - ``` - -- Push your branch to your fork: - - ```bash - git push myfork feature/12345-arithmetic-fix - ``` - -- Create a pull request on GitHub to propose your changes to the -official repository. You can initiate the PR by visiting the URL -below (replace YOUR-USERNAME and branch name accordingly): - - ```bash - https://github.com/YOUR-USERNAME/r-svn/pull/new/feature/12345-arithmetic-fix - ``` - -#### 5. Submit Your Patch to R’s Bugzilla - -- Use `git-r` to generate an SVN-compatible patch file for Bugzilla submission: - - ```bash - git r svn-diff > ../patches/12345-arithmetic-fix.diff - ``` - -- Upload this patch file to [R’s Bugzilla](https://bugs.r-project.org/) under - the corresponding bug report. From 00aec78465b80f28a322fc2b8caa52fb76a92cb6 Mon Sep 17 00:00:00 2001 From: avinab-neogy Date: Sat, 30 Aug 2025 12:25:09 +0530 Subject: [PATCH 5/5] updated mkdocs --- mkdocs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 8b7dd92f..019d5051 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -24,7 +24,6 @@ nav: - 'Creating a Patch File' : 'tutorials/patch_update.md' - 'Multiple R Versions' : 'tutorials/multi_r_compilation.md' - 'SVN Help' : 'tutorials/svn_help.md' - - 'Alternate Workflow using git-r' : 'tutorials/git_r_workflow.md' - 'Contributor Guide' : - 'contributor_guide/contributing_to_docs.md' - 'contributor_guide/contributing_to_codebase.md'