sys/conf/newvers.sh vs. subversion-1.7

Doug Barton dougb at FreeBSD.org
Tue Oct 25 20:07:50 UTC 2011


On 10/25/2011 12:43, Craig Rodrigues wrote:

> I know that Doug disagreed with me on this,

I didn't "disagree" with you. I pointed out that there is absolutely no
reason to run 2 separate commands. To put it more bluntly, I pointed out
why your suggestion is a bad idea.

I'm sorry to be so blunt but I'm getting really tired of people who
can't let go of bad ideas even when it's demonstrated conclusively why
they are bad. :)

> The alternative would be to run ${dir}/svnversion, and check the output
> of that command, making sure that the output starts with a number.

The attached implements that, and is almost certainly the right way to
go. It would be nice if someone could test it, and better if someone
else could commit it. I swore after the last time that I'd stay away
from that file precisely because of all the bikeshed stupidity that this
issue creates.


Doug

-- 

	Nothin' ever doesn't change, but nothin' changes much.
			-- OK Go

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/

-------------- next part --------------
Index: newvers.sh
===================================================================
--- newvers.sh	(revision 226474)
+++ newvers.sh	(working copy)
@@ -88,7 +88,7 @@
 i=`${MAKE:-make} -V KERN_IDENT`
 
 for dir in /bin /usr/bin /usr/local/bin; do
-	if [ -d "${SYSDIR}/.svn" -a -x "${dir}/svnversion" ] ; then
+	if [ -x "${dir}/svnversion" ] ; then
 		svnversion=${dir}/svnversion
 		break
 	fi
@@ -99,8 +99,12 @@
 done
 
 if [ -n "$svnversion" ] ; then
-    echo "$svnversion"
-	svn=" r`cd ${SYSDIR} && $svnversion`"
+	echo "$svnversion"
+	svn=`cd ${SYSDIR} && $svnversion`
+	case "$svn" in
+	[0-9]*)	svn=" r${svn}" ;;
+	*)	unset svn ;;
+	esac
 fi
 
 if [ -n "$git_cmd" ] ; then


More information about the freebsd-current mailing list