patch: version_stamp.pl: Add Git commit info to version if 'git' is specified - Mailing list pgsql-hackers

From Øyvind A. Holm
Subject patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Date
Msg-id 20150828031449.GA31824@debian
Whole thread Raw
Responses Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified
List pgsql-hackers
Hi,
this is a patch for src/tools/version_stamp.pl that adds the current Git
commit information from "git describe --tags --long" to the current
version string if "git" is specified on the command line. I've been
testing for regressions and such lately (none found, yay), and the
current output from for example "psql --version" only shows "psql
(PostgreSQL) 9.6devel" without any reference to which commit it was
compiled from.

The following is an example from current master when I compile it
locally:

  $ src/tools/version_stamp.pl git
  Stamped these files with version number 9.6devel+REL9_5_ALPHA1-331-g119cf76:
          configure.in
          doc/bug.template
          src/include/pg_config.h.win32
          src/interfaces/libpq/libpq.rc.in
          src/port/win32ver.rc
  Don't forget to run autoconf 2.69 before committing.
  $ autoconf
  $ ./configure
  [snip]
  $ make
  [snip]
  $ src/bin/psql/psql --version
  psql (PostgreSQL) 9.6devel+REL9_5_ALPHA1-331-g119cf76

The format I suggest for this is "[version]+[git_info]", as recommended
by the Semantic Version Specification (http://semver.org).

This format is not meant for public releases, of course, but I've found
it very useful when compiling local versions and I quickly want to see
which commit I have compiled from. The version string can also be used
together with git(1). For example, right now I have an ancient version
of REL9_5_STABLE from yesterday installed. To see if there are any new
commits I should check out, I can just use copy+paste to see what's
happened since then:

  $ git log --format=oneline 9.5alpha2+REL9_5_ALPHA2-82-gce56a64..
  440fc48cac7f450bb71d1f06f0d1326c63e3e42f dblink docs:  fix typo to use "connname" (3 n's), not "conname"

The patch applies cleanly with -p1 to all REL9_*_STABLE branches and
master except REL9_0_STABLE and REL9_1_STABLE (due to perltidy in
2bc09ff three years ago) and has been tested with all minor version
variatons that version_stamp.pl accepts.

In case something fishy happens to the mail, the commit is also
available from <https://github.com/sunny256/postgres/> in these
branches:

  git-versioning - squashed commit with suggested log message
  git-versioning.wip - the branch I worked on

Online patch:

  <https://github.com/sunny256/postgres/commit/0a6b8728f8105d05fd5b13c4b7ae80a44ff57576.patch>

Regards,
Øyvind

+-| Øyvind A. Holm <sunny@sunbase.org> - N 60.37604° E 5.33339° |-+
| OpenPGP: 0xFB0CBEE894A506E5 - http://www.sunbase.org/pubkey.asc |
| Fingerprint: A006 05D6 E676 B319 55E2  E77E FB0C BEE8 94A5 06E5 |
+------------| 681035c8-4d32-11e5-ab81-fefdb24f8e10 |-------------+

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_extension_config_dump() doesn't register owned sequences
Next
From: Michael Paquier
Date:
Subject: Re: patch: version_stamp.pl: Add Git commit info to version if 'git' is specified