- remove old versioning system
- add new custom firmware name handler
This commit is contained in:
ZanzyTHEbar 2022-12-26 23:10:11 +00:00
parent e795567988
commit 6e210485ae
5 changed files with 40 additions and 14 deletions

View File

@ -1,14 +1,28 @@
FILENAME_BUILDNO = 'tools/versioning' FILENAME_VERSION = 'tools/version.txt'
version = 'v0.1.' build_no = 'v0.0.0'
build_no = 0
try: try:
with open(FILENAME_BUILDNO) as f: with open(FILENAME_VERSION) as f:
build_no = int(f.readline()) + 1 build_no = f.readline()
if build_no == '':
raise Exception("Empty file")
version = build_no.split('v')
version = version[1].split('.')
first_num = int(version[0])
second_num = int(version[1])
last_num = int(version[2])
if last_num <= 9:
last_num += 1
elif second_num <= 9 and last_num >= 9:
second_num += 1
elif second_num and last_num >= 9:
first_num += 1
second_num = 0
last_num = 0
else:
raise Exception("Invalid version number")
build_no = 'v' + str(first_num) + '.' + str(second_num) + '.' + str(last_num)
except: except:
build_no = 1 build_no = "v0.0.1"
with open(FILENAME_BUILDNO, 'w+') as f: with open(FILENAME_VERSION, 'w+') as f:
f.write(str(build_no)) f.write(build_no)
print("-DVERSION={0}".format(build_no))
#print("-DVERSION=\"%s\"" % version+str(build_no))
print("-DVERSION={0}".format(version+str(build_no)))

View File

@ -2,6 +2,9 @@
Import("env") Import("env")
# Dump global construction environment (for debug purpose)
#print(env.Dump())
my_flags = env.ParseFlags(env['BUILD_FLAGS']) my_flags = env.ParseFlags(env['BUILD_FLAGS'])
defines = dict() defines = dict()
for x in my_flags.get("CPPDEFINES"): for x in my_flags.get("CPPDEFINES"):
@ -21,3 +24,12 @@ env.Replace(
PROGNAME="%s-%s-%s-%s-%s" % PROGNAME="%s-%s-%s-%s-%s" %
(s(defines.get("PIO_SRC_NAM")), s(defines.get("VERSION")), str(env["PIOENV"]), (s(defines.get("PIO_SRC_NAM")), s(defines.get("VERSION")), str(env["PIOENV"]),
s(defines.get("PIO_SRC_REV")), s(defines.get("PIO_SRC_BRH")))) s(defines.get("PIO_SRC_REV")), s(defines.get("PIO_SRC_BRH"))))
#detect if there is a forward slash in the PROGNAME and replace it with an underscore
if "/" in env["PROGNAME"]:
env.Replace(
PROGNAME="%s" %
(env["PROGNAME"].replace("/", "-")))
# create a file with the name of the firmware
env.Execute("echo %s > %s" % (env["PROGNAME"], env.subst("./tools/firmware_name.txt")))

View File

@ -1 +1 @@
OpenIris-v0.1.685-esp32Cam_release-400bd99-feature-mdns-autodiscovery OpenIris-v0.0.1-esp32Cam_release-be1530b-feature-mdns-autodiscovery

1
ESP/tools/version.txt Normal file
View File

@ -0,0 +1 @@
v1.0.0

View File

@ -1 +0,0 @@
566