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

Craig Rodrigues rodrigc at crodrigues.org
Thu Oct 27 19:05:42 UTC 2011


On Tue, Oct 25, 2011 at 1:07 PM, Doug Barton <dougb at freebsd.org> wrote:
> 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.

Hi,

I tested your patch and it works.  I am attaching vers.c files which I
generated in trees which were under svn control, and not under svn control.
-- 
Craig Rodrigues
rodrigc at crodrigues.org
-------------- 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
-------------- next part --------------
/*-
 * Copyright (c) 1992-2011 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#define SCCSSTR "@(#)FreeBSD 9.0-BETA2 #0 r225368:226179M: Tue Oct 25 23:35:11 PDT 2011"
#define VERSTR "FreeBSD 9.0-BETA2 #0 r225368:226179M: Tue Oct 25 23:35:11 PDT 2011\n    rodrigc at dibbler.crodrigues.org:/usr/obj/opt2/branches/head/src/sys/MYKERNEL1\n"
#define RELSTR "9.0-BETA2"

char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;
char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR;
char ostype[] = "FreeBSD";
char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR;
int osreldate = 900043;
char kern_ident[] = "GENERIC";
-------------- next part --------------
/*-
 * Copyright (c) 1992-2011 The FreeBSD Project.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */

#define SCCSSTR "@(#)FreeBSD 9.0-BETA2 #5: Tue Oct 25 23:07:51 PDT 2011"
#define VERSTR "FreeBSD 9.0-BETA2 #5: Tue Oct 25 23:07:51 PDT 2011\n    rodrigc at dibbler.crodrigues.org:/usr/obj/opt2/branches/head/src/sys/MYKERNEL1\n"
#define RELSTR "9.0-BETA2"

char sccs[sizeof(SCCSSTR) > 128 ? sizeof(SCCSSTR) : 128] = SCCSSTR;
char version[sizeof(VERSTR) > 256 ? sizeof(VERSTR) : 256] = VERSTR;
char ostype[] = "FreeBSD";
char osrelease[sizeof(RELSTR) > 32 ? sizeof(RELSTR) : 32] = RELSTR;
int osreldate = 900043;
char kern_ident[] = "GENERIC";


More information about the freebsd-current mailing list