mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:57:35 +08:00
logger: add git branch name to the log
This commit is contained in:
@@ -17,6 +17,11 @@ git_tag = subprocess.check_output('git describe --always --tags'.split(),
|
||||
stderr=subprocess.STDOUT).decode('utf-8').strip()
|
||||
git_version = subprocess.check_output('git rev-parse --verify HEAD'.split(),
|
||||
stderr=subprocess.STDOUT).decode('utf-8').strip()
|
||||
try:
|
||||
git_branch_name = subprocess.check_output('git symbolic-ref -q --short HEAD'.split(),
|
||||
stderr=subprocess.STDOUT).decode('utf-8').strip()
|
||||
except:
|
||||
git_branch_name = ''
|
||||
git_version_short = git_version[0:16]
|
||||
nuttx_git_tag = subprocess.check_output('git describe --always --tags'.split(),
|
||||
cwd='NuttX/nuttx', stderr=subprocess.STDOUT).decode('utf-8').strip().replace("nuttx-","v")
|
||||
@@ -36,14 +41,18 @@ header = """
|
||||
#define PX4_GIT_VERSION_STR "{git_version}"
|
||||
#define PX4_GIT_VERSION_BINARY 0x{git_version_short}
|
||||
#define PX4_GIT_TAG_STR "{git_tag}"
|
||||
#define PX4_GIT_BRANCH_NAME "{git_branch_name}"
|
||||
|
||||
#define NUTTX_GIT_VERSION_STR "{nuttx_git_version}"
|
||||
#define NUTTX_GIT_VERSION_BINARY 0x{nuttx_git_version_short}
|
||||
#define NUTTX_GIT_TAG_STR "{nuttx_git_tag}"
|
||||
|
||||
#define MAVLINK_LIB_GIT_VERSION_STR "{mavlink_git_version}"
|
||||
#define MAVLINK_LIB_GIT_VERSION_BINARY 0x{mavlink_git_version_short}
|
||||
""".format(git_tag=git_tag,
|
||||
git_version=git_version,
|
||||
git_version_short=git_version_short,
|
||||
git_branch_name=git_branch_name,
|
||||
nuttx_git_version=nuttx_git_version,
|
||||
nuttx_git_version_short=nuttx_git_version_short,
|
||||
nuttx_git_tag=nuttx_git_tag,
|
||||
|
||||
Reference in New Issue
Block a user