1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

build: add FWTAG variable to the version-info.py

This commit is contained in:
Oleg Semyonov 2011-05-25 10:59:35 +03:00 committed by Stacey Sheldon
parent 986121d281
commit 75d4f19d30
2 changed files with 9 additions and 1 deletions

View File

@ -235,6 +235,13 @@ def sha1(file):
hex_stream = lambda s:",".join(['0x'+hex(ord(c))[2:].zfill(2) for c in s])
return hex_stream(sha1.digest())
def xtrim(string, length):
"""Trim string up to length bytes, adding '+' if truncated"""
if len(string) <= length:
return string
else:
return string[:length-1] + '+'
def main():
"""This utility uses git repository in the current working directory
or from the given path to extract some info about it and HEAD commit.
@ -306,6 +313,7 @@ dependent targets.
TAG_OR_BRANCH = r.tag(r.branch('unreleased')),
TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')),
DIRTY = r.dirty(),
FWTAG = xtrim(r.tag(r.branch('unreleased')) + r.dirty(), 25),
UNIXTIME = r.time(),
DATE = r.time('%Y%m%d'),
DATETIME = r.time('%Y%m%d %H:%M'),

View File

@ -62,7 +62,7 @@ const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__
.timestamp = ${UNIXTIME},
.board_type = ${BOARD_TYPE},
.board_revision = ${BOARD_REVISION},
.commit_tag_name = "${TAG_OR_BRANCH}${DIRTY}",
.commit_tag_name = "${FWTAG}",
.sha1sum = { ${SHA1} },
};