R2PKG(8)

NAME
R2pkg - create a pkgsrc package for an R package

SYNOPSIS
R2pkg [-cDehqruVv] [-E editor] [-M maintainer_email] [package]

DESCRIPTION
R2pkg creates or updates a pkgsrc(7) package for the corresponding R package. The pkgsrc(7) package will be created in the current directory, which by convention should be named R-package. If the user does not supply the package on the command line, then R2pkg will use the basename of the current directory as the name of the R package after stripping the leading R-.

R2pkg tries to make as complete a pkgsrc(7) package as possible, and in the case of updating tries to maintain as much of the original as possible. Nevertheless, the files should be reviewed and perhaps adjusted manually after R2pkg has finished its job. To help with this, the original versions of files created by R2pkg are preserved for reference, but should be removed before commiting the pkgsrc(7) package.

R2pkg is intended to help the process of creating or updating a package but is not intended to fly on autopilot.

The DESCR file is populated with information from the package's DESCRIPTION file on CRAN, which is automatically fetched by R2pkg. Likewise, the Makefile contains all of the variables required for an R package, with information being taken from the same DESCRIPTION file. In the case of updating, a file (DESCR.new) containing the new description is created, and as much as possible of the original Makefile is retained. After DESCR and Makefile are completed, R2pkg fetches the distfile and computes its checksum via the makesum and makepatchsum targets. Finally, a buildlink3.mk file may be created if necessary.

The following options are available:

-c  Create the pkgsrc(7) package ( and any dependencies if the -r option is given). This is the default if neither -c nor -u is given.

-D  Write the package's description into DESCRIPTION. This may be useful for verifying the information obtained from CRAN. However, this file must be removed as it is not part of a pkgsrc(7) package.

-E editor
    Use editor instead of the user's default editor.

-e  Do not present the Makefile and DESCR files for editing.

-h  Produce a short help message.

-M maintainer_email
    Set the maintainer email address for any newly created packages. By default, the email address will be <pkgsrc-users@NetBSD.org>.

-q  Do not produce status messages along the way.

-r  Process dependency packages recursively. Dependency packages that do not exist will be created in the pkgsrc/wip directory, and processed by R2pkg recursively. Dependency packages that do exist will only be processed when updating. A depends file is created that lists the dependencies in tsort(1) order, which is likely the best for testing the resulting dependency packages. In particular, a useful strategy for creating ( or updating with the -u option) packages recursively is to (i) run R2pkg with the -r option, (ii) move any newly created packages from pkgsrc/wip into appropriate categories, (iii) fix each package as needed, and (iv) rerun R2pkg with both the -r and -u options. The second (and subsequent) run(s) will correct each package's Makefile with the correct category information and the correct dependency directories.

-u  Update the pkgsrc(7) package ( and any dependencies if the -r option is given). This has no effect if a package (including a dependency) is being newly created.

-V  Print the version.

-v  Generate verbose output. This may be repeated to increase the verbosity.

ENVIRONMENT
The following environment variables affect the execution of R2pkg:

PKGEDITOR, EDITOR
    Editor used for editing Makefile and DESCR.

CRAN_URL
    The URL to the CRAN mirror for downloading the package's DESCRIPTION file. By default, ftp://cran.r-project.org.

EXAMPLES
Use the following commands to create a pkgsrc(7) package for the R package foo:
    cd pkgsrc/category
    mkdir R-foo
    cd R-foo
    R2pkg -c foo
Adding -r to the command line will also recursively create all necessary dependencies in the pkgsrc/wip directory if they do not already exist.

Use the following commands to update a pkgsrc(7) package (and dependencies) for the R package foo:
    cd pkgsrc/category/R-foo
    R2pkg -u -r
Packages created for any new dependencies will be added to the pkgsrc/wip directory.

Remember to test the resulting package(s) and remove any extra files created by R2pkg. If new packages are created in the pkgsrc/wip directory, they should be moved to appropriate categories and R2pkg should be rerun to update categories and paths.

SEE ALSO
pkgsrc(7)

AUTHORS
R2pkg was written by Brook Milligan <brook@NetBSD.org>.

BUGS
R2pkg does not create a finished package; instead, it facilitates the task. However, the resulting files must be reviewed and possibly edited by hand. Packages created recursively for dependencies are placed in the pkgsrc/wip directory; they must be moved to appropriate category directories within pkgsrc(7) and checked for correctness. Therefore, although dependencies are included in the generated Makefile, they will have incorrect category information unless moved to an appopriate category and R2pkg rerun.