Tools: support new stable release of 4.3.x

allows creation of the stable-4.3.x directories
This commit is contained in:
Andrew Tridgell 2023-08-25 10:02:14 +10:00
parent 7d23e14f85
commit d10cebd649
1 changed files with 36 additions and 0 deletions

View File

@ -8,6 +8,8 @@ import shutil
VEHICLES = ['AntennaTracker', 'Copter', 'Plane', 'Rover', 'Sub']
# beta directories that may contain stable builds
BETA_DIRS = ['beta-4.3']
def make_stable(basedir, vehicle):
'''make stable version for a vehicle'''
@ -34,11 +36,45 @@ def make_stable(basedir, vehicle):
old_dir = os.path.join(stable_dir, b)
shutil.copytree(old_dir, new_dir)
def make_stable_from_beta(basedir, vehicle, beta_dir):
'''make stable version from a beta with OFFICAL tag'''
beta_dir = os.path.join(basedir, vehicle, beta_dir)
if not os.path.exists(beta_dir):
return
for b in sorted(os.listdir(beta_dir)):
if not os.path.isdir(os.path.join(beta_dir, b)):
continue
vfile = os.path.join(beta_dir, b, "firmware-version.txt")
if not os.path.exists(vfile):
print("Missing %s" % vfile)
continue
vstr = open(vfile).read().strip()
a = vstr.split('-')
if len(a) != 2:
continue
version = a[0]
vtype = a[1]
#print(vfile, b, version, vtype)
if vtype != 'FIRMWARE_VERSION_TYPE_OFFICIAL':
# not a new stable
continue
new_dir_parent = os.path.join(basedir, vehicle, 'stable-%s' % version)
new_dir = os.path.join(new_dir_parent, b)
if os.path.exists(new_dir):
continue
if not os.path.exists(new_dir_parent):
os.mkdir(new_dir_parent)
print('Creating %s' % new_dir)
old_dir = os.path.join(beta_dir, b)
shutil.copytree(old_dir, new_dir)
def make_all_stable(basedir):
'''make stable directory for all vehicles'''
for v in VEHICLES:
make_stable(basedir, v)
for b in BETA_DIRS:
make_stable_from_beta(basedir, v, b)
if __name__ == "__main__":