Improve version strings.

Have the abbreviated git hash appear in the version string when not
using a released version of pgloader.
This commit is contained in:
Dimitri Fontaine 2014-05-03 15:21:32 +02:00
parent fecae2c2d9
commit f34017d023
2 changed files with 37 additions and 1 deletions

View File

@ -30,6 +30,25 @@ The versioning is now following the Emacs model, where any X.0 release
number means you're using a development version (alpha, beta, or release
candidate). The next stable versions are going to be `3.1` then `3.2` etc.
When using a development snapshot rather than a released version the version
number includes the git hash (in its abbreviated form):
- `pgloader version "3.0.99"`
Release candidate 9 for pgloader version 3.1, with a *git tag* named
`v3.0.99` so that it's easy to checkout the same sources as the
released code.
- `pgloader version "3.0.fecae2c"`
Development snapshot again *git hash* `fecae2c`. It's possible to have
the same sources on another setup with using the git command `git
checkout fecae2c`.
- `pgloader version "3.1.0"`
Stable release.
## INSTALL
pgloader is now a Common Lisp program, tested using the

View File

@ -32,7 +32,24 @@
(in-package :pgloader.params)
(defparameter *version-string* "3.0.99"
(defparameter *release* nil
"non-nil when this build is a release build.")
(defparameter *major-version* "3.0")
(defparameter *minor-version* "99")
(defun git-hash ()
"Return the current abbreviated git hash of the development tree."
(let ((git-hash `("git" "--no-pager" "log" "-n1" "--format=format:%h")))
(uiop:with-current-directory ((asdf:system-source-directory :pgloader))
(multiple-value-bind (stdout stderr code)
(uiop:run-program git-hash :output :string)
(declare (ignore code stderr))
stdout))))
(defparameter *version-string*
(concatenate 'string *major-version* "."
(if *release* *minor-version* (git-hash)))
"pgloader version strings, following Emacs versionning model.")
;; we can't use pgloader.utils:make-pgstate yet because params is compiled