summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/serverinfo.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-17 13:02:22 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-17 13:02:22 +0200
commit9760d4155f454399b045d3962245abbd69f3e351 (patch)
treea9a1b588f7832e5780c30009e9471ed624dcc3aa /rbutil/rbutilqt/base/serverinfo.cpp
parent14727b1ac362d9c0d7ca4f4225aab9193fce1569 (diff)
downloadrockbox-9760d4155f454399b045d3962245abbd69f3e351.tar.gz
rockbox-9760d4155f454399b045d3962245abbd69f3e351.tar.bz2
rockbox-9760d4155f454399b045d3962245abbd69f3e351.zip
Make ServerInfo parsing slightly more robust.
- Don't assume the list of release targets to be the same as the list of release-candidate targets. - Don't try to construct a download URL for releases with an empty release version. Change-Id: Icc3098a9db9e3d00261c32f4b9c2999ecc716380
Diffstat (limited to 'rbutil/rbutilqt/base/serverinfo.cpp')
-rw-r--r--rbutil/rbutilqt/base/serverinfo.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp
index 995cc1fe74..fd46f13a8b 100644
--- a/rbutil/rbutilqt/base/serverinfo.cpp
+++ b/rbutil/rbutilqt/base/serverinfo.cpp
@@ -56,7 +56,10 @@ void ServerInfo::readBuildInfo(QString file)
setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate));
info.beginGroup("release");
- QStringList keys = info.allKeys();
+ QStringList releasekeys = info.allKeys();
+ info.endGroup();
+ info.beginGroup("release-candidate");
+ QStringList rckeys = info.allKeys();
info.endGroup();
// get base platforms, handle variants with platforms in the loop
@@ -75,13 +78,13 @@ void ServerInfo::readBuildInfo(QString file)
// - <target>=<version>. In this case the URL is constructed.
// - <target>=<version>,<url>.
info.beginGroup("release");
- if(keys.contains(platforms.at(i))) {
+ if(releasekeys.contains(platforms.at(i))) {
QStringList entry = info.value(platforms.at(i)).toStringList();
releaseVersion = entry.at(0);
if(entry.size() > 1) {
releaseUrl = entry.at(1);
}
- else {
+ else if(!releaseVersion.isEmpty()) {
// construct release download URL
releaseUrl = releaseBaseUrl;
releaseUrl.replace("%MODEL%", platforms.at(i));
@@ -91,10 +94,10 @@ void ServerInfo::readBuildInfo(QString file)
info.endGroup();
// "release-candidate" section currently only support the 2nd format.
info.beginGroup("release-candidate");
- if(keys.contains(platforms.at(i))) {
+ if(rckeys.contains(platforms.at(i))) {
QStringList entry = info.value(platforms.at(i)).toStringList();
- relCandidateVersion = entry.at(0);
if(entry.size() > 1) {
+ relCandidateVersion = entry.at(0);
relCandidateUrl = entry.at(1);
}
}
@@ -183,7 +186,7 @@ QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
s.replace(":platform:", platform);
QString d = ServerInfoList[i].def;
d.replace(":platform:", platform);
- qDebug() << "[ServerInfo] GET" << s << serverInfos.value(s, d).toString();
+ qDebug() << "[ServerInfo] GET:" << s << serverInfos.value(s, d).toString();
return serverInfos.value(s, d);
}