Skip to content

Commit generated NAMESPACE and man/ so rFVS can be installed with remotes::install_github() #37

Description

@d-diaz

Summary

rFVS cannot be installed from GitHub the usual way:

remotes::install_github("USDAForestService/ForestVegetationSimulator-Interface", subdir = "rFVS")

This fails because the package has no NAMESPACE file. .gitignore excludes it, along with the generated help pages:

fvsOL/NAMESPACE
rFVS/NAMESPACE
fvsOL/man/*
rFVS/man/*

R has required a NAMESPACE since R 3.0.0, and remotes::install_github() runs R CMD build before R CMD INSTALL, so the install stops before it starts.

Why it matters

There are currently no installation instructions for rFVS or fvsOL in this repo.

Users who want to install rFVS are forced through a workaround such as: clone the repo, install devtools and roxygen2, run devtools::document() to regenerate what the repo already knows how to generate, and then install the package.

Concretely, that is what I've been doing in a Docker container as part of a build for the FVS GUI:

RUN Rscript -e 'install.packages(c("devtools", "roxygen2"))' \
 && git clone --depth 1 https://github.com/USDAForestService/ForestVegetationSimulator-Interface /tmp/interface \
 && Rscript -e 'devtools::document("/tmp/interface/rFVS"); \
                devtools::install("/tmp/interface/rFVS", dependencies = FALSE, upgrade = FALSE)'

That could be replaced with a single line. It also means the installed package depends on whichever roxygen2 version I happen to be using, rather than on a NAMESPACE rFVS and fvsOL maintainers reviewed.

rFVS is otherwise incredibly easy to depend on -- Depends: R (>= 4.0.0) and nothing else -- which makes the packaging friction the single obstacle to using it as a plain R dependency.

Suggested fix

Commit the generated roxygen output. This is standard practice for R packages distributed via GitHub and it is what install_github() assumes.

  1. Remove these four lines from .gitignore:

    fvsOL/NAMESPACE
    rFVS/NAMESPACE
    fvsOL/man/*
    rFVS/man/*
    
  2. Run the existing rFVS/makefile target (or devtools::document("rFVS")) and commit the resulting rFVS/NAMESPACE and rFVS/man/. All 23 files in rFVS/R/ already carry @export, so the generated NAMESPACE is complete -- nothing needs to be hand-written.

  3. Do the same for fvsOL to allow it to be installable in the same way.

If regenerating by hand at release time is a concern, a GitHub Action running roxygen2::roxygenise() and committing the result on push keeps the files current without adding a manual step.

Smaller things, if you are touching the packaging anyway

  • rFVS/tests/ holds iet01.key and iet01.tre. These mirror the engine repo's fixture tests/FVSie/iet01.{key,tre} -- one of the <variant>t01 cases it keeps per variant -- with the tree records reordered and the key file's DataBase/DSNOut output block removed, which makes sense for a run driven through the rFVS API. Unlike the engine's copies, though, these have no .save expected-output file, no driver script and no makefile target, and nothing referencing them anywhere in this repo. I cannot tell whether they are meant as a regression fixture or as example input. Either way the packaging consequence is the same: tests/ is not installed, so they are dropped at install time and a user cannot reach them via system.file(), while R CMD check finds nothing in tests/ to run. If they are meant as a regression check, a small tests/*.R driver plus an expected-output file would let R CMD check run it on every build; if they are meant as example input, inst/extdata/ would ship them with the installed package and let the man/ examples point at them.
  • rFVS/makefile and rFVS/rFVSmadeTag would be included in a built tarball; a two-line .Rbuildignore would exclude them.

Verification

With the proposed change, this should succeed on a clean machine:

remotes::install_github("USDAForestService/ForestVegetationSimulator-Interface", subdir = "rFVS")
library(rFVS)
fvsLoad("FVSpn", bin = "/path/to/FVSbin")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions