packageVersion("drmTMB") identifies a release, not a build: two builds
can report the same version string while differing by commits under
R/, src/, or NAMESPACE. drm_provenance() returns a stable,
machine-readable record that identifies the BUILD instead.
Value
A list with components:
- package_version
Character,
packageVersion("drmTMB").- git_sha
Character SHA-1 baked at build time, or
NA_character_.- git_dirty
Logical: was the source tree dirty at build time?
NAif unknown.- build_time
Character ISO-8601 UTC timestamp of the bake, or
NA_character_.- source
Character:
"baked","baked-without-git", or"unavailable".- reason
Character explanation when
source != "baked", elseNA_character_.- queried_at
Character ISO-8601 UTC timestamp of this call.
Details
An installed package has no .git directory to consult, so the git
commit SHA and working-tree dirty flag are never read at call time.
Instead they are captured once, at build time, by
tools/drmtmb_provenance.R (invoked from configure/configure.win
before inst/ is copied into the installed package) and baked into
inst/build-provenance.dcf. drm_provenance() only reads that baked
file. When it is missing – for example under devtools::load_all(), or
a build whose configure step did not run – the git fields are NA
with source = "unavailable" and a stated reason, rather than a guess.
When configure ran but git information itself was unavailable at build
time (no git executable, or the tree was not a git checkout, as happens
when installing from a released tarball with .git excluded via
.Rbuildignore), source is "baked-without-git".
Examples
drm_provenance()
#> $package_version
#> [1] "0.7.1"
#>
#> $git_sha
#> [1] NA
#>
#> $git_dirty
#> [1] NA
#>
#> $build_time
#> [1] "2026-09-15T15:34:59Z"
#>
#> $source
#> [1] "baked-without-git"
#>
#> $reason
#> [1] "no .git directory found (not a git checkout, e.g. installed from a released tarball)"
#>
#> $queried_at
#> [1] "2026-09-15T15:38:58Z"
#>