Skip to content

Commit

Permalink
Fix versioning script to take RC into account
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Jan 30, 2024
1 parent a53f64f commit 7c83bcb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ bool bootloaderProcess(CrtpPacket *packet) {
//memcpy(info->cpuId, cpuidGetId(), CPUID_LEN);
bzero(info->cpuId, CPUID_LEN);
info->version = PROTOCOL_VERSION;
info->version_major = VERSION_MAJOR | (VERSION_DIRTY)?0x8000U:0x000;
info->version_major = VERSION_MAJOR | ((VERSION_DIRTY)?0x8000U:0x000);
info->version_minor = VERSION_MINOR;
info->version_patch = VERSION_PATCH;

Expand Down
7 changes: 5 additions & 2 deletions tools/build/generateVersionHeader.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ def extract_information_from_git(base):


def generate_numeral_version():
vnum = version["tag"].split('+')[0].split('.')
vnum = version["tag"].split('+')[0].split('RC')[0].split('.')

version["major"] = int(vnum[0]) if len(vnum) > 0 and vnum[0] != "NA" else 0
version["minor"] = int(vnum[1]) if len(vnum) > 1 else 0
version["patch"] = int(vnum[2]) if len(vnum) > 2 else 0

version["dirty"] = "true" if version["modified"] == "true" or version["tag"].find('+') >= 0 else "false"
version["dirty"] = "true" if version["modified"] == "true" or '+' in version["tag"] or 'RC' in version["tag"] else "false"


if __name__ == "__main__":
Expand All @@ -96,6 +96,9 @@ def generate_numeral_version():

generate_numeral_version()

dirtymark = '+' if version["dirty"] else ''
print(f'Version {version["major"]}.{version["minor"]}.{version["patch"]}{dirtymark}')

with open(os.path.join(args.crazyflie_base, args.output), 'w') as fd:
fd.writelines(
['#include <stdbool.h>\n',
Expand Down

0 comments on commit 7c83bcb

Please sign in to comment.