Record commit at package installation #3390
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
build_hash
column to thepecan_version()
output, reporting for each package the commit it was installed from and whether there were any uncommitted changes at install time.pecan_version()
output now has class "pecan_version_report", and a custom print method that summarizes versions and installation sources more compactly.build_hash
, set at build time to the value of environment variable PECAN_GIT_REV (or to "unknown" if that is not set).make install
now exports PECAN_GIT_REV to each package build, including adding+mod
to the commit hash for packages installed with uncommitted changes in the working tree.pecan_version()
looks the commit up from one of two places:RemoteSha:
field, we use that. This is true for packages installed from github usingdevtools
orremotes
orpak
, or from R-universe using any method..build_hash
from inside the package namespace. This is set for packages installed locally withmake install
.devtools::install("base/utils")
,.build_hash
will be used but will be set to"unknown"
unless you manually setPECAN_GIT_REV
to match the current commit before starting the build process.Motivation and Context
Output from the existing version:
Output with these changes:
Information visible here:
devtools::install
without exporting PECAN_GIT_REV first, but this output can't distinguish between that and other manual build methods). If I had usedmake install
, the hash and source path would have been recorded here.RemoteSha
field that R-Universe adds to DESCRIPTION at build time.The truncation of source (
local (/Users/chr...
)and the concatenation ofversion
andbuild hash
into one string are only done during printing.To see their full values, extract the column or coerce the output to a dataframe:
Review Time Estimate
Types of changes
Checklist: