Date: Mon, 8 Feb 2016 02:46:55 +1100 (EST) From: Ian Smith <smithi@nimnet.asn.au> To: Matthew Seaman <matthew@FreeBSD.org> Cc: freebsd-questions@FreeBSD.org Subject: Re: svn revision in uname Message-ID: <20160208015129.V51785@sola.nimnet.asn.au> In-Reply-To: <56B73E8C.5060501@FreeBSD.org> References: <20160207223554.P51785@sola.nimnet.asn.au> <56B73E8C.5060501@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 7 Feb 2016 12:54:36 +0000, Matthew Seaman wrote: > On 07/02/2016 12:11, Ian Smith wrote: > > I've been using svnup for source updates for ages, and for my occasional > > use it works fine. However one thing you don't get is the svn revision > > shown in uname, eg % uname -vm > > FreeBSD 9.3-STABLE #0: Thu Oct 29 03:18:26 EST 2015 > > root@x200.smithi.id.au:/usr/obj/usr/src/sys/GENERIC amd64 > > > > I know where to find it: > > smithi@x200:~ % ll -rt /var/tmp/svnup/ > > total 30400 > > -rw-r--r-- 1 root wheel 3736967 Apr 22 2014 stable.apr > > -rw-r--r-- 1 root wheel 3738448 Jun 25 2014 stable.jun > > -rw-r--r-- 1 root wheel 3738347 Jul 6 2014 release > > -rw-r--r-- 1 root wheel 7926790 Jan 23 2015 ports.first > > -rw-r--r-- 1 root wheel 7927003 Jan 23 2015 ports > > -rw-r--r-- 1 root wheel 3750256 Oct 10 16:43 stable > > > > smithi@x200:~ % head -1 /var/tmp/svnup/stable > > 289106 > > > > but I don't know where to poke it so build|install world|kernel find it? > > > > One of the reasons I prefer svnup on this very (64GB) space-constrained > > laptop is that it doesn't need svn's extra copy of the repository, but > > I'm happy to add a /usr/src/.svn dir with whatever is needed for this. > > > > Hoping the answer is not "the build needs svn installed to get that" :) > > > > The place where this is all set up is /usr/src/sys/conf/newvers.sh The > logic there is fairly complicated as it supports svn, git, hg and p4 > VCSes. However, the usual way it works is by running svnversion -- > that's part of the svn port. > > % svnversion /usr/src > 295073M > > If that fails, it will try running svnliteversion, and then cycle > through various different ways of extracting a version string from other > VCSes until it gets a result. Thanks for this. Right up to here, I thought it was going to be hard .. > So, if you don't need SVN installed locally, you could create a small > shell script as /usr/local/bin/svnversion that runs 'head -1 > /var/tmp/svnup/stable' Exactly so: smithi@x200:/usr/local/bin % svnversion anything 289106 It could be made a bit smarter in finding the latest svnup update, when updating to a release or releng rather than stable, but that's icing. [Oddly, I found an old version of svn installed from early 2013, that a) pkg2ng hadn't found because b) it had no old /var/db/svn* directory, ie was unregistered. Before removal, svnversion /usr/src said 'Unversioned directory', which was true enough.] Thanks again, cheers, Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160208015129.V51785>