Hi,

Eugene Kirpichov <[email protected]> writes:

> I'd like my program to print something like "this is $program 1.0.4 git
> 45fea6b" when invoked with --version, or at least just the 1.0.4 part.

Here's some proof-of-concept code we use slightly modified in production
here for over a year now successfully:

 https://gist.github.com/656738

The primary goal was to have a reliable version number (allowing to find
the exact corresponding git-commit in the source-code repository), and
to be able to detect when that version number is unreliable (there's
nothing more annoying than wasting time debugging the wrong
source-code...).

The idea is to dynamically infer and overwrite cabal's version when
building from the git repository, and have it accessible via the cabal's
auto-generated "Paths_<pkg-name>" module Data.Version...

...and when creating a source-dist, via "runghc Setup.hs sdist" the
current dynamic git-version string is embedded into the generated
.tar.gz's .cabal file, so that the source-distribution is just a plain
simple .cabal project (that could be uploaded to hackage)

hth,
hvr
-- 

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to