Dependencies external to the R system should be listed in the ‘SystemRequirements’ field, possibly amplified in a separate README file. [from the Writing R Extensions manual]
The SystemRequirements field in the DESCRIPTION file effectively is a free text field, and therefore it is not (cannot be) properly checked nor enforced. As a result, this is the major source of pain for building and distributing R packages.
Proposal
CRAN could provide a publicly accessible database (much like tools::CRAN_package_db) of allowed system dependencies, with at least a standardized identifier, a description, and possibly system package names for major Linux distributions (as used by CRAN machines). See e.g. this.
Then, the SystemRequirements field could be standardized as a comma-separated list of the identifiers above, with optional version specification, as in Depends, Imports and so on.
R CMD check should check for the correctness of this field.
CRAN checks should run in isolated environments (e.g. via docker) just with the specified system requirements. In this way, checks would just fail if there are undeclared dependencies.
Alternatively (and preferably), the SystemRequirements field could be left as a free text field to inform the user about optional run-time complex requirements and nice-to-have additional features and software, and the following new fields could be created to accommodate the standardized system dependencies described above:
SystemLinkingTo: A set of build-time system dependencies.
SystemDepends: A set of run-time system dependencies.
SystemSuggests: A set of optional run-time system dependencies.
That is, much like LinkingTo, Depends and Suggests, but for system dependencies. In this way, it would be trivial to query what's required, making the life of everyone (users, sysadmins, downstream packagers...) much easier.
Background
The
SystemRequirements
field in the DESCRIPTION file effectively is a free text field, and therefore it is not (cannot be) properly checked nor enforced. As a result, this is the major source of pain for building and distributing R packages.Proposal
CRAN could provide a publicly accessible database (much like
tools::CRAN_package_db
) of allowed system dependencies, with at least a standardized identifier, a description, and possibly system package names for major Linux distributions (as used by CRAN machines). See e.g. this.SystemRequirements
field could be standardized as a comma-separated list of the identifiers above, with optional version specification, as inDepends
,Imports
and so on.R CMD check
should check for the correctness of this field.Alternatively (and preferably), the
SystemRequirements
field could be left as a free text field to inform the user about optional run-time complex requirements and nice-to-have additional features and software, and the following new fields could be created to accommodate the standardized system dependencies described above:SystemLinkingTo
: A set of build-time system dependencies.SystemDepends
: A set of run-time system dependencies.SystemSuggests
: A set of optional run-time system dependencies.That is, much like
LinkingTo
,Depends
andSuggests
, but for system dependencies. In this way, it would be trivial to query what's required, making the life of everyone (users, sysadmins, downstream packagers...) much easier.