Bug 149510 - [build] [patch] CFT: sys/conf/newvers.sh: Cleanup and additions.
Summary: [build] [patch] CFT: sys/conf/newvers.sh: Cleanup and additions.
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2010-08-10 21:30 UTC by jhell
Modified: 2017-12-31 22:34 UTC (History)
0 users

See Also:

file.diff (3.32 KB, patch)
2010-08-10 21:30 UTC, jhell
no flags Details | Diff
newvers.sh.txt (3.28 KB, text/plain)
2010-08-11 02:42 UTC, jhell
no flags Details
newvers.sh-head-r213132.patch (3.67 KB, patch)
2010-09-25 03:22 UTC, jhell
no flags Details | Diff
newvers.sh-stable8-r213132.patch (3.99 KB, patch)
2010-09-25 03:22 UTC, jhell
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jhell 2010-08-10 21:30:06 UTC
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@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

 * 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.

 * 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.

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.

 * 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

 * 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.

Fix: Attached patch. Should apply cleanly to head and stable/8 but was developed on stable/8 r211092.

Patch attached with submission follows:
Comment 1 jhell 2010-08-11 02:42:17 UTC
 Attached is the adjusted patch to relieve the use of head and grep for



Comment 2 swell.k 2010-09-24 14:13:59 UTC
Can you refresh the patch against r213077?
Comment 3 jhell 2010-09-24 18:31:39 UTC
On 09/24/2010 09:13, Anonymous wrote:
> Can you refresh the patch against r213077?

Ill do this in about 4 - 5 hours from this email.


Comment 4 jhell 2010-09-25 03:22:32 UTC
The following are updated patches to what is already here for current
and stable/8. Links are respective to where they should be applied.

1 file changed, 61 insertions(+), 38 deletions(-)

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

These are also both attached but linked to just to be sure in case they
are somehow garbled.

After these two patches are applied both stable/8 and head will be in
sync with the changes that were made in r213077 & r213078

These were tested locally only with stable/8 and could use verification
for those using git(1) locally in either /usr/src/.git or
/usr/src/sys/.git on stable/8 & head.

Included with these changes and attributed to "Anonymous" <- thanks for
the heads-up, you also have the ability to use LOCALBASE. This could use
some testing to whether it works or not so I will leave that to others
for feedback.

Regards & Happy Hacking,


Comment 5 jhell 2010-09-25 03:43:22 UTC
Beware the previous patches that were submitted are concatenated and
should be separated at the "Index:" line otherwise they will both try to
apply with one failing.

The patch for head seems to be the first patch and the one for stable/8
is the second patch.



Comment 6 swell.k 2010-09-26 08:44:29 UTC
Typo in git(1) search path: LOCALBASE vs. LOCALBASE/bin.

-	for dir in /usr/bin ${LOCALBASE:-/usr/local}; do
+	for dir in /usr/bin ${LOCALBASE:-/usr/local}/bin; do

And thanks for including conf/146828.
Comment 7 jhell 2010-09-26 09:06:18 UTC
On 09/26/2010 03:44, Anonymous wrote:
> Typo in git(1) search path: LOCALBASE vs. LOCALBASE/bin.
> -	for dir in /usr/bin ${LOCALBASE:-/usr/local}; do
> +	for dir in /usr/bin ${LOCALBASE:-/usr/local}/bin; do
> And thanks for including conf/146828.

Yikes! thank you. Ill just edit the patch and put it back to where it
was in 20 minutes.


Comment 8 jhell 2010-12-19 22:05:18 UTC
Hash: SHA1

Any word on when, if, maybe, feedback, etc... can this make it into
8.2-RELEASE furthermore -> HEAD...

Still running this locally but would love to see this make it into src
as its just adding support for another SCM and based on the original
version that worked svn(1) and git(1) into the file.

Simplistic as it is, here's the URLs again for the patches.


- -- 


Comment 9 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:39 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped