Skip to content
Snippets Groups Projects
Commit e99a7618 authored by Paulus Kruger's avatar Paulus Kruger
Browse files

Change TR version format

parent 9e5c4ee9
No related branches found
No related tags found
No related merge requests found
Pipeline #56794 passed
...@@ -69,7 +69,7 @@ I2C_threads=[] ...@@ -69,7 +69,7 @@ I2C_threads=[]
if not(args.test): if not(args.test):
handler=opcuaserv.InitServer(port=args.port) handler=opcuaserv.InitServer(port=args.port)
logging.info("Load OPCUA variables & start i2c listing thread") logging.info("Load OPCUA variables & start i2c listing thread")
opcuaserv.AddVarR("TR_software_version_R",git_hash,[],False) opcuaserv.AddVarR("TR_software_version_R",git_hash+"_"+args.config,[],False)
for i,name in enumerate(I2Cports): for i,name in enumerate(I2Cports):
RCU_I2C=I2Cclients[i] RCU_I2C=I2Cclients[i]
RCU_conf=yamlreader.yamlreader(RCU_I2C,yamlfile=name) RCU_conf=yamlreader.yamlreader(RCU_I2C,yamlfile=name)
......
...@@ -5,15 +5,20 @@ def _get_version_hash(): ...@@ -5,15 +5,20 @@ def _get_version_hash():
"""Talk to git and find out the tag/hash of our latest commit""" """Talk to git and find out the tag/hash of our latest commit"""
try: try:
# p = subprocess.Popen(["git", "rev-parse","HEAD"], # p = subprocess.Popen(["git", "rev-parse","HEAD"],
p = subprocess.Popen(["git", "show","-s","--format=%ci"], # p = subprocess.Popen(["git", "show","-s","--format=%ci"],
# p = subprocess.Popen(["git", "log","-1","--format='%H'"], # p = subprocess.Popen(["git", "log","-1","--format='%H'"],
p = subprocess.Popen(["git", "log","-1","--format='%ct %h'","--abbrev-commit"],
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
except EnvironmentError: except EnvironmentError:
print("Couldn't run git to get a version number for setup.py") print("Couldn't run git to get a version number for setup.py")
return return
ver = p.communicate()[0] ver = p.communicate()[0]
ver=ver.strip() ver = ver.decode('ascii')[1:-2].split()
ver=str(ver)[2:-1] from datetime import datetime
ver="%s_%s"%(datetime.utcfromtimestamp(int(ver[0])).isoformat(),ver[1])
# ver=ver.strip()
# ver=str(ver)[2:-1]
print("Git hash=",ver) print("Git hash=",ver)
return ver return ver
......
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