Hi, Simon,

It addresses the problem of knowing exactly what version of NuttX is running on a platform.  This problem often occurs, when in testing or deployment, one discovers a problem which may or may not have already been fixed.  If you knew the version you’re running and the problem has been fixed, you’d be able to easily cherry-pick the fix…


The script (gen_gitrev.sh) is attached (slightly later version than last checked into orig NuttX.org repo) and should reside in in the nuttx/tools subdir.

I can create a patch and pull request if needed, but in the meantime see attached.


The /tools/Makefile.unix needs one line added to the .version: recipe to call the script:

# [Re-]create .version if it doesn't already exist.

$(TOPDIR)/.version:
$(Q) echo "Create .version"
$(Q) tools/version.sh -s $(CONFIG_VERSION_STRING) -v $(CONFIG_VERSION_MAJOR).$(CONFIG_VERSION_MINOR) -b $(CONFIG_VERSION_BUILD) .version
$(Q) tools/gen_gitrev.sh -t $(TOPDIR) -f .version
$(Q) chmod 755 .version


Then modify procfsversion.c:

if (filep->f_pos == 0)
    {
#ifdef CONFIG_GIT_REVISION_STR
      linesize = snprintf(attr->line, VERSION_LINELEN,
                          "NuttX version %s %s\n"
                          "%s\n",
                          CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD,
                          CONFIG_GIT_REVISION_STR);
#elif defined(__DATE__) && defined(__TIME__)
      linesize = snprintf(attr->line, VERSION_LINELEN,
                          "NuttX version %s %s %s %s\n",
                          CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD,
                          __DATE__, __TIME__);
#else
      linesize = snprintf(attr->line, VERSION_LINELEN,
                          "NuttX version %s %s\n",
                          CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD);
#endif


Finally, in a NuttX prompt:
cat /proc/version

will produce something like this:

Blade-v1-2-gdf65129b4e+, master, topaz/dsa, Sat 25-Sep-2021 11:01:29 PDT


Cheers,
-david


Attachment: gen_gitrev.sh
Description: Binary data




On Sep 25, 2021, at 12:02 AM, Simon Filgis <si...@ingenieurbuero-filgis.de> wrote:

What does your script do?

David S. Alessio <david.s.ales...@gmail.com> schrieb am Sa., 25. Sept.
2021, 01:02:

I’d like to see my git version script be brought back into mainstream.

On Sep 24, 2021, at 3:58 PM, Alan Carvalho de Assis <acas...@gmail.com>
wrote:

Hi David,

Nice you hear from you.

I'm also using git: #1

BR,

Alan

On 9/24/21, David S. Alessio <david.s.ales...@gmail.com> wrote:
Hi, Alan,

It’d be good to know how developers are managing their code:
1) git
2) mercurial
3) SVN
4) zip files on floppies
5) none

My money is on #1 ;)

Cheers,
-david

On Sep 24, 2021, at 2:07 PM, Alan Carvalho de Assis <acas...@gmail.com

wrote:

Hi Flávio,

That is good idea, but I think we need to have some kind of
maintainers.

It is hard when someone adds some strange OS and the go out and leave
it to other developers to maintain it.

Do you want to mainline some host OS? :-P

BR,

Alan

On 9/24/21, Flavio Castro Alves Filho <flavio.al...@gmail.com> wrote:
Alan,

How about a poll asking "which other OS would you like to build
NuttX?"
:-P

Best regards,

Flavio

Em sex., 24 de set. de 2021 às 17:45, Tim Hardisty
<t...@jti.uk.com.invalid> escreveu:

Linux



On 24/09/2021, 21:07, "Alan Carvalho de Assis" <acas...@gmail.com>
wrote:

 Sorry guys, I suppose you are using LinkedIn too.

 Yes, probably it will collect some data from you, but you are using
a
 better MS gather:

 "Sent from Mail for Windows"

 So, if you are already in the hell, please give a warm hug in the
Lucifer :-D

 Now, let be serious here: for those who don't have LinkedIn access,
 please reply this email with one of these options:

 1) Linux
 2) MacOS
 3) Windows using Cygwin
 4) Windows Native

 Thank you for the understanding.

 BR,

 Alan

 On 9/24/21, Russell Haley <russ.ha...@winlua.net> wrote:
The link gives me “This post cannot be displayed”. I am logged into
the
Microsoft data collection site known as LinkedIn.

Sent from Mail for Windows

From: Tim Hardisty
Sent: Friday, September 24, 2021 12:54 PM
To: dev@nuttx.apache.org
Subject: Re: Poll: Which OS are you using to compile NuttX?

Needs a LinkedIn login?



From: Alan Carvalho de Assis <acas...@gmail.com>
Reply to: "dev@nuttx.apache.org" <dev@nuttx.apache.org>
Date: Friday, 24 September 2021 at 20:20
To: dev <dev@nuttx.apache.org>
Subject: Poll: Which OS are you using to compile NuttX?

Hi Everyone, Please help us to discover which OS people are using
most to
compile NuttX:


https://www.linkedin.com/feed/update/urn:li:activity:6847246067046596609/
It
will help us to decide how better support your host OS. BR, Alan






--
Flavio de Castro Alves Filho

flavio.al...@gmail.com
Twitter: http://twitter.com/#!/fraviofii
LinkedIn profile: www.linkedin.com/in/flaviocastroalves






Reply via email to