-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record commit at package installation #3390
Record commit at package installation #3390
Conversation
Probably not a big difference, but felt to me like it make the Make output a little easier to interpret
- use args provided at print time - default to no rownames and left alignment - truncate more
Preserving some discussion from Slack: @mdietze asked: "[I] was wondering what the motivation was for these changes? How do you envision this information being used? Why do we need this?" My answer: It’s for debugging issues encountered while running the development version — on systems that only update at point releases, The motivation comes from me using these routinely in my non-PEcAn workflows: Often I need to debug (or otherwise reason about) a package I installed from GitHub, so I type (The reason I can read off the commit for packages installed from GitHub is that |
It would be conceptually better to record it at build time, but R code is not parsed at that stage. If we really want build-time recording, could consider saving it as data (data/*.R are run at build time)
@@ -0,0 +1,3 @@ | |||
# Set at package install time, used by pecan.all::pecan_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conceptually it would be preferable to set this at build time, so that someone could download a prebuilt package binary and still have it provide this information, but the getenv is not evaluated until the package is byte-compiled (which happens during installation).
(Scripts in data/
are evaluated at build rather than install, so I considered treating this information as an exported "dataset" rather than an internal variable. I decided against it because that would mean the hash was exported and hence visible to confuse users, but I'd be open to revisiting the idea if other folks think it'd be useful)
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 atbuildinstall 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: