mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
Tools: added mav-firmware-version-str to manifest
this allows beta version to be displayed
This commit is contained in:
parent
d7ff072d26
commit
d46f4ba974
@ -95,6 +95,7 @@ class Firmware():
|
||||
self.atts["vehicletype"] = vehicletype
|
||||
self.atts["filepath"] = filepath
|
||||
self.atts["git_sha"] = git_sha
|
||||
self.atts["firmware-version-str"] = ""
|
||||
self.atts["frame"] = frame
|
||||
self.atts["release-type"] = None
|
||||
self.atts["firmware-version"] = None
|
||||
@ -163,6 +164,17 @@ class ManifestGenerator():
|
||||
"filepath (%s) does not contain a git sha" % (filepath,))
|
||||
return m.group("sha")
|
||||
|
||||
def fwversion_from_git_version(self, filepath):
|
||||
'''parses get-version.txt (as emitted by build_binaries.py, returns
|
||||
git sha from it'''
|
||||
content = open(filepath).read()
|
||||
sha_regex = re.compile("APMVERSION: \S+\s+(\S+)")
|
||||
m = sha_regex.search(content)
|
||||
if m is None:
|
||||
raise Exception(
|
||||
"filepath (%s) does not contain an APMVERSION" % (filepath,))
|
||||
return m.group(1)
|
||||
|
||||
def add_USB_IDs_PX4(self, firmware):
|
||||
'''add USB IDs to a .px4 firmware'''
|
||||
url = firmware['url']
|
||||
@ -319,6 +331,11 @@ class ManifestGenerator():
|
||||
except Exception as ex:
|
||||
print("Failed to parse %s" % git_version_txt, ex, file=sys.stderr)
|
||||
continue
|
||||
try:
|
||||
fwversion_str = self.fwversion_from_git_version(git_version_txt)
|
||||
except Exception as ex:
|
||||
print("Failed to parse APMVERSION %s" % git_version_txt, ex, file=sys.stderr)
|
||||
continue
|
||||
|
||||
# we require a firmware-version.txt. These files have been added to
|
||||
# old builds that didn't have them
|
||||
@ -399,6 +416,7 @@ class ManifestGenerator():
|
||||
firmware["platform"] = file_platform
|
||||
firmware["vehicletype"] = vehicletype
|
||||
firmware["git_sha"] = git_sha
|
||||
firmware["firmware-version-str"] = fwversion_str
|
||||
firmware["frame"] = frame
|
||||
firmware["timestamp"] = os.path.getctime(firmware["filepath"])
|
||||
firmware["format"] = firmware_format
|
||||
@ -478,6 +496,7 @@ class ManifestGenerator():
|
||||
"url": url,
|
||||
"mav-type": self.frame_map(firmware["frame"]),
|
||||
"mav-firmware-version-type": version_type,
|
||||
"mav-firmware-version-str": firmware["firmware-version-str"],
|
||||
"latest": firmware["latest"],
|
||||
"format": firmware["format"],
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user