From 6f7757087a49db5fb3fa4f3b12b8b67ebbbe3aa3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 17 Nov 2008 21:11:43 +0100 Subject: [PATCH] Return SHA1 version for YAZ in yaz_version. --- configure.ac | 6 ++++++ include/yaz/yaz-version.h.in | 4 +++- src/seshigh.c | 9 --------- src/version.c | 6 +++--- src/zget.c | 14 ++++---------- 5 files changed, 16 insertions(+), 23 deletions(-) diff --git a/configure.ac b/configure.ac index 9ed29e0..bee8d0f 100644 --- a/configure.ac +++ b/configure.ac @@ -394,6 +394,12 @@ WIN_FILEVERSION=`echo $PACKAGE_VERSION | awk 'BEGIN { FS = "."; } { m = $4; prin AC_SUBST([WIN_FILEVERSION]) YAZ_VERSION_HEX=`echo $PACKAGE_VERSION | awk 'BEGIN { FS = "."; } { printf("%x", ($1 * 256 + $2) * 256 + $3);}'` AC_SUBST([YAZ_VERSION_HEX]) +if test ${srcdir}/.git; then + VERSION_SHA1=`git show --pretty=format:%H|head -1` +else + VERSION_SHA1=`head -1 ${srcdir}/ChangeLog|awk '{print $2}'` +fi +AC_SUBST([VERSION_SHA1]) dnl dnl ------ Makefiles dnl diff --git a/include/yaz/yaz-version.h.in b/include/yaz/yaz-version.h.in index a56cc0a..e6a6bd0 100644 --- a/include/yaz/yaz-version.h.in +++ b/include/yaz/yaz-version.h.in @@ -37,6 +37,8 @@ #define YAZ_FILEVERSION @WIN_FILEVERSION@ +#define YAZ_VERSION_SHA1 "@VERSION_SHA1@" + #define YAZ_DATE 1 @@ -50,7 +52,7 @@ YAZ_BEGIN_CDECL -YAZ_EXPORT unsigned long yaz_version(char *version_str, char *sys_str); +YAZ_EXPORT unsigned long yaz_version(char *version_str, char *sha1_str); YAZ_END_CDECL diff --git a/src/seshigh.c b/src/seshigh.c index 9c791d1..97c9e04 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2164,7 +2164,6 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) Z_APDU *apdu = zget_APDU(assoc->encode, Z_APDU_initResponse); Z_InitResponse *resp = apdu->u.initResponse; bend_initresult *binitres; - char *version; char options[140]; statserv_options_block *cb = 0; /* by default no control for backend */ @@ -2351,14 +2350,6 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) assoc->init->implementation_name, odr_prepend(assoc->encode, "GFS", resp->implementationName)); - version = odr_strdup(assoc->encode, "$Revision: 1.128 $"); - if (strlen(version) > 10) /* check for unexpanded CVS strings */ - version[strlen(version)-2] = '\0'; - resp->implementationVersion = odr_prepend(assoc->encode, - assoc->init->implementation_version, - odr_prepend(assoc->encode, &version[11], - resp->implementationVersion)); - if (binitres->errcode) { assoc->state = ASSOC_DEAD; diff --git a/src/version.c b/src/version.c index 003c709..c8b0ae1 100644 --- a/src/version.c +++ b/src/version.c @@ -15,12 +15,12 @@ #include #include -unsigned long yaz_version(char *version_str, char *sys_str) +unsigned long yaz_version(char *version_str, char *sha1_str) { if (version_str) strcpy(version_str, YAZ_VERSION); - if (sys_str) - strcpy(sys_str, ""); + if (sha1_str) + strcpy(sha1_str, YAZ_VERSION_SHA1); return YAZ_VERSIONL; } /* diff --git a/src/zget.c b/src/zget.c index f40dfde..7e01c05 100644 --- a/src/zget.c +++ b/src/zget.c @@ -34,11 +34,8 @@ Z_InitRequest *zget_InitRequest(ODR o) r->implementationId = "81"; r->implementationName = "YAZ"; r->implementationVersion = YAZ_VERSION -#ifdef YAZ_DATE_STR - " (" YAZ_DATE_STR ")" -#endif -#ifdef YAZ_OS - " " YAZ_OS +#ifdef YAZ_VERSION_SHA1 + " " YAZ_VERSION_SHA1 #endif ; r->userInformationField = 0; @@ -61,11 +58,8 @@ Z_InitResponse *zget_InitResponse(ODR o) r->implementationId = "81"; r->implementationName = "YAZ"; r->implementationVersion = YAZ_VERSION -#ifdef YAZ_DATE_STR - " (" YAZ_DATE_STR ")" -#endif -#ifdef YAZ_OS - " " YAZ_OS +#ifdef YAZ_VERSION_SHA1 + " " YAZ_VERSION_SHA1 #endif ; r->userInformationField = 0; -- 1.7.10.4