Re: Embedding a RCS token in uname -i

2011-06-22 Thread Karl Vogel
 On Tue, 21 Jun 2011 20:21:46 -0600 (MDT), 
 Dennis Glatting free...@penx.com said:

D My goal is to provide a mechanism where I can identify that kernels
D built on a group of machines are running the same kernel built from a
D configuration under RCS.  How can I customized the current config and
D build mechanisms to accomplish this?

   Make your changes to the file GENERIC.in, run a small script to create
   GENERIC with the stuff you want, and then do your build.

D Is it a dumb idea?

   I don't think so.  See below for one way to do it; the script includes a
   sanity check to make sure your build config file has been checked in.

-- 
Karl Vogel  I don't speak for the USAF or my company
Mr. Rogers was an ordained minister.--item for a lull in conversation

---
me% cat -n GENERIC.in
  1  # $Revision: 1.2 $ $Date: 2011/06/22 18:13:14 $
  2  
  3  cpu HAMMER
  4  ident   GENERIC
  5  ...

me% ./mkgen

me% cat -n GENERIC
  1  # THIS FILE WAS AUTOMATICALLY GENERATED.  GENERIC.in is under
  2  # revision control, so please make your changes there.
  3  #
  4  # $Revision: 1.2 $ $Date: 2011/06/22 18:13:14 $
  5  
  6  cpu HAMMER
  7  ident   GENERIC-1.2-20110622
  8  ...

me% cat mkgen
#!/bin/ksh
#mkgen: Get version and date info from GENERIC.in, write GENERIC

export PATH=/usr/local/bin:/bin:/usr/bin
in=GENERIC.in
out=GENERIC

if rcsdiff -q $in  /dev/null; then
echo updating $out
else
echo $in needs to be checked in
exit 0
fi

nawk -v ifile=$in 'BEGIN {
warn1 = # THIS FILE WAS AUTOMATICALLY GENERATED. 
warn2 = # revision control, so please make your changes there.\n#
  }
  {
if ($0 ~ /Revision:/) {
   print warn1, ifile, is under
   print warn2
   print
   gsub(/, )
   id = sprintf(%s-%s%s%s, $3, $6, $7, $8)
  }
  else if ($0 ~ /^ident/) { print $0 - id }
  else print

}' $in  $out

exit 0
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Embedding a RCS token in uname -i

2011-06-21 Thread Dennis Glatting


I have kernel configuration files (e.g., a custom GENERIC) under RCS. For 
example:


==
# $Revision: 1.1$

cpu HAMMER
ident   GENERIC
==

I want to add that 1.1 to the end of GENERIC such that it becomes:

==
# $Revision: 1.1$

cpu HAMMER
ident   GENERIC-1.1
=


Therefore, a uname -i becomes:

btw uname -i
GENERIC-1.1


My goal is to provide a mechanism where I can identify that kernels built 
on a group of machines are running the same kernel built from a 
configuration under RCS.


How can I customized the current config and build mechanisms to accomplish
this? Is there some other way to accomplish this? Is it a dumb idea?


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org