1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-19 09:54:15 +01:00

OP-770: add/rename some version-info.py template variables

This commit is contained in:
Oleg Semyonov 2013-05-25 16:40:58 +02:00
parent 4f6c633815
commit 444431579e
11 changed files with 37 additions and 37 deletions

View File

@ -563,7 +563,7 @@ $$(UAVO_COLLECTION_DIR)/$(1)/uavohash: $$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml
# The sed bit truncates the UAVO hash to 16 hex digits
$$(V1) $$(VERSION_INFO) \
--uavodir=$$(UAVO_COLLECTION_DIR)/$(1)/uavo-xml/shared/uavobjectdefinition \
--format='$$$${UAVOSHA1TXT}' | \
--format='$$$${UAVO_HASH}' | \
$(SED) -e 's|\(................\).*|\1|' > $$@
$$(V0) @$(ECHO) " UAVOHASH $(1) ->" $$$$(cat $$(UAVO_COLLECTION_DIR)/$(1)/uavohash)

View File

@ -30,7 +30,6 @@
/**
* We have 100 bytes for the whole description.
*
*
* Structure is:
* 4 bytes: header: "OpFw".
* 4 bytes: GIT commit tag (short version of SHA1).
@ -66,6 +65,6 @@ const struct fw_version_info fw_version_blob __attribute__((used)) __attribute__
.board_type = ${BOARD_TYPE},
.board_revision = ${BOARD_REVISION},
.commit_tag_name = "${FWTAG}",
.sha1sum = { ${SHA1} },
.uavosha1 = { ${UAVOSHA1} },
.sha1sum = { ${IMAGE_HASH_ARRAY} },
.uavosha1 = { ${UAVO_HASH_ARRAY} },
};

View File

@ -42,14 +42,14 @@ QString VersionInfo::hash()
return "${HASH}";
}
QString VersionInfo::uavoHashTxt()
{
return "${UAVOSHA1TXT}";
}
QString VersionInfo::uavoHash()
{
return "{ ${UAVOSHA1} }";
return "${UAVO_HASH}";
}
QString VersionInfo::uavoHashArray()
{
return "{ ${UAVO_HASH_ARRAY} }";
}
QString VersionInfo::label()

View File

@ -44,8 +44,8 @@ public:
static QString origin();
static QString revision();
static QString hash();
static QString uavoHashTxt();
static QString uavoHash();
static QString uavoHashArray();
static QString label();
static QString tag();
static QString tagOrBranch();

View File

@ -234,15 +234,15 @@ void ConfigPipXtremeWidget::updateStatus(UAVObject *object)
UAVObjectField *descField = object->getField("Description");
if (descField) {
/*
* This looks like a binary with a description at the end
* 4 bytes: header: "OpFw"
* 4 bytes: git commit hash (short version of SHA1)
* 4 bytes: Unix timestamp of last git commit
* 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
* ---- 40 bytes limit ---
* This looks like a binary with a description at the end:
* 4 bytes: header: "OpFw".
* 4 bytes: GIT commit tag (short version of SHA1).
* 4 bytes: Unix timestamp of compile time.
* 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
* 26 bytes: commit tag if it is there, otherwise branch name. '-dirty' may be added if needed. Zero-padded.
* 20 bytes: SHA1 sum of the firmware.
* 40 bytes: free for now.
* 20 bytes: SHA1 sum of the uavo definitions.
* 20 bytes: free for now.
*/
char buf[OPLinkStatus::DESCRIPTION_NUMELEM];
for (unsigned int i = 0; i < 26; ++i) {

View File

@ -76,10 +76,10 @@ AuthorsDialog::AuthorsDialog(QWidget *parent)
ideRev = tr("From revision %1<br/>").arg(VersionInfo::revision().left(10));
QString uavoHashStr;
if (VersionInfo::uavoHash().length() > 15) {
if (VersionInfo::uavoHashArray().length() > 15) {
// : This gets conditionally inserted as argument %11 into the description string.
QByteArray uavoHashArray;
QString uavoHash = VersionInfo::uavoHash();
QString uavoHash = VersionInfo::uavoHashArray();
uavoHash.chop(2);
uavoHash.remove(0, 2);
uavoHash = uavoHash.trimmed();

View File

@ -60,10 +60,10 @@ VersionDialog::VersionDialog(QWidget *parent)
layout->setSizeConstraint(QLayout::SetFixedSize);
QString uavoHashStr;
if (VersionInfo::uavoHash().length() > 15) {
if (VersionInfo::uavoHashArray().length() > 15) {
// : This gets conditionally inserted as argument %11 into the description string.
QByteArray uavoHashArray;
QString uavoHash = VersionInfo::uavoHash();
QString uavoHash = VersionInfo::uavoHashArray();
uavoHash.chop(2);
uavoHash.remove(0, 2);
uavoHash = uavoHash.trimmed();

View File

@ -423,14 +423,14 @@ bool UAVObjectUtilManager::descriptionToStructure(QByteArray desc, deviceDescrip
{
if (desc.startsWith("OpFw")) {
/*
* This looks like a binary with a description at the end
* 4 bytes: header: "OpFw"
* 4 bytes: git commit hash (short version of SHA1)
* 4 bytes: Unix timestamp of last git commit
* 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
* 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
* This looks like a binary with a description at the end:
* 4 bytes: header: "OpFw".
* 4 bytes: GIT commit tag (short version of SHA1).
* 4 bytes: Unix timestamp of compile time.
* 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
* 26 bytes: commit tag if it is there, otherwise branch name. '-dirty' may be added if needed. Zero-padded.
* 20 bytes: SHA1 sum of the firmware.
* 20 bytes: SHA1 sum of the UAVO definition files.
* 20 bytes: SHA1 sum of the uavo definitions.
* 20 bytes: free for now.
*/

View File

@ -957,7 +957,7 @@ void UploaderGadgetWidget::versionMatchCheck()
UAVObjectUtilManager *utilMngr = pm->getObject<UAVObjectUtilManager>();
deviceDescriptorStruct boardDescription = utilMngr->getBoardDescriptionStruct();
QByteArray uavoHashArray;
QString uavoHash = VersionInfo::uavoHash();
QString uavoHash = VersionInfo::uavoHashArray();
uavoHash.chop(2);
uavoHash.remove(0, 2);

View File

@ -271,7 +271,7 @@ def xtrim(string, suffix, length):
assert n > 0, "length of truncated string+suffix exceeds maximum length"
return ''.join([string[:n], '+', suffix])
def get_hash_of_dirs(directory, verbose = 0, raw = 0):
def get_hash_of_dirs(directory, verbose = 0, raw = 0, n = 40):
"""Return hash of XML files from UAVObject definition directory"""
import hashlib, os
SHAhash = hashlib.sha1()
@ -322,7 +322,7 @@ def get_hash_of_dirs(directory, verbose = 0, raw = 0):
print 'Final hash is', SHAhash.hexdigest()
if raw == 1:
return SHAhash.hexdigest()
return SHAhash.hexdigest()[:n]
else:
hex_stream = lambda s:",".join(['0x'+hex(ord(c))[2:].zfill(2) for c in s])
return hex_stream(SHAhash.digest())
@ -417,9 +417,10 @@ string given.
MINUTE = r.time('%M'),
BOARD_TYPE = args.type,
BOARD_REVISION = args.revision,
SHA1 = sha1(args.image),
UAVOSHA1TXT = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 1),
UAVOSHA1 = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 0),
UAVO_HASH = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 1),
UAVO_HASH8 = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 1, n = 8),
UAVO_HASH_ARRAY = get_hash_of_dirs(args.uavodir, verbose = 0, raw = 0),
IMAGE_HASH_ARRAY = sha1(args.image),
)
# Process positional arguments in the form of:

View File

@ -15,7 +15,7 @@
ORIGIN='${ORIGIN}'
REVISION='${REVISION}'
HASH='${HASH}'
UAVOSHA1='${UAVOSHA1TXT}'
UAVO_HASH='${UAVO_HASH}'
LABEL='${LABEL}'
TAG='${TAG}'
TAG_OR_BRANCH='${TAG_OR_BRANCH}'