[CFT] [sys/conf/newvers.sh] Cleanup and additions.

jhell jhell at dataix.net
Tue Aug 10 21:31:02 UTC 2010


Hello Stablers & Heads,

Based on the parts of the script with the additions for tracking source
using git(1) I set out to add support for mercurial hg(1) and ended up
cleaning some of the script while making some of those additions.

This works exactly as before but a little more correct and with the
additions to be able to track kernel sources or whole source tree with a
local revision system. Example output follows (uname -v) from my system
being tracked locally with mercurial.

FreeBSD 8.1-STABLE #0 r211092M 55:65408c40b051 Mon Aug  9 07:03:32 EDT
2010   jhell at ujump.dataix.net:/usr/obj/usr/src/sys/MITHOP

Inspiration for making these changes came from mercurial, OpenSolaris
and finally http://wiki.freebsd.org/LocalMercurial

Following is a list of changes that I have made that I believe people
that are involved with the source may find useful.

1 file changed, 55 insertions(+), 35 deletions(-)

This allows a user:
 * That is using csup(1) or cvsup(1) to locally keep track of the whole
source tree or just the kernel part of the tree using svn(1), hg(1) or
git(1).

 * That is using svn(1) to checkout their source tree to use hg(1) or
git(1) to keep track of the whole tree or the kernel part of the tree.
	http://svn.freebsd.org/base/

 * That is using git(1) to checkout their source tree to use hg(1) to
keep track of the whole tree or the kernel part of the tree.
	http://spoerlein.net/gitweb/

This checks for:
 * SCM roots in src/ or src/sys for .svn, .hg, & .git and acts
accordingly if they exist while prioritizing using an SCM root in src/
before it uses src/sys/

 * Then looks for acceptable binaries for svn(1), hg(1) git(1) within
the select paths /usr/local/bin & then /usr/bin. The paths may change
for svn(1) or git(1) & maybe mercurial if it ever becomes part of world.
Currently I have set these to only look in /usr/local/bin.

Cleanups:
 * Instead of using variables that shared the same name as their
counterpart binaries to hold a revision number use more descriptive
names like svnrev gitrev & hgrev for revisions. Use git svnversion & hg
variables for their respective binaries.

 * Adjust the paths that are checked for binaries to be of only
/usr/local/bin and /usr/bin. "/bin" is highly unlikely to hold svn(1),
git(1) or hg(1).

 * Test for a SCM root in the source tree locations before we look for
binaries. If these don't exist there is no need to know where svn or git
are.

 * For git(1) always set work-tree and git-dir so there is no
possibility to end up with a "-dirty" git(1) revision.

 * Remove extraneous "touch version" since the previous if statement
already creates the file if its not found.

 * Inline the test for version file.


I have opened a PR: misc/149510 here: http://bit.ly/buBqXc
And have uploaded the patch here: http://bit.ly/9hvVfx


Throw me some feedback, concerns or other information. It will be really
appreciated.


Regards,

-- 

 jhell,v



More information about the freebsd-current mailing list