.\" $NetBSD: R2pkg.8,v 1.6 2019/08/01 13:11:08 brook Exp $ .\" .\" Copyright (c) 2014,2015,2016,2017,2018,2019 .\" Brook Milligan. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the author nor the names of any contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" .Dd February 23, 2017 .Dt R2PKG 8 .Os .Sh NAME .Nm R2pkg .Nd create a pkgsrc package for an R package .Sh SYNOPSIS .Nm .Op Fl cDehqruVv .Op Fl E Ar editor .Op Fl M Ar maintainer_email .Op Ar package .Sh DESCRIPTION .Nm creates or updates a .Xr pkgsrc 7 package for the corresponding R .Ar package . The .Xr pkgsrc 7 package will be created in the current directory, which by convention should be named .Pa R-package . If the user does not supply the .Ar package on the command line, then .Nm will use the basename of the current directory as the name of the R package after stripping the leading .Pa R- . .Pp .Nm tries to make as complete a .Xr 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 .Nm has finished its job. To help with this, the original versions of files created by .Nm are preserved for reference, but should be removed before commiting the .Xr pkgsrc 7 package. .Pp .Nm is intended to help the process of creating or updating a package but is not intended to fly on autopilot. .Pp The .Pa DESCR file is populated with information from the package's .Pa DESCRIPTION file on CRAN, which is automatically fetched by .Nm . Likewise, the .Pa Makefile contains all of the variables required for an R package, with information being taken from the same .Pa DESCRIPTION file. In the case of updating, a file .Pq Pa DESCR.new containing the new description is created, and as much as possible of the original .Pa Makefile is retained. After .Pa DESCR and .Pa Makefile are completed, .Nm fetches the distfile and computes its checksum via the .Ic makesum and .Ic makepatchsum targets. Finally, a .Pa buildlink3.mk file may be created if necessary. .Pp The following options are available: .Bl -tag -width indent .It Fl c Create the .Xr pkgsrc 7 package .Po and any dependencies if the .Fl r option is given .Pc . This is the default if neither .Fl c nor .Fl u is given. .It Fl D Write the package's description into .Pa 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 .Xr pkgsrc 7 package. .It Fl E Ar editor Use .Ar editor instead of the user's default editor. .It Fl e Do not present the .Pa Makefile and .Pa DESCR files for editing. .It Fl h Produce a short help message. .It Fl M Ar maintainer_email Set the maintainer email address for any newly created packages. By default, the email address will be .Aq pkgsrc-users@NetBSD.org . .It Fl q Do not produce status messages along the way. .It Fl r Process dependency packages recursively. Dependency packages that do not exist will be created in the .Pa pkgsrc/wip directory, and processed by .Nm recursively. Dependency packages that do exist will only be processed when updating. A .Pa depends file is created that lists the dependencies in .Xr tsort 1 order, which is likely the best for testing the resulting dependency packages. In particular, a useful strategy for creating .Po or updating with the .Fl u option .Pc packages recursively is to (i) run .Nm with the .Fl r option, (ii) move any newly created packages from .Pa pkgsrc/wip into appropriate categories, (iii) fix each package as needed, and (iv) rerun .Nm with both the .Fl r and .Fl u options. The second .Pq and subsequent run(s) will correct each package's .Pa Makefile with the correct category information and the correct dependency directories. .It Fl u Update the .Xr pkgsrc 7 package .Po and any dependencies if the .Fl r option is given .Pc . This has no effect if a package .Pq including a dependency is being newly created. .It Fl V Print the version. .It Fl v Generate verbose output. This may be repeated to increase the verbosity. .El .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : .Bl -tag -width BLOCKSIZE .It Ev PKGEDITOR , EDITOR Editor used for editing .Pa Makefile and .Pa DESCR . .It Ev CRAN_URL The URL to the CRAN mirror for downloading the package's DESCRIPTION file. By default, .Pa ftp://cran.r-project.org . .El .Sh EXAMPLES Use the following commands to create a .Xr pkgsrc 7 package for the R package .Ar foo : .Dl cd pkgsrc/category .Dl mkdir R-foo .Dl cd R-foo .Dl R2pkg -c foo Adding .Fl r to the command line will also recursively create all necessary dependencies in the .Pa pkgsrc/wip directory if they do not already exist. .Pp Use the following commands to update a .Xr pkgsrc 7 package (and dependencies) for the R package .Ar foo : .Dl cd pkgsrc/category/R-foo .Dl R2pkg -u -r Packages created for any new dependencies will be added to the .Pa pkgsrc/wip directory. .Pp Remember to test the resulting package(s) and remove any extra files created by .Nm . If new packages are created in the .Pa pkgsrc/wip directory, they should be moved to appropriate categories and .Nm should be rerun to update categories and paths. .Sh SEE ALSO .Xr pkgsrc 7 .Sh AUTHORS .Nm was written by .An Brook Milligan Aq Mt brook@NetBSD.org . .Sh BUGS .Nm 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 .Pa pkgsrc/wip directory; they must be moved to appropriate category directories within .Xr pkgsrc 7 and checked for correctness. Therefore, although dependencies are included in the generated .Pa Makefile , they will have incorrect category information unless moved to an appopriate category and .Nm rerun.