Re: [RFC] fix git detection code in newvers.sh when svn installed

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Fri, 6 Jan 2012 11:16:54 -0800
On Fri, Jan 6, 2012 at 11:02 AM, Oliver Pinter <pinter_at_tresorium.hu> wrote:
> On Friday 06 January 2012 19:35:31 Sergey Kandaurov wrote:
>> On 6 January 2012 21:50, Oliver Pinter <pinter_at_tresorium.hu> wrote:
>> > Hi All!
>> >
>> > When svn installed and the source stored in git, then now the version
>> > detection failed. The attached patch fixed this situation.
>>
>> FWIW, a different version proposed by Maciej Milewski on -current
>> some time ago. I don't have/use git, so I cannot test these changes.
>> It is good in the sense that it doesn't duplicate a search path.
>> The patch is below for reference:
>>
>> --- sys/conf/newvers.sh       2011-11-19 00:56:50.795815738 +0100
>> +++ sys/conf/newvers-patched.sh       2011-11-19 00:58:21.187818982 +0100
>> _at__at_ -88,14 +88,14 _at__at_
>>  i=`${MAKE:-make} -V KERN_IDENT`
>>
>>  for dir in /bin /usr/bin /usr/local/bin; do
>> -     if [ -x "${dir}/svnversion" ] ; then
>> -             svnversion=${dir}/svnversion
>> -             break
>> -     fi
>>       if [ -d "${SYSDIR}/../.git" -a -x "${dir}/git" ] ; then
>>               git_cmd="${dir}/git --git-dir=${SYSDIR}/../.git"
>>               break
>>       fi
>> +     if [ -x "${dir}/svnversion" ] ; then
>> +             svnversion=${dir}/svnversion
>> +             break
>> +     fi
>>  done
>>
>>  if [ -n "$svnversion" ] ; then
>
> The problem with this, when git founded first and the source not stored in
> git, then the svn version not correctly set, due the loop first found git,
> and than breaked out.
>
> The same situation as my patch fixed, but from svn viewpoint.

This detection method might be worth mentioning as well (look for
SVNVERSION: http://freenas.svn.sourceforge.net/viewvc/freenas/trunk/build/nano_env?revision=9392&view=markup
).
Cheers,
-Garrett
Received on Fri Jan 06 2012 - 18:16:55 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:23 UTC