mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
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
This commit is contained in:
parent
14727b1ac3
commit
9760d4155f
2 changed files with 10 additions and 7 deletions
|
|
@ -56,7 +56,10 @@ void ServerInfo::readBuildInfo(QString file)
|
||||||
setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate));
|
setValue(ServerInfo::BleedingDate, date.toString(Qt::ISODate));
|
||||||
|
|
||||||
info.beginGroup("release");
|
info.beginGroup("release");
|
||||||
QStringList keys = info.allKeys();
|
QStringList releasekeys = info.allKeys();
|
||||||
|
info.endGroup();
|
||||||
|
info.beginGroup("release-candidate");
|
||||||
|
QStringList rckeys = info.allKeys();
|
||||||
info.endGroup();
|
info.endGroup();
|
||||||
|
|
||||||
// get base platforms, handle variants with platforms in the loop
|
// 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>. In this case the URL is constructed.
|
||||||
// - <target>=<version>,<url>.
|
// - <target>=<version>,<url>.
|
||||||
info.beginGroup("release");
|
info.beginGroup("release");
|
||||||
if(keys.contains(platforms.at(i))) {
|
if(releasekeys.contains(platforms.at(i))) {
|
||||||
QStringList entry = info.value(platforms.at(i)).toStringList();
|
QStringList entry = info.value(platforms.at(i)).toStringList();
|
||||||
releaseVersion = entry.at(0);
|
releaseVersion = entry.at(0);
|
||||||
if(entry.size() > 1) {
|
if(entry.size() > 1) {
|
||||||
releaseUrl = entry.at(1);
|
releaseUrl = entry.at(1);
|
||||||
}
|
}
|
||||||
else {
|
else if(!releaseVersion.isEmpty()) {
|
||||||
// construct release download URL
|
// construct release download URL
|
||||||
releaseUrl = releaseBaseUrl;
|
releaseUrl = releaseBaseUrl;
|
||||||
releaseUrl.replace("%MODEL%", platforms.at(i));
|
releaseUrl.replace("%MODEL%", platforms.at(i));
|
||||||
|
|
@ -91,10 +94,10 @@ void ServerInfo::readBuildInfo(QString file)
|
||||||
info.endGroup();
|
info.endGroup();
|
||||||
// "release-candidate" section currently only support the 2nd format.
|
// "release-candidate" section currently only support the 2nd format.
|
||||||
info.beginGroup("release-candidate");
|
info.beginGroup("release-candidate");
|
||||||
if(keys.contains(platforms.at(i))) {
|
if(rckeys.contains(platforms.at(i))) {
|
||||||
QStringList entry = info.value(platforms.at(i)).toStringList();
|
QStringList entry = info.value(platforms.at(i)).toStringList();
|
||||||
relCandidateVersion = entry.at(0);
|
|
||||||
if(entry.size() > 1) {
|
if(entry.size() > 1) {
|
||||||
|
relCandidateVersion = entry.at(0);
|
||||||
relCandidateUrl = entry.at(1);
|
relCandidateUrl = entry.at(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +186,7 @@ QVariant ServerInfo::platformValue(QString platform, enum ServerInfos info)
|
||||||
s.replace(":platform:", platform);
|
s.replace(":platform:", platform);
|
||||||
QString d = ServerInfoList[i].def;
|
QString d = ServerInfoList[i].def;
|
||||||
d.replace(":platform:", platform);
|
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);
|
return serverInfos.value(s, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue