From a3d9ace41ecbdfe72486dd9ec4d0dabf5eec299c Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 17 Jun 2012 11:25:11 +0200 Subject: 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 --- rbutil/rbutilqt/base/serverinfo.cpp | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/rbutil/rbutilqt/base/serverinfo.cpp b/rbutil/rbutilqt/base/serverinfo.cpp index eef7b1bdfe..995cc1fe74 100644 --- a/rbutil/rbutilqt/base/serverinfo.cpp +++ b/rbutil/rbutilqt/base/serverinfo.cpp @@ -71,13 +71,22 @@ void ServerInfo::readBuildInfo(QString file) QString releaseUrl; QString relCandidateVersion; QString relCandidateUrl; + // support two formats for "release" sections: + // - =. In this case the URL is constructed. + // - =,. info.beginGroup("release"); if(keys.contains(platforms.at(i))) { - releaseVersion = info.value(platforms.at(i)).toString(); - // construct release download URL - releaseUrl = releaseBaseUrl; - releaseUrl.replace("%MODEL%", platforms.at(i)); - releaseUrl.replace("%RELVERSION%", releaseVersion); + QStringList entry = info.value(platforms.at(i)).toStringList(); + releaseVersion = entry.at(0); + if(entry.size() > 1) { + releaseUrl = entry.at(1); + } + else { + // construct release download URL + releaseUrl = releaseBaseUrl; + releaseUrl.replace("%MODEL%", platforms.at(i)); + releaseUrl.replace("%RELVERSION%", releaseVersion); + } } info.endGroup(); // "release-candidate" section currently only support the 2nd format. @@ -91,6 +100,11 @@ void ServerInfo::readBuildInfo(QString file) } 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"); QString status = tr("Unknown"); @@ -109,11 +123,6 @@ void ServerInfo::readBuildInfo(QString file) break; } 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) for(int j = 0; j < variants.size(); ++j) { setPlatformValue(variants.at(j), ServerInfo::CurStatus, status); -- cgit v1.2.3