Browse Source

px_mkfw: add git commit hash to .px4 file

sbg
Beat Küng 6 years ago committed by Daniel Agar
parent
commit
5cadb0aab1
  1. 9
      Tools/px_mkfw.py

9
Tools/px_mkfw.py

@ -57,7 +57,8 @@ def mkdesc(): @@ -57,7 +57,8 @@ def mkdesc():
proto['version'] = ""
proto['summary'] = ""
proto['description'] = ""
proto['git_identity'] = ""
proto['git_identity'] = "" # git tag
proto['git_hash'] = "" # git commit hash
proto['build_time'] = 0
proto['image'] = bytes()
proto['image_size'] = 0
@ -98,10 +99,14 @@ if args.summary != None: @@ -98,10 +99,14 @@ if args.summary != None:
if args.description != None:
desc['description'] = str(args.description)
if args.git_identity != None:
cmd = " ".join(["git", "--git-dir", args.git_identity + "/.git", "describe", "--always", "--tags"])
cmd = "git --git-dir '{:}/.git' describe --always --tags".format(args.git_identity)
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
desc['git_identity'] = str(p.read().strip())
p.close()
cmd = "git --git-dir '{:}/.git' rev-parse --verify HEAD".format(args.git_identity)
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout
desc['git_hash'] = str(p.read().strip())
p.close()
if args.parameter_xml != None:
f = open(args.parameter_xml, "rb")
bytes = f.read()

Loading…
Cancel
Save