Skip to content
Snippets Groups Projects
Commit ea223505 authored by Lorenz Meier's avatar Lorenz Meier
Browse files

Tools: Add MAVLink libary git hash to exported symbols

parent 752623f2
No related branches found
No related tags found
No related merge requests found
......@@ -17,12 +17,16 @@ 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()
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")
nuttx_git_tag = re.sub('-.*','.0',nuttx_git_tag)
nuttx_git_version = subprocess.check_output('git rev-parse --verify HEAD'.split(),
cwd='NuttX/nuttx', stderr=subprocess.STDOUT).decode('utf-8').strip()
git_version_short = git_version[0:16]
nuttx_git_version_short = nuttx_git_version[0:16]
mavlink_git_version = subprocess.check_output('git rev-parse --verify HEAD'.split(),
cwd='mavlink/include/mavlink/v2.0', stderr=subprocess.STDOUT).decode('utf-8').strip()
mavlink_git_version_short = mavlink_git_version[0:16]
# Generate the header file content
header = """
......@@ -33,12 +37,18 @@ header = """
#define PX4_GIT_VERSION_BINARY 0x{git_version_short}
#define PX4_GIT_TAG_STR "{git_tag}"
#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,
nuttx_git_version=nuttx_git_version,
nuttx_git_tag=nuttx_git_tag)
nuttx_git_version_short=nuttx_git_version_short,
nuttx_git_tag=nuttx_git_tag,
mavlink_git_version=mavlink_git_version,
mavlink_git_version_short=mavlink_git_version_short)
if old_header != header:
print('Updating header {}'.format(sys.argv[1]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment