- update: fix release cycle handling; add human readable version string

Signed-off-by: GetAway <get-away@t-online.de>
This commit is contained in:
svenhoefer
2020-06-13 22:18:19 +02:00
committed by GetAway
parent 5d9749b1a0
commit 33ecf51bdb
6 changed files with 27 additions and 22 deletions

View File

@@ -712,7 +712,7 @@ flashupdate.menu_apply_settings Settingsübernahme erlauben
flashupdate.mkfs_create_image Backup erstellen
flashupdate.mkfs_preparing_files Dateien und Verzeichnisse vorbereiten
flashupdate.mkfs_using_sumtool Benutze Sumtool
flashupdate.msgbox Es wurde folgende neue Datei gefunden:\nDatum: %s, %s\nBasisImage: %s\nTyp: %s\n\nWollen Sie diese Version jetzt herunterladen und installieren?
flashupdate.msgbox Es wurde folgendes Update gefunden:\n%s %s vom %s, %s\n\nWollen Sie diese Version jetzt herunterladen?
flashupdate.mtdselector Partitions-Auswahl
flashupdate.namemode1 Dateiname Settingsfile
flashupdate.namemode1_default <Org.Name>+settings.img

View File

@@ -712,7 +712,7 @@ flashupdate.menu_apply_settings Allow apply settings
flashupdate.mkfs_create_image Create backup
flashupdate.mkfs_preparing_files Preparing files and directories
flashupdate.mkfs_using_sumtool Using sumtool
flashupdate.msgbox Found the following new file:\nDate: %s, %s\nBaseImage: %s\nType: %s\n\nDo you want to download and install this version now?
flashupdate.msgbox Found the following update:\n%s %s of %s, %s\n\nDo you want to download this version now?
flashupdate.mtdselector Partition-Selector
flashupdate.namemode1 Filename settingsfile
flashupdate.namemode1_default <org.name>+settings.img

View File

@@ -331,7 +331,7 @@ void CImageInfo::InitInfoData()
if (is_version_code && version_string.size() == 16){
static CFlashVersionInfo versionInfo(version_string.c_str());
if (oe_image_version.empty()){
version_string = versionInfo.getReleaseCycle();
version_string = versionInfo.getVersionString();
version_string += " ";
version_string += versionInfo.getType();
version_string += " (";

View File

@@ -251,7 +251,7 @@ bool CFlashUpdate::selectHttpImage(void)
char currentleft[200];
char currentright[200];
snprintf(currentleft, 200, "%s %d - %s, %s", curInfo.getType(true), curInfo.getVersion(), curInfo.getDate(), curInfo.getTime());
snprintf(currentleft, 200, "%s %s - %s, %s", curInfo.getType(true), curInfo.getVersionString(), curInfo.getDate(), curInfo.getTime());
snprintf(currentright, 200, "%s %s", imagedescription.c_str(), imageversion.c_str());
CMenuWidget SelectionWidget(LOCALE_FLASHUPDATE_SELECTIMAGE, NEUTRINO_ICON_UPDATE, listWidth, MN_WIDGET_ID_IMAGESELECTOR);
@@ -313,7 +313,7 @@ bool CFlashUpdate::selectHttpImage(void)
fileTypes[i] = versionInfo.snapshot;
std::string description = versionInfo.getType(true);
description += " ";
description += versionInfo.getVersion();
description += versionInfo.getVersionString();
description += " - ";
description += versionInfo.getDate();
description += ", ";
@@ -428,7 +428,7 @@ bool CFlashUpdate::checkVersion4Update()
msg_body = LOCALE_FLASHUPDATE_MSGBOX;
#ifdef SQUASHFS
versionInfo = new CFlashVersionInfo(newVersion);//Memory leak: versionInfo
sprintf(msg, g_Locale->getText(msg_body), versionInfo->getDate(), versionInfo->getTime(), versionInfo->getReleaseCycle(), versionInfo->getType(true));
sprintf(msg, g_Locale->getText(msg_body), versionInfo->getType(true), versionInfo->getVersionString(), versionInfo->getDate(), versionInfo->getTime());
if (gotImage)
{

View File

@@ -463,23 +463,21 @@ CFlashVersionInfo::CFlashVersionInfo(const std::string & _versionString)
snapshot = versionString[0];
// recover release cycle version
// will be compared with RELEASE_CYCLE, which is defined in configure.ac as "x.0"
releaseCycle[0] = versionString[1];
releaseCycle[1] = '.';
/*
if (versionString[2] == '0')
{
releaseCycle[2] = versionString[3];
releaseCycle[2] = '0';
releaseCycle[3] = 0;
}
else
*/
{
releaseCycle[2] = versionString[2];
releaseCycle[3] = versionString[3];
releaseCycle[4] = 0;
}
version = atoi(&releaseCycle[0]) * 100 + atoi(&releaseCycle[2]);
// human readable version
vstring[0] = versionString[1];
vstring[1] = '.';
vstring[2] = versionString[2];
vstring[3] = versionString[3];
vstring[4] = 0;
version = atoi(&versionString[1])*100 + atoi(&versionString[2])*10 + atoi(&versionString[3]);
// recover date
struct tm tt;
memset(&tt, 0, sizeof(tt));
@@ -561,6 +559,11 @@ int CFlashVersionInfo::getVersion(void) const
return version;
}
const char *CFlashVersionInfo::getVersionString(void) const
{
return vstring;
}
//-----------------------------------------------------------------------------------------------------------------
CMTDInfo::CMTDInfo()

View File

@@ -79,7 +79,8 @@ class CFlashVersionInfo
char date[11];
char time[6];
char releaseCycle[5];
char releaseCycle[4];
char vstring[5]; // human readable version
int version;
time_t datetime;
@@ -93,6 +94,7 @@ class CFlashVersionInfo
const char *getReleaseCycle(void) const;
const char *getType(bool localized = false) const;
int getVersion(void) const;
const char *getVersionString(void) const;
time_t getDateTime(void) const { return datetime; };
};