Merged in david_alessio/nuttx/feature/add-git-revision (pull request #1020)

report git info on /proc/gitrev

* report git info on /proc/gitrev

    git info reported: branch, version, git hash, hostname, usr, build date

* use existing .version and procfs for git info

* reduce script's coupling

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
David Alessio
2019-08-26 15:09:33 +00:00
committed by Gregory Nutt
parent 3806a01c5d
commit a0867a7f4f
3 changed files with 228 additions and 11 deletions
+10 -2
View File
@@ -220,15 +220,23 @@ static ssize_t version_read(FAR struct file *filep, FAR char *buffer,
if (filep->f_pos == 0)
{
#if defined(__DATE__) && defined(__TIME__)
#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);
#else
# if 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
# else
linesize = snprintf(attr->line, VERSION_LINELEN,
"NuttX version %s %s\n",
CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD);
# endif
#endif
/* Save the linesize in case we are re-entered with f_pos > 0 */