Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Sep 2012 06:01:34 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240547 - head/sys/conf
Message-ID:  <201209160601.q8G61Y7i018703@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Sun Sep 16 06:01:34 2012
New Revision: 240547
URL: http://svn.freebsd.org/changeset/base/240547

Log:
  Add Perforce support.

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==============================================================================
--- head/sys/conf/newvers.sh	Sun Sep 16 05:52:54 2012	(r240546)
+++ head/sys/conf/newvers.sh	Sun Sep 16 06:01:34 2012	(r240547)
@@ -88,9 +88,11 @@ v=`cat version` u=${USER:-root} d=`pwd` 
 i=`${MAKE:-make} -V KERN_IDENT`
 
 for dir in /bin /usr/bin /usr/local/bin; do
-	if [ -x "${dir}/svnversion" ] ; then
+	if [ -x "${dir}/svnversion" ] && [ -z ${svnversion} ] ; then
 		svnversion=${dir}/svnversion
-		break
+	fi
+	if [ -x "${dir}/p4" ] && [ -z ${p4_cmd} ] ; then
+		p4_cmd=${dir}/p4
 	fi
 done
 if [ -d "${SYSDIR}/../.git" ] ; then
@@ -132,10 +134,27 @@ if [ -n "$git_cmd" ] ; then
 	fi
 fi
 
+if [ -n "$p4_cmd" ] ; then
+	p4version=`cd ${SYSDIR} && $p4_cmd changes -m1 "./...#have" 2>&1 | \
+		awk '{ print $2 }'`
+	case "$p4version" in
+	[0-9]*)
+		p4version=" ${p4version}"
+		p4opened=`$p4_cmd opened 2>&1`
+		case "$p4opened" in
+		File*) ;;
+		*)	p4version="${p4version}+pending" ;;
+		esac
+		;;
+	*)	unset p4version ;;
+	esac
+fi
+	
+
 cat << EOF > vers.c
 $COPYRIGHT
-#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}: ${t}"
-#define VERSTR "${VERSION} #${v}${svn}${git}: ${t}\\n    ${u}@${h}:${d}\\n"
+#define SCCSSTR "@(#)${VERSION} #${v}${svn}${git}${p4version}: ${t}"
+#define VERSTR "${VERSION} #${v}${svn}${git}${p4version}: ${t}\\n    ${u}@${h}:${d}\\n"
 #define RELSTR "${RELEASE}"
 
 char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209160601.q8G61Y7i018703>