mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-22 01:40:35 +08:00
version: add optional oem version tag (ext/oem-<version>) and log it
This commit is contained in:
@@ -84,15 +84,26 @@ except:
|
||||
git_branch_name = ''
|
||||
git_version_short = git_version[0:16]
|
||||
|
||||
# OEM version
|
||||
try:
|
||||
oem_tag = subprocess.check_output('git describe --match ext/oem-* --tags'.split(),
|
||||
stderr=subprocess.STDOUT).decode('utf-8').strip()
|
||||
oem_tag = oem_tag[8:]
|
||||
except:
|
||||
oem_tag = ''
|
||||
|
||||
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 PX4_GIT_OEM_VERSION_STR "{oem_tag}"
|
||||
""".format(git_tag=git_tag,
|
||||
git_version=git_version,
|
||||
git_version_short=git_version_short,
|
||||
git_branch_name=git_branch_name)
|
||||
git_branch_name=git_branch_name,
|
||||
oem_tag=oem_tag)
|
||||
|
||||
|
||||
# ECL
|
||||
|
||||
@@ -370,3 +370,8 @@ uint64_t px4_os_version_binary(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *px4_firmware_oem_version_string(void)
|
||||
{
|
||||
return PX4_GIT_OEM_VERSION_STR;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,5 +187,10 @@ __EXPORT uint64_t px4_mavlink_lib_version_binary(void);
|
||||
*/
|
||||
__EXPORT uint64_t px4_os_version_binary(void);
|
||||
|
||||
/**
|
||||
* get the git oem version tag (can be empty, no particular format)
|
||||
*/
|
||||
__EXPORT const char *px4_firmware_oem_version_string(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user