1
0
Fork 0
forked from len0rd/rockbox

Support release-candidate entry format for releases.

The release-candiate entries provide both version and URL instead of only a
version entry and requiring the URL to be constructed separately. Since it's
easy to identify the format support both for release entries for improved
flexibility -- if the server URLs ever change the server only needs to get
updated to use the extended format.

Change-Id: If5c669b72d7acd6ac648c5f42dd844ae36904df6
This commit is contained in:
Dominik Riebeling 2012-06-17 11:25:11 +02:00
parent d3ddad95be
commit a3d9ace41e

View file

@ -71,13 +71,22 @@ void ServerInfo::readBuildInfo(QString file)
QString releaseUrl; QString releaseUrl;
QString relCandidateVersion; QString relCandidateVersion;
QString relCandidateUrl; QString relCandidateUrl;
// support two formats for "release" sections:
// - <target>=<version>. In this case the URL is constructed.
// - <target>=<version>,<url>.
info.beginGroup("release"); info.beginGroup("release");
if(keys.contains(platforms.at(i))) { if(keys.contains(platforms.at(i))) {
releaseVersion = info.value(platforms.at(i)).toString(); QStringList entry = info.value(platforms.at(i)).toStringList();
// construct release download URL releaseVersion = entry.at(0);
releaseUrl = releaseBaseUrl; if(entry.size() > 1) {
releaseUrl.replace("%MODEL%", platforms.at(i)); releaseUrl = entry.at(1);
releaseUrl.replace("%RELVERSION%", releaseVersion); }
else {
// construct release download URL
releaseUrl = releaseBaseUrl;
releaseUrl.replace("%MODEL%", platforms.at(i));
releaseUrl.replace("%RELVERSION%", releaseVersion);
}
} }
info.endGroup(); info.endGroup();
// "release-candidate" section currently only support the 2nd format. // "release-candidate" section currently only support the 2nd format.
@ -91,6 +100,11 @@ void ServerInfo::readBuildInfo(QString file)
} }
info.endGroup(); info.endGroup();
// "bleeding" section (development) does not provide individual
// information but only a global revision value.
QString develUrl = develBaseUrl;
develUrl.replace("%MODEL%", platforms.at(i));
develUrl.replace("%RELVERSION%", developmentRevision);
info.beginGroup("status"); info.beginGroup("status");
QString status = tr("Unknown"); QString status = tr("Unknown");
@ -109,11 +123,6 @@ void ServerInfo::readBuildInfo(QString file)
break; break;
} }
info.endGroup(); info.endGroup();
// release and development URLs are not provided by the server but
// constructed.
QString develUrl = develBaseUrl;
develUrl.replace("%MODEL%", platforms.at(i));
develUrl.replace("%RELVERSION%", developmentRevision);
// set variants (if any) // set variants (if any)
for(int j = 0; j < variants.size(); ++j) { for(int j = 0; j < variants.size(); ++j) {
setPlatformValue(variants.at(j), ServerInfo::CurStatus, status); setPlatformValue(variants.at(j), ServerInfo::CurStatus, status);