[libpri-commits] bbryant: branch 1.4 r552 - in /branches/1.4: ./ build_tools/

SVN commits to the libpri project libpri-commits at lists.digium.com
Fri May 2 15:21:05 CDT 2008


Author: bbryant
Date: Fri May  2 15:21:04 2008
New Revision: 552

URL: http://svn.digium.com/view/libpri?view=rev&rev=552
Log:
Add new API call (pri_get_version) to show the current version of the branch for support purposes.

Added:
    branches/1.4/build_tools/
    branches/1.4/build_tools/make_version   (with props)
    branches/1.4/build_tools/make_version_c   (with props)
Modified:
    branches/1.4/Makefile
    branches/1.4/libpri.h

Modified: branches/1.4/Makefile
URL: http://svn.digium.com/view/libpri/branches/1.4/Makefile?view=diff&rev=552&r1=551&r2=552
==============================================================================
--- branches/1.4/Makefile (original)
+++ branches/1.4/Makefile Fri May  2 15:21:04 2008
@@ -28,14 +28,16 @@
 #LIBPRI_COUNTERS=-DLIBPRI_COUNTERS
 
 CC=gcc
+GREP=grep
+AWK=awk
 
 OSARCH=$(shell uname -s)
 PROC?=$(shell uname -m)
 
 STATIC_LIBRARY=libpri.a
 DYNAMIC_LIBRARY=libpri.so.1.0
-STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o
-DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo
+STATIC_OBJS=copy_string.o pri.o q921.o prisched.o q931.o pri_facility.o version.o
+DYNAMIC_OBJS=copy_string.lo pri.lo q921.lo prisched.lo q931.lo pri_facility.lo version.lo
 CFLAGS=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -g -fPIC $(ALERTING) $(LIBPRI_COUNTERS)
 INSTALL_PREFIX=$(DESTDIR)
 INSTALL_BASE=/usr
@@ -57,6 +59,10 @@
 SOSLINK = ln -sf libpri.so.1.0 libpri.so.1
 #INSTALL_PREFIX = /opt/asterisk  # Uncomment out to install in standard Solaris location for 3rd party code
 endif
+
+export PRIVERSION
+
+PRIVERSION:=$(shell GREP=$(GREP) AWK=$(AWK) build_tools/make_version .)
 
 #The problem with sparc is the best stuff is in newer versions of gcc (post 3.0) only.
 #This works for even old (2.96) versions of gcc and provides a small boost either way.
@@ -131,6 +137,11 @@
 	ln -sf libpri.so.1.0 libpri.so.1
 	$(SOSLINK)
 
+version.c:
+	@build_tools/make_version_c > $@.tmp
+	@cmp -s $@.tmp $@ || mv $@.tmp $@
+	@rm -f $@.tmp
+
 clean:
 	rm -f *.o *.so *.lo *.so.1 *.so.1.0
 	rm -f testprilib $(STATIC_LIBRARY) $(DYNAMIC_LIBRARY)
@@ -141,3 +152,5 @@
 
 .depend: 
 	CC="$(CC)" ./mkdep ${CFLAGS} `ls *.c`
+
+.PHONY: version.c

Added: branches/1.4/build_tools/make_version
URL: http://svn.digium.com/view/libpri/branches/1.4/build_tools/make_version?view=auto&rev=552
==============================================================================
--- branches/1.4/build_tools/make_version (added)
+++ branches/1.4/build_tools/make_version Fri May  2 15:21:04 2008
@@ -1,0 +1,74 @@
+#!/bin/sh
+
+if [ -f ${1}/.version ]; then
+	cat ${1}/.version
+elif [ -d .svn ]; then
+    PARTS=`LANG=C svn info ${1} | ${GREP} URL | ${AWK} '{print $2;}' | sed -e 's:^.*/svn/libpri/::' | sed -e 's:/: :g'`
+    BRANCH=0
+    TEAM=0
+    TAG=0
+
+    REV=`svnversion -c ${1} | cut -d: -f2`
+
+    BASE=`LANG=C svn pg svnmerge-integrated ${1} | cut -d: -f1`
+
+	if [ "${PARTS}" = "trunk" ] ; then
+	echo SVN-trunk-r${REV}
+	exit 0
+	fi
+
+    for PART in $PARTS ; do
+      if [ ${TAG} != 0 ] ; then
+	    if [ "${PART}" = "autotag_for_be" ] ; then
+	      continue
+	    fi
+	    if [ "${PART}" = "autotag_for_sx00i" ] ; then
+	      continue
+	    fi
+	    RESULT="${PART}"
+	    break
+      fi
+
+      if [ ${BRANCH} != 0 ] ; then
+        if [ -z ${RESULT} ] ; then
+          RESULT="2${PART}"
+        else
+          RESULT="3${RESULT}-${PART}"
+        fi
+	    break
+      fi
+
+      if [ ${TEAM} != 0 ] ; then
+        if [ -z ${RESULT} ] ; then
+           RESULT="4${PART}"
+        else
+          RESULT="5${RESULT}-${PART}"
+        fi
+        continue
+      fi
+
+      if [ "${PART}" = "branches" ] ; then
+        BRANCH=1
+        RESULT="branch"
+        continue
+      fi
+
+      if [ "${PART}" = "tags" ] ; then
+        TAG=1
+        continue
+      fi
+
+      if [ "${PART}" = "team" ] ; then
+        TEAM=1
+        continue
+      fi
+    done
+
+ 	RESULT="libss7"
+
+    if [ ${TAG} != 0 ] ; then
+	echo ${RESULT}
+    else
+	echo SVN-${RESULT}-r${REV}${BASE:+-${BASE}}
+    fi
+fi

Propchange: branches/1.4/build_tools/make_version
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.4/build_tools/make_version
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.4/build_tools/make_version
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/1.4/build_tools/make_version
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: branches/1.4/build_tools/make_version_c
URL: http://svn.digium.com/view/libpri/branches/1.4/build_tools/make_version_c?view=auto&rev=552
==============================================================================
--- branches/1.4/build_tools/make_version_c (added)
+++ branches/1.4/build_tools/make_version_c Fri May  2 15:21:04 2008
@@ -1,0 +1,24 @@
+#!/bin/sh
+if [ ! -f ../.flavor ]; then
+    EXTRA=""
+else
+    aadkver=`cat ../.version`
+    aadkflavor=`cat ../.flavor`
+    EXTRA=" (${aadkflavor} ${aadkver})"
+fi
+cat << END
+/*
+ * version.c
+ * Automatically generated
+ */
+
+#include "libpri.h"
+
+static const char pri_version[] = "${PRIVERSION}${EXTRA}";
+
+const char *pri_get_version(void)
+{
+	return pri_version;
+}
+
+END

Propchange: branches/1.4/build_tools/make_version_c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.4/build_tools/make_version_c
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.4/build_tools/make_version_c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: branches/1.4/build_tools/make_version_c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: branches/1.4/libpri.h
URL: http://svn.digium.com/view/libpri/branches/1.4/libpri.h?view=diff&rev=552&r1=551&r2=552
==============================================================================
--- branches/1.4/libpri.h (original)
+++ branches/1.4/libpri.h Fri May  2 15:21:04 2008
@@ -675,4 +675,7 @@
 #define PRI_TIMER_T321	26
 #define PRI_TIMER_T322	27
 
+/* Get PRI version */
+const char *pri_get_version(void);
+
 #endif




More information about the libpri-commits mailing list