hydra-prelude
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Version

Description

Provides version numbers from calling git on build time or from an embedded string.

The former is based on the gitrev package with a Maybe interface around it, while the embedding is done using a special c-array placeholder in cbits/revision.c

NOTE: gitrev does not register the git state as a compile-time dependency, so the two values below go stale until hydra-prelude happens to be recompiled. That is the trade we want. hydra-prelude is the root of the dependency tree, and a package that does register it (githash registers .git/HEAD, .git/index and .git/packed-refs) rebuilds every package downstream of it after a plain git add. Only dev builds are affected: released binaries carry their revision in the 'cbits/revision.c' placeholder, patched by nix (see nixhydrapackages.nix), and embeddedRevision is preferred over gitRevision at every call site.

Synopsis

Documentation

unknownVersion :: String Source #

Identifier to be used when no revision can be found.

This is also the default used in gitrev.

gitDescribe :: Maybe String Source #

Determine the version on build time using `git describe`.

gitRevision :: Maybe String Source #

Determine the version on build time using `git rev-parse`.

embeddedRevision :: Maybe String Source #

The git revision embedded at a special place holder in the object/binary.

NOTE: placeholder has to agree with the array in 'cbits/revision.c' and with the string nix substitutes for it (see nixhydrapackages.nix). It drifted from both in ab2362a29, which made every unpatched build report the placeholder itself as its revision and left gitRevision unreachable, since both call sites prefer this one. NetworkVersionsSpec guards against that happening again.