Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demonstrate how to cp source tarballs to add in rspm #283

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ services:
volumes:
- ./package-manager/rstudio-pm.gcfg:/etc/rstudio-pm/rstudio-pm.gcfg
- ./data/rspm:/data

64 changes: 64 additions & 0 deletions package-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,70 @@ docker exec -it {container-id} /bin/bash
Then please refer to the [RSPM guide](https://docs.rstudio.com/rspm/admin/) on how
to [create and manage](https://docs.rstudio.com/rspm/admin/getting-started/configuration/) your repositories.

#### example of adding a local tarball built in rsw to rspm

For this example, a package, `demo1` was created with version 0.1.0 and a
tarball was created using the build pane in rsw. This will write out the
tarball on the host system at `data/rsw/rstudio/demo1_0.1.0.tar.gz`

Copy the tarball into the `/tmp` dir using `docker cp`:

Find the container id for the running package-manager container via `docker ps`:

```bash
❯ docker ps
CONTAINER ID IMAGE ...
b8ae944b7f2d rstudio/rstudio-package-manager:2021.12.0-3 ...
```

```bash
# replace b8ae944b7f2d with your container ID
docker cp data/rsw/rstudio/demo1_0.1.0.tar.gz b8ae944b7f2d:/tmp
```

now you can create the repo in rspm

```bash
root@1b6f4f5fc669:/# rspm create source --name=demopkgs
Source 'demopkgs':
Type: Local
root@1b6f4f5fc669:/# rspm add --source=demopkgs --path='/tmp/demo1_0.1.0.tar.gz'
Added package '/tmp/demo1_0.1.0.tar.gz'.
root@1b6f4f5fc669:/# rspm create repo --name=demopkgs --description="demo package repo"
Repository: demopkgs - demo package repo - R
root@1b6f4f5fc669:/# rspm subscribe --repo=demopkgs --source=demopkgs
Repository: demopkgs
Sources:
--demopkgs (Local)
```

It can then be installed from R on the local machine:

```R
> install.packages("demo1", repos = "http://rstudio-package-manager:4242/demopkgs/latest")
Installing package into ‘/home/rstudio/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'http://rstudio-package-manager:4242/demopkgs/latest/src/contrib/demo1_0.1.0.tar.gz'
Content type 'application/x-gzip' length 859 bytes
==================================================
downloaded 859 bytes

* installing *source* package ‘demo1’ ...
** using staged installation
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (demo1)

The downloaded source packages are in
‘/tmp/RtmpRVTKFG/downloaded_packages’
```

# Licensing

The license associated with the RStudio Docker Products repository is located [in LICENSE.md](https://github.com/rstudio/rstudio-docker-products/blob/main/LICENSE.md).
Expand Down