Re: Adding optionally commit number in PG_VERSION_STR

From: "Erik Rijkers" <er(at)xs4all(dot)nl>
To: "Michael Paquier" <michael(dot)paquier(at)gmail(dot)com>
Cc: "PostgreSQL mailing lists" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding optionally commit number in PG_VERSION_STR
Date: 2013-07-17 06:43:23
Message-ID: c51433da5e804767724d60eea57f4178.squirrel@webmail.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, July 17, 2013 05:27, Tom Lane wrote:
> Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
>> It happens that I work occasionally on multiple builds based on

FWIW, I've been doing this for while:

where $project is mostly the patchname, $commit_hash is extracted like this:

commit_hash=$( cd /home/aardvark/pg_stuff/git/master; git log | head -n 1 | cut --delimiter=" " -f 2 );

version_string=${project}-${db_timestamp}-${commit_hash};

perl -i.original -ne "
s,(PACKAGE_.*[[:digit:]]+\.[[:digit:]]+(?:\.[[:digit:]]+)?(?:devel)?(?:(?:alpha|beta|rc)[[:digit:]]+)?),\\1-${version_string},;
print;" configure

Which will then give:

PostgreSQL 9.4devel-HEAD-20130717_0828-ffcf654547ef38555203e6d716f47b7065a0a87d on x86_64-unknown-linux-gnu, compiled by
gcc (GCC) 4.8.1, 64-bit

Btw, in an even more ugly hack I also stick some of that same config data in information_schema.sql_packages, with a
feature_id >= 100:

select * from information_schema.sql_packages where cast(substring(feature_id from E'^PKG([[:digit:]]+)') as integer) >= 100
feature_id | feature_name | is_supported | is_verified_by | comments
------------+--------------------+--------------+----------------+----------------------------------------------------------------------
PKG100 | project name | YES | ej | HEAD
PKG101 | patched | NO | ej | NO
PKG103 | build time | YES | ej | 2013-07-17 08:32:03.400521+02
PKG104 | server_version | YES | ej |
9.4devel-HEAD-20130717_0828-ffcf654547ef38555203e6d716f47b7065a0a87d
PKG105 | server_version_num | YES | ej | 90400
PKG106 | port | YES | ej | 6544
PKG110 | commit hash | YES | ej | ffcf654547ef38555203e6d716f47b7065a0a87d
PKG111 | catversion | YES | ej | 201307161
PKG112 | control version | YES | ej | 937
(9 rows)

Needless to say, YMMV ...

Thanks,

Erik Rijkers

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2013-07-17 07:49:51 Re: [HACKERS] Cube extension point support // GSoC'13
Previous Message Tatsuo Ishii 2013-07-17 06:31:35 Re: [PATCH] pgbench --throttle (submission 7 - with lag measurement)