mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
[OP-703] Add new variables to version-info.py and use them in Makefiles
${REVISION} - revision info string (tag or branch:hash date time) ${LABEL} - package label string (tag or date-hash) ${DAY} - day of last commit ${MONTH} - month of last commit ${YEAR} - year of last commit
This commit is contained in:
parent
8b2780bf71
commit
3668ecede3
@ -158,6 +158,20 @@ class Repo:
|
||||
else:
|
||||
return clean
|
||||
|
||||
def label(self):
|
||||
"""Return package label (tag if defined, or date-hash if no tag)"""
|
||||
if self._tag == None:
|
||||
return ''.join([self.time('%Y%m%d'), "-", self.hash(8, 'untagged'), self.dirty()])
|
||||
else:
|
||||
return ''.join([self.tag(''), self.dirty()])
|
||||
|
||||
def revision(self):
|
||||
"""Return full revison string (tag if defined, or branch:hash date time if no tag"""
|
||||
if self._tag == None:
|
||||
return ''.join([self.branch('no-branch'), ":", self.hash(8, 'no-hash'), self.dirty(), self.time(' %Y%m%d %H:%M')])
|
||||
else:
|
||||
return ''.join([self.tag(''), self.dirty()])
|
||||
|
||||
def info(self):
|
||||
"""Print some repository info"""
|
||||
print "path: ", self.path()
|
||||
@ -169,6 +183,8 @@ class Repo:
|
||||
print "branch: ", self.branch()
|
||||
print "commit tag: ", self.tag('')
|
||||
print "dirty: ", self.dirty('yes', 'no')
|
||||
print "label: ", self.label()
|
||||
print "revision: ", self.revision()
|
||||
|
||||
def file_from_template(tpl_name, out_name, dict):
|
||||
"""Create or update file from template using dictionary
|
||||
@ -380,10 +396,15 @@ string given.
|
||||
TAG = r.tag(''),
|
||||
TAG_OR_BRANCH = r.tag(r.branch('unreleased')),
|
||||
TAG_OR_HASH8 = r.tag(r.hash(8, 'untagged')),
|
||||
LABEL = r.label(),
|
||||
REVISION = r.revision(),
|
||||
DIRTY = r.dirty(),
|
||||
FWTAG = xtrim(r.tag(r.branch('unreleased')), r.dirty(), 25),
|
||||
UNIXTIME = r.time(),
|
||||
DATE = r.time('%Y%m%d'),
|
||||
DAY=r.time('%d'),
|
||||
MONTH=r.time('%m'),
|
||||
YEAR=r.time('%Y'),
|
||||
DATETIME = r.time('%Y%m%d %H:%M'),
|
||||
BOARD_TYPE = args.type,
|
||||
BOARD_REVISION = args.revision,
|
||||
|
@ -14,13 +14,7 @@ ROOT_DIR := $(realpath $(WHEREAMI)/../)
|
||||
# Set up some macros
|
||||
BUILD_DIR := $(ROOT_DIR)/build
|
||||
VERSION_CMD := python $(ROOT_DIR)/make/scripts/version-info.py --path="$(ROOT_DIR)"
|
||||
# If there is a tag, use it for label instead of date-hash string
|
||||
PACKAGE_TAG := $(shell $(VERSION_CMD) --format=\$${TAG})
|
||||
ifneq ($(PACKAGE_TAG),)
|
||||
PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${TAG}\$${DIRTY})
|
||||
else
|
||||
PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${DATE}-\$${TAG_OR_HASH8}\$${DIRTY})
|
||||
endif
|
||||
PACKAGE_LBL := $(shell $(VERSION_CMD) --format=\$${LABEL})
|
||||
PACKAGE_DIR := $(BUILD_DIR)/package-$(PACKAGE_LBL)
|
||||
FW_DIR := $(PACKAGE_DIR)/firmware-$(PACKAGE_LBL)
|
||||
BL_DIR := $(FW_DIR)/bootloaders
|
||||
|
Loading…
Reference in New Issue
Block a user